diff --git a/main.js b/main.js index df69edc..e1b740d 100644 --- a/main.js +++ b/main.js @@ -1,13 +1,21 @@ -const { app, BrowserWindow } = require('electron') - -function createWindow () { - const win = new BrowserWindow({ - titleBarStyle: 'hidden', - titleBarOverlay: true - }) - win.loadURL('http://torw.ct.ws/yesc/') -} - -app.whenReady().then(() => { - createWindow() -}) +const { app, BrowserWindow } = require('electron') + +function createWindow () { + const mainWindow = new BrowserWindow({ + autoHideMenuBar: true + }) + + mainWindow.loadURL('http://torw.ct.ws/yesc') +} + +app.whenReady().then(() => { + createWindow() + + app.on('activate', function () { + if (BrowserWindow.getAllWindows().length === 0) createWindow() + }) +}) + +app.on('window-all-closed', function () { + if (process.platform !== 'darwin') app.quit() +})