Incorporate review feedback

This commit is contained in:
Kevin Sawicki 2016-06-22 15:26:17 -07:00
parent be642612c0
commit 6165908ba7

View file

@ -3,27 +3,26 @@ const {app} = require('electron')
const roles = {
about: {
get label () {
return `About ${app.getName()}`
return process.platform === 'linux' ? 'About' : `About ${app.getName()}`
}
},
close: {
label: 'Close',
accelerator: 'CmdOrCtrl+W',
accelerator: 'CommandOrControl+W',
windowMethod: 'close'
},
copy: {
label: 'Copy',
accelerator: 'CmdOrCtrl+C',
accelerator: 'CommandOrControl+C',
webContentsMethod: 'copy'
},
cut: {
label: 'Cut',
accelerator: 'CmdOrCtrl+X',
accelerator: 'CommandOrControl+X',
webContentsMethod: 'cut'
},
delete: {
label: 'Delete',
accelerator: 'Delete',
webContentsMethod: 'delete'
},
front: {
@ -44,34 +43,38 @@ const roles = {
},
minimize: {
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
accelerator: 'CommandOrControl+M',
windowMethod: 'minimize'
},
paste: {
label: 'Paste',
accelerator: 'CmdOrCtrl+V',
accelerator: 'CommandOrControl+V',
webContentsMethod: 'paste'
},
pasteandmatchstyle: {
label: 'Paste and Match Style',
accelerator: 'Shift+Command+V',
accelerator: 'Shift+CommandOrControl+V',
webContentsMethod: 'pasteAndMatchStyle'
},
quit: {
get label () {
return process.platform === 'win32' ? 'Exit' : `Quit ${app.getName()}`
switch (process.platform) {
case 'darwin': return `Quit ${app.getName()}`
case 'win32': return 'Exit'
default: return 'Quit'
}
},
accelerator: process.platform === 'win32' ? null : 'Command+Q',
appMethod: 'quit'
},
redo: {
label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z',
accelerator: 'Shift+CommandOrControl+Z',
webContentsMethod: 'redo'
},
selectall: {
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
accelerator: 'CommandOrControl+A',
webContentsMethod: 'selectAll'
},
services: {
@ -86,7 +89,7 @@ const roles = {
},
undo: {
label: 'Undo',
accelerator: 'CmdOrCtrl+Z',
accelerator: 'CommandOrControl+Z',
webContentsMethod: 'undo'
},
unhide: {
@ -100,7 +103,7 @@ const roles = {
}
}
exports.getDefaultLabel = function (role) {
exports.getDefaultLabel = (role) => {
if (roles.hasOwnProperty(role)) {
return roles[role].label
} else {
@ -108,11 +111,11 @@ exports.getDefaultLabel = function (role) {
}
}
exports.getDefaultAccelerator = function (role) {
exports.getDefaultAccelerator = (role) => {
if (roles.hasOwnProperty(role)) return roles[role].accelerator
}
exports.execute = function (role, focusedWindow) {
exports.execute = (role, focusedWindow) => {
if (!roles.hasOwnProperty(role)) return false
if (process.platform === 'darwin') return false