YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: skip entire capture when browser extension popup matches ignored window
Louis Beaumontd3342e8f5e35
diff --git a/crates/screenpipe-a11y/src/tree/linux.rs b/crates/screenpipe-a11y/src/tree/linux.rsindex b2b7ff7e5..b5df00785 100644--- a/crates/screenpipe-a11y/src/tree/linux.rs+++ b/crates/screenpipe-a11y/src/tree/linux.rs@@ -476,6 +476,8 @@ struct WalkState {/// User-configured ignored window patterns (lowercase) for filtering browser/// extension popups whose DocumentWeb name matches an ignored keyword.ignored_windows_lower: Vec<String>,+ /// Set to true when a browser extension popup matching an ignored pattern is detected.+ hit_ignored_extension: bool,}impl WalkState {@@ -500,6 +502,7 @@ impl WalkState {.iter().map(|s| s.to_lowercase()).collect(),+ hit_ignored_extension: false,}}@@ -555,6 +558,7 @@ fn walk_accessible(conn: &Connection, aref: &AccessibleRef, depth: usize, state:.iter().any(|ig| name.contains(ig.as_str())){+ state.hit_ignored_extension = true;return;}}@@ -968,6 +972,14 @@ impl TreeWalkerPlatform for LinuxTreeWalker {// Walk the accessibility treewalk_accessible(conn, &window_ref, 0, &mut state);+ if state.hit_ignored_extension {+ debug!(+ "skipping capture: browser extension popup matched ignored window in app={}",+ app_name+ );+ return Ok(TreeWalkResult::Skipped(SkipReason::UserIgnored));+ }+let text_content = state.text_buffer;// Truncate if neededdiff --git a/crates/screenpipe-a11y/src/tree/macos.rs b/crates/screenpipe-a11y/src/tree/macos.rsindex cbd71911d..7278b7fce 100644--- a/crates/screenpipe-a11y/src/tree/macos.rs+++ b/crates/screenpipe-a11y/src/tree/macos.rs@@ -322,6 +322,17 @@ impl MacosTreeWalker {// Walk the accessibility treewalk_element(window, 0, &mut state);+ // If a browser extension popup matching an ignored window was detected,+ // skip the entire capture — including the screenshot — to prevent the+ // popup content from appearing in the timeline.+ if state.hit_ignored_extension {+ debug!(+ "skipping capture: browser extension popup matched ignored window in app={}",+ app_name+ );+ return Ok(TreeWalkResult::Skipped(SkipReason::UserIgnored));+ }+let text_content = state.text_buffer;// Don't bail on empty text — we still need the app_name and window_name// for frame metadata. Some apps may return empty text on the first walk@@ -404,6 +415,9 @@ struct WalkState {/// User-configured ignored window patterns (lowercase) for filtering browser/// extension popups whose AXWebArea title matches an ignored keyword.ignored_windows_lower: Vec<String>,+ /// Set to true when a browser extension popup matching an ignored pattern is+ /// detected. Signals the caller to skip the entire capture (including screenshot).+ hit_ignored_extension: bool,}impl WalkState {@@ -433,6 +447,7 @@ impl WalkState {.iter().map(|s| s.to_lowercase()).collect(),+ hit_ignored_extension: false,}}@@ -547,6 +562,7 @@ fn walk_element(elem: &ax::UiElement, depth: usize, state: &mut WalkState) {if get_string_attr(elem, ax::attr::title()).is_some_and(|t| matches(&t))|| get_string_attr(elem, ax::attr::url()).is_some_and(|u| matches(&u)){+ state.hit_ignored_extension = true;return;}}diff --git a/crates/screenpipe-a11y/src/tree/windows.rs b/crates/screenpipe-a11y/src/tree/windows.rsindex 65939b81c..a9328552b 100644--- a/crates/screenpipe-a11y/src/tree/windows.rs+++ b/crates/screenpipe-a11y/src/tree/windows.rs@@ -250,6 +250,7 @@ impl TreeWalkerPlatform for WindowsTreeWalker {.iter().map(|s| s.to_lowercase()).collect();+ let mut hit_ignored_extension = false;extract_text_from_tree(&root,0,@@ -259,8 +260,17 @@ impl TreeWalkerPlatform for WindowsTreeWalker {&mut browser_url,&monitor_rect,&ignored_lower,+ &mut hit_ignored_extension,);+ if hit_ignored_extension {+ debug!(+ "skipping capture: browser extension popup matched ignored window in app={}",+ app_name+ );+ return Ok(TreeWalkResult::Skipped(SkipReason::UserIgnored));+ }+// Don't bail on empty text — we still need the app_name and window_name// for frame metadata. Electron apps (Discord, Slack, etc.) often return// sparse accessibility text but the app/window detection already succeeded.@@ -409,6 +419,7 @@ fn extract_text_from_tree(browser_url: &mut Option<String>,monitor_rect: &Option<MonitorRect>,ignored_windows_lower: &[String],+ hit_ignored_extension: &mut bool,) {if depth > max_depth {return;@@ -470,6 +481,7 @@ fn extract_text_from_tree(if node.name.as_deref().is_some_and(|n| matches(n))|| node.value.as_deref().is_some_and(|v| matches(v)){+ *hit_ignored_extension = true;return;}}@@ -549,6 +561,7 @@ fn extract_text_from_tree(browser_url,monitor_rect,ignored_windows_lower,+ hit_ignored_extension,);}}@@ -656,7 +669,7 @@ mod tests {let mut buf = String::new();let mut nodes = Vec::new();let mut url = None;- extract_text_from_tree(&tree, 0, 10, &mut buf, &mut nodes, &mut url, &None, &[]);+ extract_text_from_tree(&tree, 0, 10, &mut buf, &mut nodes, &mut url, &None, &[], &mut false);// Text node's name should be capturedassert!(@@ -748,7 +761,7 @@ mod tests {let mut buf = String::new();let mut nodes = Vec::new();let mut url = None;- extract_text_from_tree(&tree, 0, 30, &mut buf, &mut nodes, &mut url, &None, &[]);+ extract_text_from_tree(&tree, 0, 30, &mut buf, &mut nodes, &mut url, &None, &[], &mut false);// URL should be captured as browser_url, NOT as textassert_eq!(