Hide the app (no quit) on close if tray enabled

This commit is contained in:
TC
2020-04-26 16:10:13 +02:00
parent 45f4b3bc28
commit 430687f4d6

View File

@ -10,6 +10,7 @@ const {
autoUpdate,
getEnabledPlugins,
isAppVisible,
isTrayEnabled,
store,
} = require("./store");
const { fileExists, injectCSS } = require("./plugins/utils");
@ -187,12 +188,16 @@ app.on("ready", () => {
if (!isAppVisible()) {
app.dock.hide();
}
}
var forceQuit = false;
app.on("before-quit", () => {
forceQuit = true;
});
var forceQuit = false;
app.on("before-quit", () => {
forceQuit = true;
});
if (is.macOS() || isTrayEnabled()) {
mainWindow.on("close", (event) => {
// Hide the window instead of quitting (quit is available in tray options)
if (!forceQuit) {
event.preventDefault();
mainWindow.hide();