Files: 2b05be8ee023fdd9580d6a845ba074a425756685 / menu.js
1347 bytesRaw
1 | const electron = require('electron') |
2 | const defaultMenu = require('electron-default-menu') |
3 | |
4 | module.exports = function StartMenus ({ windows }) { |
5 | const menu = defaultMenu(electron.app, electron.shell) |
6 | const view = menu.find(x => x.label === 'View') |
7 | view.submenu = [ |
8 | { role: 'reload' }, |
9 | { role: 'toggledevtools' }, |
10 | { type: 'separator' }, |
11 | { role: 'resetzoom' }, |
12 | { role: 'zoomin' }, |
13 | { role: 'zoomout' }, |
14 | { type: 'separator' }, |
15 | { role: 'togglefullscreen' } |
16 | ] |
17 | const win = menu.find(x => x.label === 'Window') |
18 | win.submenu = [ |
19 | { role: 'minimize' }, |
20 | { role: 'zoom' }, |
21 | { role: 'close', label: 'Close Window', accelerator: 'CmdOrCtrl+Shift+W' }, |
22 | { role: 'quit' }, |
23 | { type: 'separator' }, |
24 | { |
25 | label: 'Close Tab', |
26 | accelerator: 'CmdOrCtrl+W', |
27 | click () { |
28 | windows.ui.webContents.send('closeTab') |
29 | } |
30 | }, |
31 | { |
32 | label: 'Select Next Tab', |
33 | accelerator: 'CmdOrCtrl+Shift+]', |
34 | click () { |
35 | windows.ui.webContents.send('nextTab') |
36 | } |
37 | }, |
38 | { |
39 | label: 'Select Previous Tab', |
40 | accelerator: 'CmdOrCtrl+Shift+[', |
41 | click () { |
42 | windows.ui.webContents.send('previousTab') |
43 | } |
44 | }, |
45 | { type: 'separator' }, |
46 | { role: 'front' } |
47 | ] |
48 | |
49 | const { Menu } = electron |
50 | Menu.setApplicationMenu(Menu.buildFromTemplate(menu)) |
51 | } |
52 |
Built with git-ssb-web