Skip to content

Commit 430687f

Browse files
committed
Hide the app (no quit) on close if tray enabled
1 parent 45f4b3b commit 430687f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
autoUpdate,
1111
getEnabledPlugins,
1212
isAppVisible,
13+
isTrayEnabled,
1314
store,
1415
} = require("./store");
1516
const { fileExists, injectCSS } = require("./plugins/utils");
@@ -187,12 +188,16 @@ app.on("ready", () => {
187188
if (!isAppVisible()) {
188189
app.dock.hide();
189190
}
191+
}
190192

191-
var forceQuit = false;
192-
app.on("before-quit", () => {
193-
forceQuit = true;
194-
});
193+
var forceQuit = false;
194+
app.on("before-quit", () => {
195+
forceQuit = true;
196+
});
197+
198+
if (is.macOS() || isTrayEnabled()) {
195199
mainWindow.on("close", (event) => {
200+
// Hide the window instead of quitting (quit is available in tray options)
196201
if (!forceQuit) {
197202
event.preventDefault();
198203
mainWindow.hide();

0 commit comments

Comments
 (0)