Skip to content

Commit

Permalink
quit when all browser windows are closed
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmerAL committed Jun 13, 2023
1 parent bf04d62 commit 323e5df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
9 changes: 0 additions & 9 deletions main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
5 changes: 5 additions & 0 deletions main/windowManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down

0 comments on commit 323e5df

Please sign in to comment.