-
Notifications
You must be signed in to change notification settings - Fork 78
/
menu.js
51 lines (49 loc) · 1.32 KB
/
menu.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
const electron = require('electron')
const defaultMenu = require('electron-default-menu')
module.exports = function StartMenus ({ windows }) {
const menu = defaultMenu(electron.app, electron.shell)
const view = menu.find(x => x.label === 'View')
view.submenu = [
{ role: 'reload' },
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
const win = menu.find(x => x.label === 'Window')
win.submenu = [
{ role: 'minimize' },
{ role: 'zoom' },
{ role: 'close', label: 'Close Window', accelerator: 'CmdOrCtrl+Shift+W' },
{ role: 'quit' },
{ type: 'separator' },
{
label: 'Close Tab',
accelerator: 'CmdOrCtrl+W',
click () {
windows.ui.webContents.send('closeTab')
}
},
{
label: 'Select Next Tab',
accelerator: 'CmdOrCtrl+Shift+]',
click () {
windows.ui.webContents.send('nextTab')
}
},
{
label: 'Select Previous Tab',
accelerator: 'CmdOrCtrl+Shift+[',
click () {
windows.ui.webContents.send('previousTab')
}
},
{ type: 'separator' },
{ role: 'front' }
]
const { Menu } = electron
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
}