Skip to content

Commit

Permalink
fixup!
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Nov 15, 2024
1 parent a634ff8 commit ac61aa5
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,32 @@ app.whenReady().then(async () => {

ipcMain.on('app:downloadURL', (event, url, filename) => triggerDownloadUrl(mainWindow, url, filename))

// Click on the dock icon on macOS
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
// On macOS it's common to re-create a window in the app when the
if (mainWindow && !mainWindow.isDestroyed()) {
// Show the main window if it exists, but hidden, for example, to the system tray
mainWindow.show()
} else {
// On macOS, it is common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open
mainWindow = createMainWindow()
mainWindow.once('ready-to-show', () => mainWindow.show())
} else if (mainWindow && !mainWindow.isDestroyed()) {
// Show the main window if it is hidden in the system tray
mainWindow.show()
}
})
})

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin' && !isInWindowRelaunch) {
app.on('window-all-closed', () => {
// Recreating a window
if (!isInWindowRelaunch) {
return
}
// On macOS, it is common for applications and their menu bar to stay active even without windows
// until the user quits explicitly with Cmd + Q or Quit from the menu.
// However, it makes sense only for the Talk window and not for Authentication or Welcome windows.
if (isMac() && createMainWindow === createTalkWindow) {
return
}
// All the windows are closed - quit the app
app.quit()
}
})

})

0 comments on commit ac61aa5

Please sign in to comment.