-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Quit process behaviour on Mac (#119)
* Ignore apple & IntelliJ files * supress unused call to css/index.css * Fix quit behaviour on MacOs * Revert "supress unused call to css/index.css" This reverts commit 679ff0a.
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,9 @@ node_modules/ | |
dist/ | ||
*_.* | ||
*_ | ||
|
||
yarn-error.log | ||
|
||
.idea/ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
||
}; |