diff --git a/.gitignore b/.gitignore index f9d427ab..67d327df 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,9 @@ node_modules/ dist/ *_.* *_ + +yarn-error.log + +.idea/ + +.DS_Store diff --git a/app/main/window/hideOnClose.js b/app/main/window/hideOnClose.js index f1ff1b03..99ff22ff 100644 --- a/app/main/window/hideOnClose.js +++ b/app/main/window/hideOnClose.js @@ -1,10 +1,25 @@ const { app } = require("electron"); +const quit = require("../quit"); + + module.exports = function hideOnClose(win) { + let willQuitApp = false; + win.on("close", (event) => { + + // Quit on Cmd + Q on Mac + if (willQuitApp && process.platform === 'darwin') { + quit(); + } + if (!app.__isQuitting) { event.preventDefault(); win.hide(); } }); + + // Detect If the user decide to quit app + app.on('before-quit', () => willQuitApp = true); + };