diff --git a/js/src/main.ts b/js/src/main.ts index 51256a5..0ee644b 100644 --- a/js/src/main.ts +++ b/js/src/main.ts @@ -51,6 +51,7 @@ const createWindow = () => { mainWindow.on('closed', () => { mainWindow = null; + app.quit(); }); }; @@ -419,20 +420,16 @@ app.on('ready', () => { createAutoplayWindow(); }); -// 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') { - app.quit(); - } + app.quit(); }); app.on('activate', () => { - // 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. - if (BrowserWindow.getAllWindows().length === 0) { + if (!mainWindow) { createWindow(); + } else { + mainWindow.show(); + mainWindow.focus(); } });