-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmenu.js
More file actions
121 lines (116 loc) · 2.96 KB
/
menu.js
File metadata and controls
121 lines (116 loc) · 2.96 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
"use strict";
window.nodeRequire = require;
const electron = nodeRequire('electron');
const remote = electron.remote;
const Menu = remote.Menu;
var template = [
{
label: '编辑',
submenu: [
{
label: '撤销',
accelerator: 'CmdOrCtrl+Z',
role: 'undo'
},
{
label: '重做',
accelerator: 'Shift+CmdOrCtrl+Z',
role: 'redo'
},
{
type: 'separator'
},
{
label: '剪切',
accelerator: 'CmdOrCtrl+X',
role: 'cut'
},
{
label: '复制',
accelerator: 'CmdOrCtrl+C',
role: 'copy'
},
{
label: '粘贴',
accelerator: 'CmdOrCtrl+V',
role: 'paste'
},
{
label: '全选',
accelerator: 'CmdOrCtrl+A',
role: 'selectall'
}
]
},
{
label: '窗口',
role: 'window',
submenu: [
{
label: '最小化',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: '关闭窗口',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
{
label: '调试模式',
accelerator: 'Option+CmdOrCtrl+I',
click: function () {
remote.getCurrentWindow().webContents.toggleDevTools();
}
}
]
},
{
label: '帮助',
role: 'help',
submenu: [
{
label: '建议 或 反馈…',
click: function () {
electron.shell.openExternal('https://github.com/P-ppc/cnodejs/issues');
}
}
]
}
];
if (process.platform === 'darwin') {
var name = remote.app.getName();
template.unshift({
label: name,
submenu: [
{
label: '隐藏 ' + name,
accelerator: 'Command+H',
role: 'hide'
},
{
label: '隐藏其他应用',
accelerator: 'Command+Alt+H',
role: 'hideothers'
},
{
label: '显示全部',
role: 'unhide'
},
{
type: 'separator'
},
{
label: '退出',
accelerator: 'Command+Q',
click: function () {
remote.app.quit();
}
}
]
});
} else if(process.platform === 'win32'){
let helpItem = template[template.length-1];
}
var menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);