-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
54 lines (45 loc) · 1.01 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// electron main
'use strict';
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const Menu = electron.Menu;
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow();
mainWindow.loadURL('http://localhost:8000/');
const name = app.getName();
const template = [
{
label: name,
submenu: [{
label: `About ${name}`,
role: 'about'
}, {
type: 'separator'
}, {
label: `Hide ${name}`,
role: 'hide',
accelerator: 'Cmd+H'
}, {
label: 'Hide Others',
role: 'hideothers',
accelerator: 'Alt+Cmd+H'
}, {
label: 'Show All',
role: 'unhide'
}, {
type: 'separator'
}, {
label: 'Quit',
click: app.quit,
accelerator: 'Cmd+Q'
}]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
mainWindow.on('closed', () => {
mainWindow = null;
});
});