Merge pull request #187 from Razzeee/improve-menus
Improve menus due to improvements in electron
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
"electron-builder": "5.2.1",
|
"electron-builder": "5.2.1",
|
||||||
"electron-connect": "^0.3.7",
|
"electron-connect": "^0.3.7",
|
||||||
"electron-packager": "^7.0.1",
|
"electron-packager": "^7.0.1",
|
||||||
"electron-prebuilt": "1.2.6",
|
"electron-prebuilt": "1.2.7",
|
||||||
"electron-winstaller": "^2.2.0",
|
"electron-winstaller": "^2.2.0",
|
||||||
"esformatter": "^0.9.3",
|
"esformatter": "^0.9.3",
|
||||||
"esformatter-jsx": "^5.0.0",
|
"esformatter-jsx": "^5.0.0",
|
||||||
|
@@ -7,19 +7,15 @@ const MenuItem = remote.MenuItem;
|
|||||||
var createDefault = function() {
|
var createDefault = function() {
|
||||||
var menu = new Menu();
|
var menu = new Menu();
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Cut',
|
|
||||||
role: 'cut'
|
role: 'cut'
|
||||||
}));
|
}));
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Copy',
|
|
||||||
role: 'copy'
|
role: 'copy'
|
||||||
}));
|
}));
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Paste',
|
|
||||||
role: 'paste'
|
role: 'paste'
|
||||||
}));
|
}));
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Select All',
|
|
||||||
role: 'selectall'
|
role: 'selectall'
|
||||||
}));
|
}));
|
||||||
return menu;
|
return menu;
|
||||||
|
@@ -163,6 +163,10 @@ app.on('activate', function(event) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.on('before-quit', function() {
|
app.on('before-quit', function() {
|
||||||
|
// Make sure tray icon gets removed if the user exits via CTRL-Q
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
trayIcon.destroy();
|
||||||
|
}
|
||||||
willAppQuit = true;
|
willAppQuit = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -28,22 +28,13 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||||
}
|
}
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
label: 'Hide ' + app_name,
|
role: 'hide'
|
||||||
accelerator: 'Command+H',
|
|
||||||
selector: 'hide:'
|
|
||||||
}, {
|
}, {
|
||||||
label: 'Hide Others',
|
role: 'hideothers'
|
||||||
accelerator: 'Command+Shift+H',
|
|
||||||
selector: 'hideOtherApplications:'
|
|
||||||
}, {
|
}, {
|
||||||
label: 'Show All',
|
role: 'unhide'
|
||||||
selector: 'unhideAllApplications:'
|
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
label: 'Quit ' + app_name,
|
role: 'quit'
|
||||||
accelerator: 'CmdOrCtrl+Q',
|
|
||||||
click: function(item, focusedWindow) {
|
|
||||||
electron.app.quit();
|
|
||||||
}
|
|
||||||
}] : [{
|
}] : [{
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
@@ -51,7 +42,7 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||||
}
|
}
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
label: 'Quit',
|
role: 'quit',
|
||||||
accelerator: 'CmdOrCtrl+Q',
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
electron.app.quit();
|
electron.app.quit();
|
||||||
@@ -67,28 +58,16 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
template.push({
|
template.push({
|
||||||
label: '&Edit',
|
label: '&Edit',
|
||||||
submenu: [{
|
submenu: [{
|
||||||
label: 'Undo',
|
|
||||||
accelerator: 'CmdOrCtrl+Z',
|
|
||||||
role: 'undo'
|
role: 'undo'
|
||||||
}, {
|
}, {
|
||||||
label: 'Redo',
|
|
||||||
accelerator: 'Shift+CmdOrCtrl+Z',
|
|
||||||
role: 'redo'
|
role: 'redo'
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
label: 'Cut',
|
|
||||||
accelerator: 'CmdOrCtrl+X',
|
|
||||||
role: 'cut'
|
role: 'cut'
|
||||||
}, {
|
}, {
|
||||||
label: 'Copy',
|
|
||||||
accelerator: 'CmdOrCtrl+C',
|
|
||||||
role: 'copy'
|
role: 'copy'
|
||||||
}, {
|
}, {
|
||||||
label: 'Paste',
|
|
||||||
accelerator: 'CmdOrCtrl+V',
|
|
||||||
role: 'paste'
|
role: 'paste'
|
||||||
}, {
|
}, {
|
||||||
label: 'Select All',
|
|
||||||
accelerator: 'CmdOrCtrl+A',
|
|
||||||
role: 'selectall'
|
role: 'selectall'
|
||||||
}, ]
|
}, ]
|
||||||
});
|
});
|
||||||
@@ -123,20 +102,7 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: 'Toggle Full Screen',
|
role: 'togglefullscreen'
|
||||||
accelerator: (function() {
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
return 'Ctrl+Command+F';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 'F11';
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
click: function(item, focusedWindow) {
|
|
||||||
if (focusedWindow) {
|
|
||||||
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, separatorItem, {
|
}, separatorItem, {
|
||||||
label: 'Actual Size',
|
label: 'Actual Size',
|
||||||
accelerator: 'CmdOrCtrl+0',
|
accelerator: 'CmdOrCtrl+0',
|
||||||
@@ -176,21 +142,9 @@ var createTemplate = function(mainWindow, config) {
|
|||||||
const window_menu = {
|
const window_menu = {
|
||||||
label: '&Window',
|
label: '&Window',
|
||||||
submenu: [{
|
submenu: [{
|
||||||
label: 'Minimize',
|
role: 'minimize'
|
||||||
accelerator: 'CmdOrCtrl+M',
|
|
||||||
click: function(item, focusedWindow) {
|
|
||||||
if (focusedWindow) {
|
|
||||||
focusedWindow.minimize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
label: 'Close',
|
role: 'close'
|
||||||
accelerator: 'CmdOrCtrl+W',
|
|
||||||
click: function(item, focusedWindow) {
|
|
||||||
if (focusedWindow) {
|
|
||||||
focusedWindow.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, separatorItem, ...config.teams.slice(0, 9).map((team, i) => {
|
}, separatorItem, ...config.teams.slice(0, 9).map((team, i) => {
|
||||||
return {
|
return {
|
||||||
label: team.name,
|
label: team.name,
|
||||||
|
@@ -25,10 +25,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
}), {
|
}), {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
}, {
|
}, {
|
||||||
label: 'Quit',
|
role: 'quit'
|
||||||
click: function(item) {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
return template;
|
return template;
|
||||||
|
Reference in New Issue
Block a user