Add toggledevtools menu item role

This commit is contained in:
Kevin Sawicki 2016-11-15 10:52:03 -08:00
parent 0698b5f1be
commit 88959079bd
2 changed files with 7 additions and 6 deletions

View file

@ -87,11 +87,7 @@ app.once('ready', () => {
role: 'reload'
},
{
label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.toggleDevTools()
}
role: 'toggledevtools'
},
{
type: 'separator'

View file

@ -98,6 +98,11 @@ const roles = {
stopspeaking: {
label: 'Stop Speaking'
},
toggledevtools: {
label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
windowMethod: 'toggleDevTools'
},
togglefullscreen: {
label: 'Toggle Full Screen',
accelerator: process.platform === 'darwin' ? 'Control+Command+F' : 'F11',
@ -143,7 +148,7 @@ const canExecuteRole = (role) => {
if (!roles.hasOwnProperty(role)) return false
if (process.platform !== 'darwin') return true
// macOS handles all roles natively except the ones listed below
return ['reload', 'resetzoom', 'zoomin', 'zoomout'].includes(role)
return ['reload', 'resetzoom', 'toggledevtools', 'zoomin', 'zoomout'].includes(role)
}
exports.getDefaultLabel = (role) => {