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

fix(timeline): emit window-focused on show to auto-refresh stale data

Louis Beaumont0b0570463be8
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index c2a34600f..8336c6655 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -238,7 +238,7 @@ async unregisterWindowShortcuts() : Promise<Result<null, string>> {
}
},
/**
- * Suspend arrow key shortcuts (call when search/chat modal opens)
+ * Suspend arrow shortcuts (called from JS when search/chat modal opens)
*/
async suspendArrowShortcuts() : Promise<Result<null, string>> {
try {
@@ -249,7 +249,7 @@ async suspendArrowShortcuts() : Promise<Result<null, string>> {
}
},
/**
- * Resume arrow key shortcuts (call when search/chat modal closes)
+ * Resume arrow shortcuts (called from JS when search/chat modal closes)
*/
async resumeArrowShortcuts() : Promise<Result<null, string>> {
try {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 85f5a0714..dc7056291 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -56,6 +56,11 @@ pub fn show_main_window(app_handle: &tauri::AppHandle, _overlay: bool) {
error!("Failed to set focus on main window: {}", e);
}
+ // Emit window-focused so the timeline refreshes immediately.
+ // Without this, opening via tray/shortcut (where the window was
+ // already "focused" or never lost focus) wouldn't trigger a re-fetch.
+ let _ = app_handle.emit("window-focused", true);
+
// Register window-specific shortcuts (Escape, Ctrl+Cmd+K) on a separate task
// IMPORTANT: This MUST be spawned async to avoid deadlock when called from
// within a global shortcut callback (the callback holds the shortcut manager lock)