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
+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;