Merge pull request #6677 from miniak/default-app-menu

Add zooming commands to menu in default app
This commit is contained in:
Kevin Sawicki 2016-08-02 10:27:56 -07:00 committed by GitHub
commit 820f3968aa
2 changed files with 46 additions and 6 deletions

View file

@ -90,15 +90,52 @@ app.once('ready', () => {
if (focusedWindow) focusedWindow.reload() if (focusedWindow) focusedWindow.reload()
} }
}, },
{
role: 'togglefullscreen'
},
{ {
label: 'Toggle Developer Tools', label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click (item, focusedWindow) { click (item, focusedWindow) {
if (focusedWindow) focusedWindow.toggleDevTools() 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'
} }
] ]
}, },

View file

@ -79,15 +79,18 @@ const template = [
if (focusedWindow) focusedWindow.reload() if (focusedWindow) focusedWindow.reload()
} }
}, },
{
role: 'togglefullscreen'
},
{ {
label: 'Toggle Developer Tools', label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I', accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click (item, focusedWindow) { click (item, focusedWindow) {
if (focusedWindow) focusedWindow.webContents.toggleDevTools() if (focusedWindow) focusedWindow.webContents.toggleDevTools()
} }
},
{
type: 'separator'
},
{
role: 'togglefullscreen'
} }
] ]
}, },