Skip to content

Commit 2e34918

Browse files
Merge pull request #2841 from element-hq/midhun/improve-exit-code
Remove unnecessary check from app exit code
2 parents 657e9d2 + 8a30ac1 commit 2e34918

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/electron-main.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,19 +517,17 @@ app.on("ready", async () => {
517517
event.preventDefault();
518518

519519
// Check if the user expects us to minimize to tray instead of quitting the app
520-
const shouldMinimize = store.get("minimizeToTray") && (tray.hasTray() || process.platform === "darwin");
520+
// Two cases:
521+
// 1. On Linux/Windows, user has enabled "Show tray icon and minimise window to it on close" in settings.
522+
// 2. On Mac, the canonical behaviour is to minimize to tray; this is not configurable.
523+
const shouldMinimize = store.get("minimizeToTray") || process.platform === "darwin";
521524
if (shouldMinimize) {
522-
// On Mac, closing the window just hides it
523-
// (this is generally how single-window Mac apps
524-
// behave, eg. Mail.app)
525-
526525
if (global.mainWindow?.isFullScreen()) {
527526
global.mainWindow.once("leave-full-screen", () => global.mainWindow?.hide());
528527
global.mainWindow.setFullScreen(false);
529528
} else {
530529
global.mainWindow?.hide();
531530
}
532-
533531
return;
534532
}
535533

0 commit comments

Comments
 (0)