Add more role defaults

This commit is contained in:
Kevin Sawicki 2016-06-22 13:09:39 -07:00
parent 888068b597
commit c0562d16d5
2 changed files with 29 additions and 16 deletions

View file

@ -151,14 +151,12 @@ app.once('ready', () => {
label: 'Electron', label: 'Electron',
submenu: [ submenu: [
{ {
label: 'About Electron',
role: 'about' role: 'about'
}, },
{ {
type: 'separator' type: 'separator'
}, },
{ {
label: 'Services',
role: 'services', role: 'services',
submenu: [] submenu: []
}, },
@ -166,49 +164,36 @@ app.once('ready', () => {
type: 'separator' type: 'separator'
}, },
{ {
label: 'Hide Electron',
accelerator: 'Command+H',
role: 'hide' role: 'hide'
}, },
{ {
label: 'Hide Others',
accelerator: 'Command+Alt+H',
role: 'hideothers' role: 'hideothers'
}, },
{ {
label: 'Show All',
role: 'unhide' role: 'unhide'
}, },
{ {
type: 'separator' type: 'separator'
}, },
{ {
label: 'Quit ' + app.getName(),
accelerator: 'Command+Q',
role: 'quit' role: 'quit'
} }
] ]
}) })
template[3].submenu = [ template[3].submenu = [
{ {
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close' role: 'close'
}, },
{ {
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize' role: 'minimize'
}, },
{ {
label: 'Zoom',
role: 'zoom' role: 'zoom'
}, },
{ {
type: 'separator' type: 'separator'
}, },
{ {
label: 'Bring All to Front',
role: 'front' role: 'front'
} }
] ]
@ -219,7 +204,6 @@ app.once('ready', () => {
label: 'File', label: 'File',
submenu: [ submenu: [
{ {
label: 'Exit',
role: 'quit' role: 'quit'
} }
] ]

View file

@ -67,6 +67,35 @@ const roles = {
}, },
window: { window: {
label: 'Window' label: 'Window'
},
services: {
label: 'Services'
},
zoom: {
label: 'Zoom'
},
front: {
label: 'Bring All to Front'
},
about: {
get label () {
const {app} = require('electron')
return `About ${app.getName()}`
}
},
hide: {
get label () {
const {app} = require('electron')
return return `Hide ${app.getName()}`
},
accelerator: 'Command+H'
},
hideothers: {
label: 'Hide Others',
accelerator: 'Command+Alt+H'
},
unhide: {
label: 'Show All'
} }
} }