2023-08-28 11:23:10 +00:00
|
|
|
const { app, BrowserWindow, Menu } = require('electron/main')
|
2020-11-30 07:48:39 +00:00
|
|
|
|
|
|
|
function createWindow () {
|
|
|
|
const win = new BrowserWindow({
|
|
|
|
width: 800,
|
2023-04-05 13:42:20 +00:00
|
|
|
height: 600
|
2020-11-30 07:48:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
win.loadFile('index.html')
|
|
|
|
}
|
|
|
|
|
|
|
|
const dockMenu = Menu.buildFromTemplate([
|
|
|
|
{
|
|
|
|
label: 'New Window',
|
|
|
|
click () { console.log('New Window') }
|
|
|
|
}, {
|
|
|
|
label: 'New Window with Settings',
|
|
|
|
submenu: [
|
|
|
|
{ label: 'Basic' },
|
|
|
|
{ label: 'Pro' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{ label: 'New Command...' }
|
|
|
|
])
|
|
|
|
|
|
|
|
app.whenReady().then(() => {
|
2021-05-19 01:03:13 +00:00
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
app.dock.setMenu(dockMenu)
|
|
|
|
}
|
2020-11-30 07:48:39 +00:00
|
|
|
}).then(createWindow)
|
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
if (process.platform !== 'darwin') {
|
|
|
|
app.quit()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
|
|
|
if (BrowserWindow.getAllWindows().length === 0) {
|
|
|
|
createWindow()
|
|
|
|
}
|
|
|
|
})
|