diff --git a/main/main.js b/main/main.js index 2dde77be6..120d6b402 100644 --- a/main/main.js +++ b/main/main.js @@ -313,15 +313,6 @@ function createWindowWithBounds (bounds) { return newWin } -// Quit when all windows are closed. -app.on('window-all-closed', function () { - // On OS X it is common for applications and their menu bar - // to stay active until the user quits explicitly with Cmd + Q - if (process.platform !== 'darwin') { - app.quit() - } -}) - // This method will be called when Electron has finished // initialization and is ready to create browser windows. app.on('ready', function () { diff --git a/main/windowManagement.js b/main/windowManagement.js index 2fdf582a8..5e03c673e 100644 --- a/main/windowManagement.js +++ b/main/windowManagement.js @@ -22,6 +22,11 @@ const windows = { window.on('closed', function() { windows.removeWindow(window) + + // Quit on last window closed (ignoring secondary and hidden windows) + if (windows.openWindows.length === 0 && process.platform !== 'darwin') { + app.quit() + } }) windows.nextId++