Merge pull request #2841 from element-hq/midhun/improve-exit-code

Remove unnecessary check from app exit code
This commit is contained in:
R Midhun Suresh 2026-02-06 13:09:06 +05:30 committed by GitHub
commit 2e349187b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -517,19 +517,17 @@ app.on("ready", async () => {
event.preventDefault();
// Check if the user expects us to minimize to tray instead of quitting the app
const shouldMinimize = store.get("minimizeToTray") && (tray.hasTray() || process.platform === "darwin");
// Two cases:
// 1. On Linux/Windows, user has enabled "Show tray icon and minimise window to it on close" in settings.
// 2. On Mac, the canonical behaviour is to minimize to tray; this is not configurable.
const shouldMinimize = store.get("minimizeToTray") || process.platform === "darwin";
if (shouldMinimize) {
// On Mac, closing the window just hides it
// (this is generally how single-window Mac apps
// behave, eg. Mail.app)
if (global.mainWindow?.isFullScreen()) {
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
global.mainWindow.setFullScreen(false);
} else {
global.mainWindow?.hide();
}
return;
}