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(windows): overlay timeline Escape key not working when opened from search (#3137)
Ansh Grover3e5f6c63f4e2
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rsindex 4ebf983ab..6945e57dc 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -476,11 +476,19 @@ pub fn show_main_window(app_handle: &tauri::AppHandle, _overlay: bool) {// NOTE: On macOS, Escape is registered only from the focus-gain handler// in window/show.rs (duplicate RegisterEventHotKey fails there).- // On Windows/Linux, set_focus can succeed without delivering a new- // Focused(true) event when Home already had focus — then Escape never- // re-registers until another focus cycle. Sync once after show.+ // On Windows/Linux, bypass the is_visible() guard — window.show() posts+ // an async Win32 message so IsWindowVisible returns false in the same+ // synchronous frame, causing register_if_main_visible to skip silently.+ // IMPORTANT: spawn a new thread — show_main_window is invoked from within+ // the global-shortcut callback which holds the plugin's handler-map lock.+ // Calling on_shortcut() from inside that callback deadlocks.#[cfg(not(target_os = "macos"))]- register_window_shortcuts_if_main_visible(app_handle.clone());+ {+ let app = app_handle.clone();+ std::thread::spawn(move || {+ let _ = register_window_shortcuts_with_generation(app);+ });+ }}Err(e) => {error!("ShowRewindWindow::Main.show failed: {}", e);@@ -1002,6 +1010,18 @@ pub async fn search_navigate_to_timeline(.show(&app_handle).map_err(|e| e.to_string())?;+ // Register Escape shortcut so it works even when the overlay doesn't gain keyboard+ // focus (e.g. Home window keeps focus when a search result opens the overlay).+ // Bypass register_if_main_visible: window.show() is async on Windows so+ // IsWindowVisible returns false in the same frame, causing silent skip.+ #[cfg(not(target_os = "macos"))]+ {+ let app = app_handle.clone();+ std::thread::spawn(move || {+ let _ = register_window_shortcuts_with_generation(app);+ });+ }+// Emit the navigation event multiple times — the Main webview may take// varying time to restore from order_out and mount the event listener.// The JS side deduplicates via a seekingTimestamp ref.diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rsindex 4e3fbc5a8..ec8ca807b 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs@@ -381,17 +381,15 @@ impl ShowRewindWindow {cursor.y as i32,) {error!("Failed to reposition overlay to cursor monitor: {}", e);- // Fallback: just bring to front at current position- if let Err(e) = crate::windows_overlay::bring_to_front(window) {- error!("Failed to bring window to front: {}", e);- }- }- } else {- // Can't get cursor position, just bring to front- if let Err(e) = crate::windows_overlay::bring_to_front(window) {- error!("Failed to bring window to front: {}", e);}}+ // Always activate after repositioning so the overlay receives keyboard focus.+ // Without this, re-showing an already-created overlay when another screenpipe+ // window (e.g. Home) holds focus leaves the overlay visible but not interactive —+ // Escape and all shortcuts are swallowed by the unfocused background window.+ if let Err(e) = crate::windows_overlay::bring_to_front_and_activate(window) {+ error!("Failed to activate overlay: {}", e);+ }let _ = app.emit("window-focused", true);}#[cfg(target_os = "linux")]