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(dock): watchdog to prevent stuck Accessory mode hiding dock icon

Louis Beaumontd9c8064f41f3
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index e3ad47a16..67b170ddc 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1382,6 +1382,37 @@ async fn main() {
#[cfg(target_os = "macos")]
crate::window_api::reset_to_regular_and_refresh_tray(&app_handle);
+ // Watchdog: periodically ensure dock/tray are visible when no overlay is shown.
+ // Protects against getting stuck in Accessory mode (hides dock+tray) due to
+ // panels not properly firing focus-lost events, crashes, etc.
+ #[cfg(target_os = "macos")]
+ {
+ let app_handle_watchdog = app_handle.clone();
+ tauri::async_runtime::spawn(async move {
+ use tauri_nspanel::ManagerExt;
+ let mut interval = tokio::time::interval(tokio::time::Duration::from_secs(5));
+ loop {
+ interval.tick().await;
+ // Check if any panel/overlay is currently visible
+ let main_visible = app_handle_watchdog
+ .get_webview_panel("main")
+ .map(|p| p.is_visible())
+ .unwrap_or(false);
+ let chat_visible = app_handle_watchdog
+ .get_webview_panel("chat")
+ .map(|p| p.is_visible())
+ .unwrap_or(false);
+
+ if !main_visible && !chat_visible {
+ // No panels visible — ensure we're in Regular mode
+ // (This is a no-op if already Regular)
+ let _ = app_handle_watchdog
+ .set_activation_policy(tauri::ActivationPolicy::Regular);
+ }
+ }
+ });
+ }
+
// Initialize global shortcuts
let app_handle_clone = app_handle.clone();
tauri::async_runtime::spawn(async move {