Skip to content

Commit 12aa4a0

Browse files
committed
Add menus for windows
1 parent df57ef8 commit 12aa4a0

File tree

2 files changed

+143
-0
lines changed

2 files changed

+143
-0
lines changed

keymaps/win32.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
".platform-darwin": {
3+
"escape": "core:cancel",
4+
"delete": "core:delete",
5+
"backspace": "core:delete",
6+
7+
"up": "editor:move-selection-up",
8+
"down": "editor:move-selection-down",
9+
"left": "editor:move-selection-left",
10+
"right": "editor:move-selection-right",
11+
"shift-up": "editor:move-selection-up-by-ten",
12+
"shift-down": "editor:move-selection-down-by-ten",
13+
"shift-left": "editor:move-selection-left-by-ten",
14+
"shift-right": "editor:move-selection-right-by-ten",
15+
16+
"p": "editor:pen-tool",
17+
"o": "editor:ellipse-tool",
18+
"v": "editor:pointer-tool",
19+
"r": "editor:rectangle-tool"
20+
}
21+
}

src/browser/menu-win32.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
module.exports = function(app, window) {
2+
return [
3+
{
4+
label: 'App',
5+
submenu: [
6+
{
7+
label: 'About',
8+
selector: 'orderFrontStandardAboutPanel:'
9+
},
10+
{
11+
type: 'separator'
12+
},
13+
{
14+
label: 'Hide',
15+
accelerator: 'Control+H',
16+
selector: 'hide:'
17+
},
18+
{
19+
label: 'Hide Others',
20+
accelerator: 'Control+Shift+H',
21+
selector: 'hideOtherApplications:'
22+
},
23+
{
24+
label: 'Show All',
25+
selector: 'unhideAllApplications:'
26+
},
27+
{
28+
type: 'separator'
29+
},
30+
{
31+
label: 'Quit',
32+
accelerator: 'Control+Q',
33+
click: () => app.quit()
34+
}
35+
]
36+
},
37+
{
38+
label: 'File',
39+
submenu: [
40+
{
41+
label: 'New File',
42+
accelerator: 'Control+n',
43+
click: () => global.application.openNewWindow()
44+
},
45+
{
46+
label: 'Open…',
47+
accelerator: 'Control+o',
48+
click: () => global.application.openFileDialog()
49+
},
50+
{
51+
label: 'Save',
52+
accelerator: 'Control+s',
53+
click: () => global.application.saveActiveFile()
54+
},
55+
{
56+
label: 'Save As…',
57+
accelerator: 'Control+Shift+s',
58+
click: () => global.application.saveActiveFileAs()
59+
},
60+
{
61+
type: 'separator'
62+
},
63+
{
64+
label: 'Close Window',
65+
accelerator: 'Control+W',
66+
click: () => window.close()
67+
}
68+
]
69+
},
70+
{
71+
label: 'View',
72+
submenu: [
73+
{
74+
label: 'Reload',
75+
accelerator: 'Control+R',
76+
click: () => window.restart()
77+
},
78+
{
79+
label: 'Toggle Full Screen',
80+
accelerator: 'Control+Shift+F',
81+
click: () => window.setFullScreen(!window.isFullScreen())
82+
},
83+
{
84+
label: 'Toggle Developer Tools',
85+
accelerator: 'Alt+Control+I',
86+
click: () => window.toggleDevTools()
87+
}
88+
]
89+
},
90+
{
91+
label: 'Window',
92+
submenu: [
93+
{
94+
label: 'Minimize',
95+
accelerator: 'Control+M',
96+
selector: 'performMiniaturize:'
97+
},
98+
{
99+
label: 'Close',
100+
accelerator: 'Control+W',
101+
selector: 'performClose:'
102+
},
103+
{
104+
type: 'separator'
105+
},
106+
{
107+
label: 'Bring All to Front',
108+
selector: 'arrangeInFront:'
109+
}
110+
]
111+
},
112+
{
113+
label: 'Help',
114+
submenu: [
115+
{
116+
label: 'Repository',
117+
click: () => require('shell').openExternal('http://github.com/benogle/electron-sample')
118+
}
119+
]
120+
}
121+
];
122+
};

0 commit comments

Comments
 (0)