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(tray): recreate only once at startup, not on every policy reset

Louis Beaumont23b5fc3b802e
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 67b170ddc..28581a78f 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1324,6 +1324,18 @@ async fn main() {
}
}
+ // On notched MacBooks, the tray icon created at startup gets the leftmost
+ // position (behind the notch). Recreate it once after a delay so it gets
+ // the rightmost (most visible) position among third-party status items.
+ #[cfg(target_os = "macos")]
+ {
+ let app_tray = app_handle.clone();
+ tauri::async_runtime::spawn(async move {
+ tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
+ tray::recreate_tray(&app_tray);
+ });
+ }
+
// Check analytics settings from store
let is_analytics_enabled = store
.analytics_enabled;
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index 52951c236..998453625 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -12,14 +12,10 @@ use tauri_nspanel::WebviewWindowExt;
use crate::{store::OnboardingStore, ServerState};
-/// Reset activation policy to Regular and recreate the tray icon.
-/// On MacBook Pro models with a notch, toggling between Accessory and Regular
-/// can push the tray icon behind the notch. Destroying and recreating the
-/// NSStatusItem gives it the rightmost (most visible) position.
+/// Reset activation policy to Regular so dock icon and tray are visible.
#[cfg(target_os = "macos")]
pub fn reset_to_regular_and_refresh_tray(app: &AppHandle) {
let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular);
- crate::tray::recreate_tray(app);
}
#[derive(Deserialize, Debug)]