Skip to content

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

feat: sync window filters to accessibility tree walker + redesign screen settings UI

Louis Beaumont2acc7259d6f2
diff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
index ea89afdd5..aad03a8dd 100644
--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx
@@ -1291,9 +1291,9 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
- {/* Video */}
+ {/* Screen */}
<div className="space-y-2 pt-2">
- <h2 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1">Video</h2>
+ <h2 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1">Screen</h2>
{/* Disable Screen Recording */}
<Card className="border-border bg-card">
@@ -1311,20 +1311,43 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
</CardContent>
</Card>
- {/* Disable OCR */}
+ {/* Text extraction methods - shown when screen recording is on */}
{!settings.disableVision && (
<Card className="border-border bg-card">
- <CardContent className="px-3 py-2.5">
- <div className="flex items-center justify-between">
- <div className="flex items-center space-x-2.5">
- <EyeOff className="h-4 w-4 text-muted-foreground shrink-0" />
+ <CardContent className="px-3 py-2.5 space-y-3">
+ <div className="flex items-center space-x-2.5">
+ <Eye className="h-4 w-4 text-muted-foreground shrink-0" />
+ <h3 className="text-sm font-medium text-foreground">Text extraction</h3>
+ </div>
+
+ {/* OCR */}
+ <div className="flex items-center justify-between ml-[26px]">
+ <div>
+ <h4 className="text-sm text-foreground">OCR (optical character recognition)</h4>
+ <p className="text-xs text-muted-foreground">Reads text from screenshots. Higher CPU but captures everything visible on screen.</p>
+ </div>
+ <Switch id="enableOcr" checked={!(settings.disableOcr ?? false)} onCheckedChange={(checked) => handleSettingsChange({ disableOcr: !checked }, true)} />
+ </div>
+
+ <Separator className="ml-[26px]" />
+
+ {/* Element capture (accessibility tree walker) */}
+ {(isMacOS || platform() === "windows") && (
+ <div className="flex items-center justify-between ml-[26px]">
<div>
- <h3 className="text-sm font-medium text-foreground">Disable OCR</h3>
- <p className="text-xs text-muted-foreground">Capture screen but skip text extraction (reduces CPU usage significantly)</p>
+ <h4 className="text-sm text-foreground flex items-center gap-1.5">
+ Element capture
+ <Badge variant="outline" className="text-[10px] px-1 py-0">beta</Badge>
+ </h4>
+ <p className="text-xs text-muted-foreground">Reads text directly from UI elements via accessibility APIs. Much lower CPU than OCR but may miss some content (images, custom-rendered text).</p>
</div>
+ <Switch
+ id="enableUiEvents"
+ checked={settings.enableUiEvents ?? false}
+ onCheckedChange={(checked) => handleSettingsChange({ enableUiEvents: checked }, true)}
+ />
</div>
- <Switch id="disableOcr" checked={settings.disableOcr ?? false} onCheckedChange={(checked) => handleSettingsChange({ disableOcr: checked }, true)} />
- </div>
+ )}
</CardContent>
</Card>
)}
@@ -1438,33 +1461,7 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
- {/* UI Events */}
- {(isMacOS || platform() === "windows") && (
- <div className="space-y-2 pt-2">
- <h2 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1">UI Events</h2>
- <Card className="border-border bg-card">
- <CardContent className="px-3 py-2.5">
- <div className="flex items-center justify-between">
- <div className="flex items-center space-x-2.5">
- <Key className="h-4 w-4 text-muted-foreground shrink-0" />
- <div>
- <h3 className="text-sm font-medium text-foreground flex items-center gap-1.5">
- UI event capture
- <HelpTooltip text="Records mouse clicks, keyboard activity, and window focus changes. Used for activity tracking and search context." />
- </h3>
- <p className="text-xs text-muted-foreground">Keyboard, mouse, and clipboard events</p>
- </div>
- </div>
- <Switch
- id="enableUiEvents"
- checked={settings.enableUiEvents ?? false}
- onCheckedChange={(checked) => handleSettingsChange({ enableUiEvents: checked }, true)}
- />
- </div>
- </CardContent>
- </Card>
- </div>
- )}
+ {/* UI Events section removed — now part of Screen > Text extraction */}
@@ -1478,7 +1475,7 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
<AppWindowMac className="h-4 w-4 text-muted-foreground shrink-0" />
<h3 className="text-sm font-medium text-foreground flex items-center gap-1.5">
Ignored windows
- <HelpTooltip text="Windows matching these patterns will not be captured. Use for privacy — e.g. add 'Password Manager' to skip sensitive apps." />
+ <HelpTooltip text="Windows matching these patterns will not be captured by OCR or element capture. Use for privacy — e.g. add 'Password Manager' to skip sensitive apps." />
</h3>
</div>
<div className="ml-[26px]">
@@ -1499,7 +1496,7 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre
<AppWindowMac className="h-4 w-4 text-muted-foreground shrink-0" />
<h3 className="text-sm font-medium text-foreground flex items-center gap-1.5">
Included windows
- <HelpTooltip text="When set, ONLY windows matching these patterns will be captured. Everything else is ignored. Leave empty to capture all windows (except ignored ones)." />
+ <HelpTooltip text="When set, ONLY windows matching these patterns will be captured by OCR and element capture. Everything else is ignored. Leave empty to capture all windows (except ignored ones)." />
</h3>
</div>
<div className="ml-[26px]">
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/embedded_server.rs b/apps/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
index b735b0f0e..92a4259c1 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/embedded_server.rs
@@ -603,6 +603,9 @@ pub async fn start_embedded_server(
if config.enable_ui_events {
let ui_config = UiRecorderConfig {
enabled: true,
+ excluded_windows: config.ignored_windows.clone(),
+ ignored_windows: config.ignored_windows.clone(),
+ included_windows: config.included_windows.clone(),
..Default::default()
};
let db_clone = db.clone();
diff --git a/crates/screenpipe-accessibility/src/tree/macos.rs b/crates/screenpipe-accessibility/src/tree/macos.rs
index e2cbb58b7..a0284a6f8 100644
--- a/crates/screenpipe-accessibility/src/tree/macos.rs
+++ b/crates/screenpipe-accessibility/src/tree/macos.rs
@@ -55,6 +55,14 @@ impl TreeWalkerPlatform for MacosTreeWalker {
return Ok(None);
}
+ // Apply user-configured ignored windows (check app name)
+ if self.config.ignored_windows.iter().any(|pattern| {
+ let p = pattern.to_lowercase();
+ app_lower.contains(&p)
+ }) {
+ return Ok(None);
+ }
+
// 2. Get the focused window via AX API
let ax_app = ax::UiElement::with_app_pid(pid);
let _ = ax_app.set_messaging_timeout_secs(self.config.element_timeout_secs);
@@ -81,6 +89,29 @@ impl TreeWalkerPlatform for MacosTreeWalker {
return Ok(None);
}
+ // Apply user-configured ignored windows (also check window title)
+ if self.config.ignored_windows.iter().any(|pattern| {
+ let p = pattern.to_lowercase();
+ window_lower.contains(&p)
+ }) {
+ return Ok(None);
+ }
+
+ // Apply user-configured included windows (also check window title)
+ if !self.config.included_windows.is_empty() {
+ let matches_app = self.config.included_windows.iter().any(|pattern| {
+ let p = pattern.to_lowercase();
+ app_lower.contains(&p)
+ });
+ let matches_window = self.config.included_windows.iter().any(|pattern| {
+ let p = pattern.to_lowercase();
+ window_lower.contains(&p)
+ });
+ if !matches_app && !matches_window {
+ return Ok(None);
+ }
+ }
+
// 3. Walk the accessibility tree
let mut state = WalkState::new(&self.config, start);
walk_element(window, 0, &mut state);
diff --git a/crates/screenpipe-accessibility/src/tree/mod.rs b/crates/screenpipe-accessibility/src/tree/mod.rs
index 910c56cac..ec4ce9f16 100644
--- a/crates/screenpipe-accessibility/src/tree/mod.rs
+++ b/crates/screenpipe-accessibility/src/tree/mod.rs
@@ -55,6 +55,10 @@ pub struct TreeWalkerConfig {
pub max_text_length: usize,
/// Per-element AX IPC timeout (default: 200ms).
pub element_timeout_secs: f32,
+ /// User-configured windows to ignore (substring match on app name or window title).
+ pub ignored_windows: Vec<String>,
+ /// User-configured windows to include (whitelist — if non-empty, only these are captured).
+ pub included_windows: Vec<String>,
}
impl Default for TreeWalkerConfig {
@@ -66,6 +70,8 @@ impl Default for TreeWalkerConfig {
walk_timeout: Duration::from_millis(100),
max_text_length: 50_000,
element_timeout_secs: 0.2,
+ ignored_windows: Vec::new(),
+ included_windows: Vec::new(),
}
}
}
diff --git a/crates/screenpipe-server/src/cli.rs b/crates/screenpipe-server/src/cli.rs
index bde58459c..7282a9cab 100644
--- a/crates/screenpipe-server/src/cli.rs
+++ b/crates/screenpipe-server/src/cli.rs
@@ -332,6 +332,8 @@ impl Cli {
crate::ui_recorder::UiRecorderConfig {
enabled: self.enable_ui_events,
excluded_windows: self.ignored_windows.clone(),
+ ignored_windows: self.ignored_windows.clone(),
+ included_windows: self.included_windows.clone(),
..Default::default()
}
}
@@ -628,6 +630,8 @@ impl RecordArgs {
crate::ui_recorder::UiRecorderConfig {
enabled: self.enable_ui_events,
excluded_windows: self.ignored_windows.clone(),
+ ignored_windows: self.ignored_windows.clone(),
+ included_windows: self.included_windows.clone(),
..Default::default()
}
}
diff --git a/crates/screenpipe-server/src/ui_recorder.rs b/crates/screenpipe-server/src/ui_recorder.rs
index ad5abcbbc..86fc0d883 100644
--- a/crates/screenpipe-server/src/ui_recorder.rs
+++ b/crates/screenpipe-server/src/ui_recorder.rs
@@ -55,8 +55,12 @@ pub struct UiRecorderConfig {
pub capture_context: bool,
/// Additional apps to exclude
pub excluded_apps: Vec<String>,
- /// Window patterns to exclude
+ /// Window patterns to exclude (for input event capture)
pub excluded_windows: Vec<String>,
+ /// User-configured ignored windows (for tree walker — substring match)
+ pub ignored_windows: Vec<String>,
+ /// User-configured included windows (whitelist for tree walker)
+ pub included_windows: Vec<String>,
/// Batch size for database inserts
pub batch_size: usize,
/// Batch timeout in milliseconds
@@ -83,6 +87,8 @@ impl Default for UiRecorderConfig {
capture_context: true,
excluded_apps: Vec::new(),
excluded_windows: Vec::new(),
+ ignored_windows: Vec::new(),
+ included_windows: Vec::new(),
batch_size: 100,
batch_timeout_ms: 1000,
enable_tree_walker: true,
@@ -316,11 +322,13 @@ pub async fn start_ui_recording(
let tree_stop = stop_flag.clone();
let walk_interval = Duration::from_millis(config.tree_walk_interval_ms);
let rt_handle = tokio::runtime::Handle::current();
+ let ignored_windows_clone = config.ignored_windows.clone();
+ let included_windows_clone = config.included_windows.clone();
// Run the entire tree walker loop in a blocking thread since AX APIs are synchronous IPC
let tree_wake = wake_signal.clone();
Some(tokio::task::spawn_blocking(move || {
- run_tree_walker(tree_db, tree_stop, walk_interval, rt_handle, tree_wake);
+ run_tree_walker(tree_db, tree_stop, walk_interval, rt_handle, tree_wake, ignored_windows_clone, included_windows_clone);
}))
} else {
info!("AX tree walker is disabled");
@@ -398,11 +406,15 @@ fn run_tree_walker(
walk_interval: Duration,
rt_handle: tokio::runtime::Handle,
wake_signal: WakeSignal,
+ ignored_windows: Vec<String>,
+ included_windows: Vec<String>,
) {
info!("Starting AX tree walker (interval: {:?})", walk_interval);
let tree_config = TreeWalkerConfig {
walk_interval,
+ ignored_windows,
+ included_windows,
..Default::default()
};
let walker = create_tree_walker(tree_config);