Add toggledevtools menu item role
This commit is contained in:
parent
0698b5f1be
commit
88959079bd
2 changed files with 7 additions and 6 deletions
|
@ -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'
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue