agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

fix(desktop): Linux has no tray icon, closing the window quits the app instead of minimizing to tray

Open Hendrixx-RE opened this issue 3 months ago • 4 comments

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:

  1. Tray is hard-excluded on Linux. isTrayEnabled() in frontend/src/main/tray-lifecycle.ts only returns true for darwin (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.

  2. window-all-closed quits on Linux. In frontend/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 (see process.on("exit") in main.ts, which kills the daemon unless AO_KEEP_DAEMON is 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 Linux Tray API depends on libappindicator/libayatana-appindicator being present and a StatusNotifierWatcher running on the session bus; it can silently no-op without that).
  • Updating the window-all-closed handler so Linux (with tray available) hides to tray instead of calling app.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.

Hendrixx-RE avatar Sep 02 '26 17:09 Hendrixx-RE

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.

OllieinCanada avatar Sep 02 '26 23:09 OllieinCanada

Assigned to @codebanditssss (review #4828)

Rishet11 avatar Sep 14 '26 22:09 Rishet11

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.

codebanditssss avatar Sep 15 '26 15:09 codebanditssss

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.

nikhilachale avatar Nov 23 '26 08:11 nikhilachale