Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #6087 from NejcZdovc/feature/doc-menu
Browse files Browse the repository at this point in the history
Added dock menu for macOS
  • Loading branch information
darkdh committed Dec 9, 2016
2 parents 1c3f04d + 688aab1 commit 5ee0d07
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions app/browser/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const messages = require('../../js/constants/messages')
const settings = require('../../js/constants/settings')
const siteTags = require('../../js/constants/siteTags')
const dialog = electron.dialog
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const {fileUrl} = require('../../js/lib/appUrlUtil')
const menuUtil = require('../common/lib/menuUtil')
Expand Down Expand Up @@ -456,7 +457,7 @@ const createDebugSubmenu = () => {
// To debug all renderer processes then add the appendSwitch call to app/index.js
label: 'append wait renderer switch',
click: function () {
electron.app.commandLine.appendSwitch('renderer-startup-dialog')
app.commandLine.appendSwitch('renderer-startup-dialog')
}
}, {
label: 'Crash main process',
Expand All @@ -467,8 +468,8 @@ const createDebugSubmenu = () => {
label: 'Relaunch',
accelerator: 'Command+Alt+R',
click: function () {
electron.app.relaunch({args: process.argv.slice(1) + ['--relaunch']})
electron.app.quit()
app.relaunch({args: process.argv.slice(1) + ['--relaunch']})
app.quit()
}
}, {
label: locale.translation('toggleBrowserConsole'),
Expand All @@ -488,6 +489,15 @@ const createDebugSubmenu = () => {
]
}

const createDockSubmenu = () => {
return [
{
label: locale.translation('newWindow'),
click: () => appActions.newWindow()
}
]
}

/**
* Will only build the initial menu, which is mostly static items
* Dynamic items (Bookmarks, History) get updated w/ updateMenu
Expand Down Expand Up @@ -558,6 +568,11 @@ const createMenu = () => {
if (oldMenu) {
oldMenu.destroy()
}

if (app.dock) {
const dockMenu = Menu.buildFromTemplate(createDockSubmenu())
app.dock.setMenu(dockMenu)
}
}

const setMenuItemChecked = (label, checked) => {
Expand Down

0 comments on commit 5ee0d07

Please sign in to comment.