Skip to content

Commit 5e827d5

Browse files
author
Emmanouil Konstantinidis
committed
Init Menu for app
1 parent 28b973c commit 5e827d5

File tree

2 files changed

+125
-1
lines changed

2 files changed

+125
-1
lines changed

main.js

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,130 @@ app.on('ready', function(){
5454
appIcon.window.hide();
5555
}
5656

57+
var template = [{
58+
label: 'Electron',
59+
submenu: [
60+
{
61+
label: 'About Electron',
62+
selector: 'orderFrontStandardAboutPanel:'
63+
},
64+
{
65+
type: 'separator'
66+
},
67+
{
68+
label: 'Services',
69+
submenu: []
70+
},
71+
{
72+
type: 'separator'
73+
},
74+
{
75+
label: 'Hide Electron',
76+
accelerator: 'Command+H',
77+
selector: 'hide:'
78+
},
79+
{
80+
label: 'Hide Others',
81+
accelerator: 'Command+Shift+H',
82+
selector: 'hideOtherApplications:'
83+
},
84+
{
85+
label: 'Show All',
86+
selector: 'unhideAllApplications:'
87+
},
88+
{
89+
type: 'separator'
90+
},
91+
{
92+
label: 'Quit',
93+
accelerator: 'Command+Q',
94+
click: function() { app.quit(); }
95+
},
96+
]
97+
},
98+
{
99+
label: 'Edit',
100+
submenu: [
101+
{
102+
label: 'Undo',
103+
accelerator: 'Command+Z',
104+
selector: 'undo:'
105+
},
106+
{
107+
label: 'Redo',
108+
accelerator: 'Shift+Command+Z',
109+
selector: 'redo:'
110+
},
111+
{
112+
type: 'separator'
113+
},
114+
{
115+
label: 'Cut',
116+
accelerator: 'Command+X',
117+
selector: 'cut:'
118+
},
119+
{
120+
label: 'Copy',
121+
accelerator: 'Command+C',
122+
selector: 'copy:'
123+
},
124+
{
125+
label: 'Paste',
126+
accelerator: 'Command+V',
127+
selector: 'paste:'
128+
},
129+
{
130+
label: 'Select All',
131+
accelerator: 'Command+A',
132+
selector: 'selectAll:'
133+
},
134+
]
135+
},
136+
{
137+
label: 'View',
138+
submenu: [
139+
{
140+
label: 'Reload',
141+
accelerator: 'Command+R',
142+
click: function() { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); }
143+
},
144+
{
145+
label: 'Toggle DevTools',
146+
accelerator: 'Alt+Command+I',
147+
click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); }
148+
},
149+
]
150+
},
151+
{
152+
label: 'Window',
153+
submenu: [
154+
{
155+
label: 'Minimize',
156+
accelerator: 'Command+M',
157+
selector: 'performMiniaturize:'
158+
},
159+
{
160+
label: 'Close',
161+
accelerator: 'Command+W',
162+
selector: 'performClose:'
163+
},
164+
{
165+
type: 'separator'
166+
},
167+
{
168+
label: 'Bring All to Front',
169+
selector: 'arrangeInFront:'
170+
},
171+
]
172+
},
173+
{
174+
label: 'Help',
175+
submenu: []
176+
}];
177+
178+
menu = Menu.buildFromTemplate(template);
179+
Menu.setApplicationMenu(menu);
180+
57181
ipc.on('reopen-window', function(event) {
58182
appIcon.window.show();
59183
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Github Notifications on your menu bar.",
55
"main": "main.js",
66
"scripts": {
7-
"build-js": "npm run mkdirs && browserify -t reactify src/js/app.js -o build/js/app.js",
7+
"build-js": "npm run mkdir -p build/js && browserify -t reactify src/js/app.js -o build/js/app.js",
88
"build": "npm install && mkdir -p build/js && grunt build && npm run build-js",
99
"watch-js": "watchify -t reactify src/js/app.js -o build/js/app.js -v",
1010
"watch": "grunt build && npm build && npm run watch-js | grunt watch",

0 commit comments

Comments
 (0)