Show a simple menu in default_app on Windows.
This commit is contained in:
parent
5c8566e0d4
commit
6748573dee
1 changed files with 156 additions and 121 deletions
|
@ -31,7 +31,6 @@ app.on('finish-launching', function() {
|
|||
});
|
||||
|
||||
mainWindow.on('closed', function() {
|
||||
console.log('closed');
|
||||
mainWindow = null;
|
||||
});
|
||||
|
||||
|
@ -39,6 +38,7 @@ app.on('finish-launching', function() {
|
|||
console.log('unresponsive');
|
||||
});
|
||||
|
||||
if (process.platform == 'darwin') {
|
||||
var template = [
|
||||
{
|
||||
label: 'Atom Shell',
|
||||
|
@ -156,14 +156,49 @@ app.on('finish-launching', function() {
|
|||
];
|
||||
|
||||
menu = Menu.buildFromTemplate(template);
|
||||
|
||||
if (process.platform == 'darwin')
|
||||
Menu.setApplicationMenu(menu);
|
||||
else
|
||||
} else {
|
||||
var template = [
|
||||
{
|
||||
label: 'File',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Open',
|
||||
accelerator: 'Command+O',
|
||||
},
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'Command+W',
|
||||
click: function() { mainWindow.close(); }
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'Command+R',
|
||||
click: function() { mainWindow.restart(); }
|
||||
},
|
||||
{
|
||||
label: 'Enter Fullscreen',
|
||||
click: function() { mainWindow.setFullscreen(true); }
|
||||
},
|
||||
{
|
||||
label: 'Toggle DevTools',
|
||||
accelerator: 'Alt+Command+I',
|
||||
click: function() { mainWindow.toggleDevTools(); }
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
menu = Menu.buildFromTemplate(template);
|
||||
mainWindow.setMenu(menu);
|
||||
}
|
||||
|
||||
ipc.on('message', function(processId, routingId, type) {
|
||||
console.log(type);
|
||||
if (type == 'menu')
|
||||
menu.popup(mainWindow);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue