Merge pull request #154 from Razzeee/menu-work
Added seperator in view menu, added new help menu and moved version i…
This commit is contained in:
@@ -9,6 +9,25 @@ var createTemplate = function(mainWindow) {
|
|||||||
var template = [];
|
var template = [];
|
||||||
|
|
||||||
const platformAppMenu = process.platform === 'darwin' ? [{
|
const platformAppMenu = process.platform === 'darwin' ? [{
|
||||||
|
label: 'About ' + app_name,
|
||||||
|
role: 'about',
|
||||||
|
click: function(item, focusedWindow) {
|
||||||
|
electron.dialog.showMessageBox(mainWindow, {
|
||||||
|
buttons: ["OK"],
|
||||||
|
message: `${app_name} Desktop ${electron.app.getVersion()}`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: 'separator'
|
||||||
|
}, {
|
||||||
|
label: 'Preferences...',
|
||||||
|
accelerator: 'CmdOrCtrl+,',
|
||||||
|
click: function(item, focusedWindow) {
|
||||||
|
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: 'separator'
|
||||||
|
}, {
|
||||||
label: 'Hide ' + app_name,
|
label: 'Hide ' + app_name,
|
||||||
accelerator: 'Command+H',
|
accelerator: 'Command+H',
|
||||||
selector: 'hide:'
|
selector: 'hide:'
|
||||||
@@ -21,36 +40,33 @@ var createTemplate = function(mainWindow) {
|
|||||||
selector: 'unhideAllApplications:'
|
selector: 'unhideAllApplications:'
|
||||||
}, {
|
}, {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
}] : [];
|
}, {
|
||||||
|
label: 'Quit ' + app_name,
|
||||||
template.push({
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
label: '&' + first_menu_name,
|
|
||||||
submenu: [{
|
|
||||||
label: 'About ' + app_name,
|
|
||||||
role: 'about',
|
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
electron.dialog.showMessageBox(mainWindow, {
|
electron.app.quit();
|
||||||
buttons: ["OK"],
|
|
||||||
message: `${app_name} Desktop ${electron.app.getVersion()}`
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, {
|
}] : [{
|
||||||
type: 'separator'
|
label: 'Settings',
|
||||||
}, {
|
|
||||||
label: (process.platform === 'darwin') ? 'Preferences...' : 'Settings',
|
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
}, ...platformAppMenu, {
|
}, {
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
accelerator: 'CmdOrCtrl+Q',
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
electron.app.quit();
|
electron.app.quit();
|
||||||
}
|
}
|
||||||
}]
|
}];
|
||||||
|
|
||||||
|
template.push({
|
||||||
|
label: '&' + first_menu_name,
|
||||||
|
submenu: [
|
||||||
|
...platformAppMenu
|
||||||
|
]
|
||||||
});
|
});
|
||||||
template.push({
|
template.push({
|
||||||
label: '&Edit',
|
label: '&Edit',
|
||||||
@@ -118,6 +134,8 @@ var createTemplate = function(mainWindow) {
|
|||||||
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
|
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
type: 'separator'
|
||||||
}, {
|
}, {
|
||||||
label: 'Toggle Developer Tools',
|
label: 'Toggle Developer Tools',
|
||||||
accelerator: (function() {
|
accelerator: (function() {
|
||||||
@@ -135,6 +153,13 @@ var createTemplate = function(mainWindow) {
|
|||||||
}
|
}
|
||||||
}, ]
|
}, ]
|
||||||
});
|
});
|
||||||
|
template.push({
|
||||||
|
label: '&Help',
|
||||||
|
submenu: [{
|
||||||
|
label: `Version ${electron.app.getVersion()}`,
|
||||||
|
enabled: false
|
||||||
|
}, ]
|
||||||
|
});
|
||||||
return template;
|
return template;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user