Closing the window hides the window on mac
Clicking the dock icon restores it again. // FREEBIE
This commit is contained in:
parent
7ef901d628
commit
44adc04395
1 changed files with 13 additions and 1 deletions
14
main.js
14
main.js
|
@ -113,6 +113,13 @@ function createWindow () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Emitted when the window is about to be closed.
|
||||||
|
mainWindow.on('close', function (e) {
|
||||||
|
if (!shouldQuit) {
|
||||||
|
e.preventDefault();
|
||||||
|
mainWindow.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
// Emitted when the window is closed.
|
// Emitted when the window is closed.
|
||||||
mainWindow.on('closed', function () {
|
mainWindow.on('closed', function () {
|
||||||
// Dereference the window object, usually you would store windows
|
// Dereference the window object, usually you would store windows
|
||||||
|
@ -142,6 +149,9 @@ app.on('ready', function() {
|
||||||
createWindow();
|
createWindow();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.on('before-quit', function() {
|
||||||
|
shouldQuit = true;
|
||||||
|
});
|
||||||
// Quit when all windows are closed.
|
// Quit when all windows are closed.
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
// On OS X it is common for applications and their menu bar
|
// On OS X it is common for applications and their menu bar
|
||||||
|
@ -155,7 +165,9 @@ app.on('activate', function () {
|
||||||
// On OS X it's common to re-create a window in the app when the
|
// On OS X it's common to re-create a window in the app when the
|
||||||
// dock icon is clicked and there are no other windows open.
|
// dock icon is clicked and there are no other windows open.
|
||||||
if (mainWindow === null) {
|
if (mainWindow === null) {
|
||||||
createWindow()
|
createWindow();
|
||||||
|
} else {
|
||||||
|
mainWindow.show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue