Merge pull request #6677 from miniak/default-app-menu
Add zooming commands to menu in default app
This commit is contained in:
commit
820f3968aa
2 changed files with 46 additions and 6 deletions
|
@ -90,15 +90,52 @@ app.once('ready', () => {
|
|||
if (focusedWindow) focusedWindow.reload()
|
||||
}
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) focusedWindow.toggleDevTools()
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Actual Size',
|
||||
accelerator: 'CmdOrCtrl+0',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) focusedWindow.webContents.setZoomLevel(0)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Zoom In',
|
||||
accelerator: 'CmdOrCtrl+Plus',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
const {webContents} = focusedWindow
|
||||
webContents.getZoomLevel((zoomLevel) => {
|
||||
webContents.setZoomLevel(zoomLevel + 0.5)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Zoom Out',
|
||||
accelerator: 'CmdOrCtrl+-',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
const {webContents} = focusedWindow
|
||||
webContents.getZoomLevel((zoomLevel) => {
|
||||
webContents.setZoomLevel(zoomLevel - 0.5)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -79,15 +79,18 @@ const template = [
|
|||
if (focusedWindow) focusedWindow.reload()
|
||||
}
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) focusedWindow.webContents.toggleDevTools()
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue