fix(desktop): Linux has no tray icon, closing the window quits the app instead of minimizing to tray
Summary
On Linux, closing the main window quits the app entirely instead of minimizing to a system tray icon, the way macOS does.
Root cause
Two things compound:
-
Tray is hard-excluded on Linux.
isTrayEnabled()infrontend/src/main/tray-lifecycle.tsonly returns true fordarwin(and even then only for unpackaged/dev builds or nightly releases):export function isTrayEnabled(platform: NodeJS.Platform, isPackaged: boolean, appVersion: string): boolean { return platform === "darwin" && (!isPackaged || appVersion.includes("-nightly.")); }Linux never gets a tray icon registered at all, so there's no persistent background presence and no click-to-reopen affordance.
-
window-all-closedquits on Linux. Infrontend/src/main.ts:app.on("window-all-closed", () => { if (process.platform !== "darwin") { app.quit(); } });Closing the window calls
app.quit()on any non-macOS platform. On macOS, this is standard convention (the app stays alive without a window so it can be reopened from the dock/tray). On Linux there is neither the tray icon nor an equivalent way to bring the app back — the window just disappears and the whole app, including the background daemon, shuts down (seeprocess.on("exit")inmain.ts, which kills the daemon unlessAO_KEEP_DAEMONis set).
Expected behavior
On Linux, closing the window should minimize to a tray icon (mirroring macOS's dock-stays-alive behavior), not fully quit the app. This requires:
- Enabling
isTrayEnabled()for Linux (subject to runtime tray-protocol availability — Electron's LinuxTrayAPI depends onlibappindicator/libayatana-appindicatorbeing present and a StatusNotifierWatcher running on the session bus; it can silently no-op without that). - Updating the
window-all-closedhandler so Linux (with tray available) hides to tray instead of callingapp.quit().
Notes
- Filed after investigating a related Linux menu-bar gap (issue #4753) in the same startup/window code.
- If the appindicator library isn't present at runtime, this feature can silently fail to show an icon on Linux — worth surfacing that gracefully rather than failing silent, if this is implemented.
I’d like to work on this. I’ll first cover Linux tray capability and close/quit behavior deterministically, then add the smallest runtime-aware tray lifecycle change with a safe quit fallback when a usable tray cannot be established.
Assigned to @codebanditssss (review #4828)
this is a valid linux desktop bug. the existing tray controller is only enabled for macos, while window-all-closed quits every non-macos build. as a result, closing the linux window terminates the supervisor and daemon instead of leaving a way to reopen ao.
pr #4828 addresses the missing integration by enabling linux tray creation, keeping the app alive only when a tray controller was successfully created, and preserving the quit fallback when the desktop environment has no usable tray. the remaining validation gap is a packaged linux smoke test across supported desktop environments.
Duplicate of #7813, which covers the same Linux problem (closing the window quits AO instead of keeping it running from the tray). Tracking continues there, and the root-cause notes here still apply. Closing.