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(timeline): no-op the show shortcut when timeline disabled + dedupe restart
Louis Beaumontd36c17c013e7
diff --git a/apps/screenpipe-app-tauri/components/settings/display-section.tsx b/apps/screenpipe-app-tauri/components/settings/display-section.tsxindex 76ee28f72..a93e14052 100644--- a/apps/screenpipe-app-tauri/components/settings/display-section.tsx+++ b/apps/screenpipe-app-tauri/components/settings/display-section.tsx@@ -22,6 +22,9 @@ export function DisplaySection() {const { theme, setTheme } = useTheme();const { toast } = useToast();const { isMac } = usePlatform();+ // Guards the Disable-Timeline toggle against double-invoke (rapid toggle /+ // re-render) so we never fire two overlapping screenpipe restarts.+ const timelineRestartingRef = React.useRef(false);const handleSettingsChange = (newSettings: Partial<Settings>) => {if (settings) {@@ -111,36 +114,44 @@ export function DisplaySection() {id="disableTimeline"checked={settings?.disableTimeline ?? false}onCheckedChange={async (checked) => {- // Persist first (awaited) so the backend reads the new value on- // restart and the shortcut-reminder guard sees it immediately.- await updateSettings({ disableTimeline: checked });- // The screenpipe shortcut only opens the timeline, so its- // reminder overlay is meaningless once the timeline is off —- // tear it down on disable, restore it on re-enable.+ // Collapse double-invoke (rapid toggle / re-render) into one+ // restart — two overlapping stop/spawn cycles raced before.+ if (timelineRestartingRef.current) return;+ timelineRestartingRef.current = true;try {- if (checked) {- await commands.hideShortcutReminder();- } else if (settings?.showShortcutOverlay) {- await commands.showShortcutReminder(settings.showScreenpipeShortcut);+ // Persist first (awaited) so the backend reads the new value+ // on restart and the shortcut-reminder guard sees it.+ await updateSettings({ disableTimeline: checked });+ // The screenpipe shortcut only opens the timeline, so its+ // reminder overlay is meaningless once the timeline is off —+ // tear it down on disable, restore it on re-enable.+ try {+ if (checked) {+ await commands.hideShortcutReminder();+ } else if (settings?.showShortcutOverlay) {+ await commands.showShortcutReminder(settings.showScreenpipeShortcut);+ }+ } catch {}+ // disableTimeline gates timeline-only backend work (hot-cache+ // warm-up + frame/audio buffering) wired at server startup, so+ // it needs a full screenpipe restart to take effect.+ try {+ await commands.stopScreenpipe();+ await new Promise((r) => setTimeout(r, 500));+ await commands.spawnScreenpipe(null);+ toast({+ title: checked ? "timeline disabled" : "timeline enabled",+ description: "screenpipe restarted to apply the change.",+ });+ } catch (e) {+ toast({+ title: "failed to restart screenpipe",+ description: "restart screenpipe manually to apply the change.",+ variant: "destructive",+ });}- } catch {}- // disableTimeline gates timeline-only backend work (hot-cache- // warm-up + frame/audio buffering) wired at server startup, so- // it needs a full screenpipe restart to take effect.- try {- await commands.stopScreenpipe();- await new Promise((r) => setTimeout(r, 500));- await commands.spawnScreenpipe(null);- toast({- title: checked ? "timeline disabled" : "timeline enabled",- description: "screenpipe restarted to apply the change.",- });- } catch (e) {- toast({- title: "failed to restart screenpipe",- description: "restart screenpipe manually to apply the change.",- variant: "destructive",- });+ } finally {+ timelineRestartingRef.current = false;}}}/>diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rsindex 8d2a6ed38..4d6c54d8c 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -1305,6 +1305,17 @@ pub fn update_show_screenpipe_shortcut(if let Err(e) = app_handle.global_shortcut().on_shortcut(show_window_shortcut,move |app_handle, _event, _shortcut| {+ // The "show" shortcut only opens the timeline/rewind overlay, so+ // ignore it when the timeline is disabled (checked at press time).+ if crate::store::SettingsStore::get(app_handle)+ .unwrap_or_default()+ .unwrap_or_default()+ .recording+ .disable_timeline+ {+ info!("timeline disabled: ignoring show shortcut");+ return;+ }#[cfg(target_os = "macos")]{use crate::window::MAIN_PANEL_SHOWN;diff --git a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rsindex dac1986fb..bb6a7f70c 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/shortcuts.rs@@ -155,6 +155,20 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),let app_for_closure = app.clone();let _ = app.run_on_main_thread(move || {let app = &app_for_closure;+ // The "show" shortcut only opens the timeline/rewind overlay, so it+ // must be a no-op when the timeline is disabled. Checked at press+ // time (not registration): the Disable-Timeline toggle restarts only+ // the recording engine, so these shortcuts stay registered until the+ // next app restart.+ if crate::store::SettingsStore::get(app)+ .unwrap_or_default()+ .unwrap_or_default()+ .recording+ .disable_timeline+ {+ info!("timeline disabled: ignoring show shortcut");+ return;+ }info!("show shortcut triggered - attempting to show/hide main overlay");let _ = app.emit("shortcut-show", ());{