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: global arrow key navigation for timeline

Louis Beaumontf1255eac3421
diff --git a/Cargo.lock b/Cargo.lock
index 5894278cd..bb730b4ca 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6626,7 +6626,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"anyhow",
"bytemuck",
@@ -6679,7 +6679,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6730,7 +6730,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"anyhow",
"chrono",
@@ -6754,7 +6754,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"anyhow",
"chrono",
@@ -6772,7 +6772,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"anyhow",
"image",
@@ -6787,7 +6787,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"anyhow",
"async-trait",
@@ -6856,7 +6856,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.94"
+version = "0.3.95"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index f19eae371..b45b602aa 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -510,6 +510,78 @@ export default function Timeline() {
return () => { unlisten.then((fn) => fn()); };
}, [showSearchModal]);
+ // Suspend/resume arrow shortcuts when search modal opens/closes
+ useEffect(() => {
+ if (showSearchModal) {
+ commands.suspendArrowShortcuts().catch(() => {});
+ } else {
+ commands.resumeArrowShortcuts().catch(() => {});
+ }
+ }, [showSearchModal]);
+
+ // Suspend arrow shortcuts when any text input is focused (AI panel, etc.)
+ // so arrow keys work normally for cursor movement in text fields
+ useEffect(() => {
+ const handleFocusIn = (e: FocusEvent) => {
+ const target = e.target as HTMLElement;
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target.isContentEditable) {
+ commands.suspendArrowShortcuts().catch(() => {});
+ }
+ };
+ const handleFocusOut = (e: FocusEvent) => {
+ const target = e.target as HTMLElement;
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement || target.isContentEditable) {
+ // Only resume if search modal isn't open
+ if (!showSearchModal) {
+ commands.resumeArrowShortcuts().catch(() => {});
+ }
+ }
+ };
+ document.addEventListener("focusin", handleFocusIn);
+ document.addEventListener("focusout", handleFocusOut);
+ return () => {
+ document.removeEventListener("focusin", handleFocusIn);
+ document.removeEventListener("focusout", handleFocusOut);
+ };
+ }, [showSearchModal]);
+
+ // Handle arrow key navigation from Rust global shortcuts
+ useEffect(() => {
+ const unlisten = listen<string>("timeline-navigate", (event) => {
+ const dir = event.payload;
+ if (dir === "prev-frame") {
+ setCurrentIndex((prev) => {
+ const next = Math.min(prev + 1, frames.length - 1);
+ if (frames[next]) setCurrentFrame(frames[next]);
+ return next;
+ });
+ } else if (dir === "next-frame") {
+ setCurrentIndex((prev) => {
+ const next = Math.max(prev - 1, 0);
+ if (frames[next]) setCurrentFrame(frames[next]);
+ return next;
+ });
+ } else if (dir === "prev-app" || dir === "next-app") {
+ setCurrentIndex((prev) => {
+ const currentApp = frames[prev]?.devices?.[0]?.metadata?.app_name;
+ const step = dir === "prev-app" ? 1 : -1;
+ let i = prev + step;
+ // Skip frames with the same app
+ while (i >= 0 && i < frames.length) {
+ const app = frames[i]?.devices?.[0]?.metadata?.app_name;
+ if (app && app !== currentApp) {
+ if (frames[i]) setCurrentFrame(frames[i]);
+ return i;
+ }
+ i += step;
+ }
+ return prev; // no boundary found
+ });
+ }
+ });
+ return () => { unlisten.then((fn) => fn()); };
+ }, [frames, setCurrentFrame]);
+
useEffect(() => {
const getStartDateAndSet = async () => {
const data = await getStartDate();
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index b775da6ab..c2a34600f 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -237,6 +237,28 @@ async unregisterWindowShortcuts() : Promise<Result<null, string>> {
else return { status: "error", error: e as any };
}
},
+/**
+ * Suspend arrow key shortcuts (call when search/chat modal opens)
+ */
+async suspendArrowShortcuts() : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("suspend_arrow_shortcuts") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Resume arrow key shortcuts (call when search/chat modal closes)
+ */
+async resumeArrowShortcuts() : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("resume_arrow_shortcuts") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async setTrayUnhealthIcon() : Promise<void> {
await TAURI_INVOKE("set_tray_unhealth_icon");
},
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 706c44cad..85f5a0714 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -741,7 +741,11 @@ pub fn register_window_shortcuts(app_handle: tauri::AppHandle) -> Result<(), Str
// Note: Chat shortcut (Ctrl+Cmd+L) is now global-only, not window-specific
// This allows one consistent shortcut for chat everywhere
- info!("Window-specific shortcuts registered (Escape, {})", shortcut_to_use);
+ // Register arrow key shortcuts for timeline navigation
+ // Plain arrows = frame step, Alt+arrows = app-boundary jump
+ register_arrow_shortcuts(app_handle.clone())?;
+
+ info!("Window-specific shortcuts registered (Escape, {}, arrows)", shortcut_to_use);
Ok(())
}
@@ -779,8 +783,100 @@ pub fn unregister_window_shortcuts(app_handle: tauri::AppHandle) -> Result<(), S
let _ = global_shortcut.unregister(search_shortcut);
}
+ // Unregister arrow key shortcuts
+ unregister_arrow_shortcuts(&app_handle)?;
+
// Note: Chat shortcut (Ctrl+Cmd+L) is global-only, no need to unregister here
info!("Window-specific shortcuts unregistered");
Ok(())
+}
+
+/// Register arrow key shortcuts for timeline frame navigation
+/// Plain arrows = frame step, Alt+arrows = app-boundary jump
+fn register_arrow_shortcuts(app_handle: tauri::AppHandle) -> Result<(), String> {
+ use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut, ShortcutState};
+ use tauri::Emitter;
+
+ let gs = app_handle.global_shortcut();
+
+ // ArrowLeft = prev frame
+ let left = Shortcut::new(None, Code::ArrowLeft);
+ let app = app_handle.clone();
+ if let Err(e) = gs.on_shortcut(left, move |_app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ let _ = app.emit("timeline-navigate", "prev-frame");
+ }
+ }) {
+ if !e.to_string().contains("already registered") {
+ error!("Failed to register ArrowLeft shortcut: {}", e);
+ }
+ }
+
+ // ArrowRight = next frame
+ let right = Shortcut::new(None, Code::ArrowRight);
+ let app = app_handle.clone();
+ if let Err(e) = gs.on_shortcut(right, move |_app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ let _ = app.emit("timeline-navigate", "next-frame");
+ }
+ }) {
+ if !e.to_string().contains("already registered") {
+ error!("Failed to register ArrowRight shortcut: {}", e);
+ }
+ }
+
+ // Alt+ArrowLeft = prev app boundary
+ let alt_left = Shortcut::new(Some(Modifiers::ALT), Code::ArrowLeft);
+ let app = app_handle.clone();
+ if let Err(e) = gs.on_shortcut(alt_left, move |_app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ let _ = app.emit("timeline-navigate", "prev-app");
+ }
+ }) {
+ if !e.to_string().contains("already registered") {
+ error!("Failed to register Alt+ArrowLeft shortcut: {}", e);
+ }
+ }
+
+ // Alt+ArrowRight = next app boundary
+ let alt_right = Shortcut::new(Some(Modifiers::ALT), Code::ArrowRight);
+ let app = app_handle.clone();
+ if let Err(e) = gs.on_shortcut(alt_right, move |_app, _, event| {
+ if matches!(event.state, ShortcutState::Pressed) {
+ let _ = app.emit("timeline-navigate", "next-app");
+ }
+ }) {
+ if !e.to_string().contains("already registered") {
+ error!("Failed to register Alt+ArrowRight shortcut: {}", e);
+ }
+ }
+
+ Ok(())
+}
+
+/// Unregister arrow key shortcuts
+fn unregister_arrow_shortcuts(app_handle: &tauri::AppHandle) -> Result<(), String> {
+ use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut};
+
+ let gs = app_handle.global_shortcut();
+ let _ = gs.unregister(Shortcut::new(None, Code::ArrowLeft));
+ let _ = gs.unregister(Shortcut::new(None, Code::ArrowRight));
+ let _ = gs.unregister(Shortcut::new(Some(Modifiers::ALT), Code::ArrowLeft));
+ let _ = gs.unregister(Shortcut::new(Some(Modifiers::ALT), Code::ArrowRight));
+ Ok(())
+}
+
+/// Suspend arrow shortcuts (called from JS when search/chat modal opens)
+#[tauri::command]
+#[specta::specta]
+pub fn suspend_arrow_shortcuts(app_handle: tauri::AppHandle) -> Result<(), String> {
+ unregister_arrow_shortcuts(&app_handle)
+}
+
+/// Resume arrow shortcuts (called from JS when search/chat modal closes)
+#[tauri::command]
+#[specta::specta]
+pub fn resume_arrow_shortcuts(app_handle: tauri::AppHandle) -> Result<(), String> {
+ register_arrow_shortcuts(app_handle)
}
\ No newline at end of file
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 8223312f1..c3a785581 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -988,6 +988,8 @@ async fn main() {
// Window-specific shortcut commands (dynamic registration)
commands::register_window_shortcuts,
commands::unregister_window_shortcuts,
+ commands::suspend_arrow_shortcuts,
+ commands::resume_arrow_shortcuts,
// Commands from tray.rs
set_tray_unhealth_icon,
set_tray_health_icon,
@@ -1131,6 +1133,8 @@ async fn main() {
// Window-specific shortcut commands (dynamic registration)
commands::register_window_shortcuts,
commands::unregister_window_shortcuts,
+ commands::suspend_arrow_shortcuts,
+ commands::resume_arrow_shortcuts,
// Overlay commands (Windows)
commands::enable_overlay_click_through,
commands::disable_overlay_click_through,