Skip to content

Commit 323e5df

Browse files
committed
quit when all browser windows are closed
1 parent bf04d62 commit 323e5df

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

main/main.js

-9
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,6 @@ function createWindowWithBounds (bounds) {
313313
return newWin
314314
}
315315

316-
// Quit when all windows are closed.
317-
app.on('window-all-closed', function () {
318-
// On OS X it is common for applications and their menu bar
319-
// to stay active until the user quits explicitly with Cmd + Q
320-
if (process.platform !== 'darwin') {
321-
app.quit()
322-
}
323-
})
324-
325316
// This method will be called when Electron has finished
326317
// initialization and is ready to create browser windows.
327318
app.on('ready', function () {

main/windowManagement.js

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const windows = {
2222

2323
window.on('closed', function() {
2424
windows.removeWindow(window)
25+
26+
// Quit on last window closed (ignoring secondary and hidden windows)
27+
if (windows.openWindows.length === 0 && process.platform !== 'darwin') {
28+
app.quit()
29+
}
2530
})
2631

2732
windows.nextId++

0 commit comments

Comments
 (0)