2016-06-22 17:45:01 +00:00
|
|
|
const roles = {
|
2016-06-22 20:15:20 +00:00
|
|
|
about: {
|
|
|
|
get label () {
|
|
|
|
const {app} = require('electron')
|
|
|
|
return `About ${app.getName()}`
|
|
|
|
}
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
close: {
|
|
|
|
label: 'Close',
|
|
|
|
accelerator: 'CmdOrCtrl+W',
|
|
|
|
method: 'close'
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
label: 'Copy',
|
|
|
|
accelerator: 'CmdOrCtrl+C',
|
|
|
|
method: 'copy'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
|
|
|
cut: {
|
|
|
|
label: 'Cut',
|
|
|
|
accelerator: 'CmdOrCtrl+X',
|
|
|
|
method: 'cut'
|
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
delete: {
|
|
|
|
label: 'Delete',
|
|
|
|
accelerator: 'Delete',
|
|
|
|
method: 'delete'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
front: {
|
|
|
|
label: 'Bring All to Front'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
help: {
|
|
|
|
label: 'Help'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
hide: {
|
|
|
|
get label () {
|
|
|
|
const {app} = require('electron')
|
|
|
|
return `Hide ${app.getName()}`
|
|
|
|
},
|
|
|
|
accelerator: 'Command+H'
|
|
|
|
},
|
|
|
|
hideothers: {
|
|
|
|
label: 'Hide Others',
|
|
|
|
accelerator: 'Command+Alt+H'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
|
|
|
minimize: {
|
|
|
|
label: 'Minimize',
|
|
|
|
accelerator: 'CmdOrCtrl+M',
|
|
|
|
method: 'minimize'
|
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
paste: {
|
|
|
|
label: 'Paste',
|
|
|
|
accelerator: 'CmdOrCtrl+V',
|
|
|
|
method: 'paste'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
pasteandmatchstyle: {
|
|
|
|
label: 'Paste and Match Style',
|
|
|
|
accelerator: 'Shift+Command+V',
|
|
|
|
method: 'pasteAndMatchStyle'
|
2016-06-22 17:29:49 +00:00
|
|
|
},
|
|
|
|
quit: {
|
|
|
|
get label () {
|
|
|
|
const {app} = require('electron')
|
|
|
|
return process.platform === 'win32' ? 'Exit' : `Quit ${app.getName()}`
|
|
|
|
},
|
|
|
|
accelerator: process.platform === 'win32' ? null : 'Command+Q',
|
|
|
|
method: 'quit'
|
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
redo: {
|
|
|
|
label: 'Redo',
|
|
|
|
accelerator: 'Shift+CmdOrCtrl+Z',
|
|
|
|
method: 'redo'
|
|
|
|
},
|
|
|
|
selectall: {
|
|
|
|
label: 'Select All',
|
|
|
|
accelerator: 'CmdOrCtrl+A',
|
|
|
|
method: 'selectAll'
|
|
|
|
},
|
|
|
|
services: {
|
|
|
|
label: 'Services'
|
|
|
|
},
|
2016-06-22 17:29:49 +00:00
|
|
|
togglefullscreen: {
|
|
|
|
label: 'Toggle Full Screen',
|
|
|
|
accelerator: process.platform === 'darwin' ? 'Ctrl+Command+F' : 'F11',
|
|
|
|
method: 'toggleFullScreen'
|
2016-06-22 17:47:25 +00:00
|
|
|
},
|
2016-06-22 20:15:20 +00:00
|
|
|
undo: {
|
|
|
|
label: 'Undo',
|
|
|
|
accelerator: 'CmdOrCtrl+Z',
|
|
|
|
method: 'undo'
|
|
|
|
},
|
|
|
|
unhide: {
|
|
|
|
label: 'Show All'
|
2016-06-22 17:47:25 +00:00
|
|
|
},
|
|
|
|
window: {
|
|
|
|
label: 'Window'
|
2016-06-22 20:09:39 +00:00
|
|
|
},
|
|
|
|
zoom: {
|
|
|
|
label: 'Zoom'
|
2016-06-22 17:29:49 +00:00
|
|
|
}
|
|
|
|
}
|
2016-06-22 17:45:01 +00:00
|
|
|
|
|
|
|
exports.getDefaultLabel = function (role) {
|
|
|
|
if (roles.hasOwnProperty(role)) {
|
|
|
|
return roles[role].label
|
|
|
|
} else {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.getDefaultAccelerator = function (role) {
|
|
|
|
if (roles.hasOwnProperty(role)) return roles[role].accelerator
|
|
|
|
}
|