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(macos): add "hide dock icon" toggle — run menu-bar only (#4390)

Louis Beaumont519b9d865773
diff --git a/apps/screenpipe-app-tauri/components/settings/display-section.tsx b/apps/screenpipe-app-tauri/components/settings/display-section.tsx
index f598fd056..a765f283a 100644
--- a/apps/screenpipe-app-tauri/components/settings/display-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/display-section.tsx
@@ -376,6 +376,52 @@ export function DisplaySection() {
</Card>
)}
+ {/*
+ * macOS-only: hide the Dock icon (menu-bar-only "agent" app). The Rust
+ * reset_to_regular_and_refresh_tray in src-tauri/src/window/panel.rs
+ * reads `hideDockIcon` from the settings store, so we persist the value
+ * and then call reset_main_window to re-apply the activation policy
+ * immediately (it reads the freshly-saved value). The tray icon stays
+ * visible either way, so the app is always reachable. Default OFF.
+ */}
+ {isMac && (
+ <Card className="border-border bg-card">
+ <CardContent className="px-3 py-2.5">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center space-x-2.5">
+ <EyeOff className="h-4 w-4 text-muted-foreground shrink-0" />
+ <div>
+ <h3 className="text-sm font-medium text-foreground flex items-center gap-1.5">
+ Hide Dock Icon
+ <HelpTooltip text="Run screenpipe as a menu-bar-only app with no icon in the Dock. The menu-bar (tray) icon stays — click it to open screenpipe. Useful if you only need the app occasionally and don't want it in the Dock." />
+ </h3>
+ <p className="text-xs text-muted-foreground">
+ Menu bar only — keep screenpipe out of the Dock
+ </p>
+ </div>
+ </div>
+ <Switch
+ checked={settings?.hideDockIcon ?? false}
+ onCheckedChange={async (checked) => {
+ await updateSettings({ hideDockIcon: checked });
+ // Re-apply the activation policy now (reset_main_window
+ // reads the freshly-saved hideDockIcon from the store).
+ commands.resetMainWindow().catch(() => {});
+ toast({
+ title: checked
+ ? "dock icon hidden — menu bar only"
+ : "dock icon visible",
+ description: checked
+ ? "open screenpipe from the menu bar icon."
+ : undefined,
+ });
+ }}
+ />
+ </div>
+ </CardContent>
+ </Card>
+ )}
+
{/*
* Windows-only: hide-to-tray toggle. The Rust close handler in
* src-tauri/src/main.rs reads `minimizeToTrayOnClose` directly from the
diff --git a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
index fa9b95919..f9814f60a 100644
--- a/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
+++ b/apps/screenpipe-app-tauri/lib/hooks/use-settings.tsx
@@ -388,6 +388,11 @@ export type Settings = SettingsStore & {
* tray (and removes it from the taskbar) instead of minimizing. The Rust
* close handler in src-tauri/src/main.rs reads this directly. Default off. */
minimizeToTrayOnClose?: boolean;
+ /** macOS-only: when true, run as a menu-bar-only "agent" app with no Dock
+ * icon (NSApplication Accessory activation policy). The tray icon stays
+ * visible. Read by reset_to_regular_and_refresh_tray in
+ * src-tauri/src/window/panel.rs at startup and on window events. Default off. */
+ hideDockIcon?: boolean;
}
export function getEffectiveFilters(settings: Settings) {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/panel.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/panel.rs
index e1ceb9819..352c6448a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window/panel.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/panel.rs
@@ -78,7 +78,17 @@ pub fn main_label_for_mode(mode: &str) -> &'static str {
}
}
-/// Reset activation policy to Regular so dock icon and tray are visible.
+/// Apply the desired macOS activation policy (and keep the tray reachable).
+///
+/// Default is `Regular` — dock icon and tray both visible. Two cases switch to
+/// `Accessory` (menu-bar-only "agent" app, no dock icon):
+/// 1. enterprise hidden-UI policy, or
+/// 2. the user opted into `hideDockIcon` in Settings → Display.
+///
+/// The tray icon is unaffected in every case, so the app stays reachable. This
+/// is a single explicit call (on startup, window close, and when the user
+/// toggles the setting) — NOT the per-tick watchdog toggling that was removed
+/// for causing crashes; setting the policy once on a real event is safe.
#[cfg(target_os = "macos")]
pub fn reset_to_regular_and_refresh_tray(app: &AppHandle) {
if crate::enterprise_policy::is_app_ui_hidden() {
@@ -87,6 +97,20 @@ pub fn reset_to_regular_and_refresh_tray(app: &AppHandle) {
return;
}
+ // `hideDockIcon` is a frontend-only setting, so it lands in the store's
+ // untyped `extra` map rather than a typed field.
+ let hide_dock_icon = crate::store::SettingsStore::get(app)
+ .ok()
+ .flatten()
+ .and_then(|s| s.extra.get("hideDockIcon").and_then(|v| v.as_bool()))
+ .unwrap_or(false);
+
+ if hide_dock_icon {
+ info!("Setting activation policy to Accessory (hideDockIcon — menu bar only)");
+ let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory);
+ return;
+ }
+
info!("Resetting activation policy to Regular (dock+tray visible)");
let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular);
}