fix(desktop): keep minimize on the taskbar and send only close to the tray (#2874)

With tray background mode on, the in-app minimize button hid the window,
so the taskbar entry disappeared while the native title-bar and taskbar
minimize still performed a normal minimize. Minimize now always minimizes;
the setting gates the close path only.

The persisted key stays `desktopMinimizeToTrayEnabled` so existing settings
keep working; the visible label becomes "Close to the system tray" in every
locale.

Closes #2857
This commit is contained in:
Serhii Dziupin
2026-08-13 15:10:48 +03:00
committed by GitHub
parent 6a200e4622
commit 61533ed881
14 changed files with 44 additions and 39 deletions
+2
View File
@@ -104,6 +104,8 @@ A loopback-only updater fixture is available for contributor QA of N-to-N+1 AppI
The package supports macOS, Windows, and Linux desktop features. Linux AppImage builds include in-app window controls, auto-update, system tray (right-click Show / Hide / Close), and launch-at-login (XDG autostart). Opening files in installed apps, installed-app discovery, and FreeDesktop icon lookup (including the default file manager) work on macOS, Windows, and Linux.
On Windows and Linux, the General setting persisted as `desktopMinimizeToTrayEnabled` keeps the app running in the tray when the main window is **closed**. Minimize — the in-app control, the native title-bar button, and the taskbar — always performs a normal window minimize, so the taskbar entry stays available.
The macOS menu bar item is enabled by default and can be disabled in General settings. The setting applies after restart; while disabled, Desktop does not create the native tray controller or start the renderer subscriptions, polling, quota refresh, or IPC updates that feed it.
## Bundled OpenCode CLI
+8 -6
View File
@@ -306,6 +306,9 @@ const readDesktopMinimizeToTrayStatus = () => {
};
};
// Close-to-tray gate. The persisted key is still `desktopMinimizeToTrayEnabled`
// (settings written by earlier versions), but the behavior it controls is the
// window close path only; minimize stays a normal taskbar/dock minimize.
const shouldHideMainWindowToTray = (browserWindow) => {
if (process.platform !== 'win32' && process.platform !== 'linux') return false;
if (!state.trayController) return false;
@@ -4398,14 +4401,13 @@ const handleInvoke = async (browserWindow, command, args = {}) => {
}
return null;
// Minimize always goes to the taskbar/dock, even with tray background mode
// on: hiding the window here would drop the taskbar entry and make the
// in-app minimize button behave differently from the native one. Only
// closing hands the window to the tray.
case 'desktop_minimize_current_window':
if (browserWindow && !browserWindow.isDestroyed()) {
if (shouldHideMainWindowToTray(browserWindow)) {
debounceWindowStatePersist(browserWindow, true);
browserWindow.hide();
} else {
browserWindow.minimize();
}
browserWindow.minimize();
}
return null;