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

Added dock menu for macOS #6087

Merged
merged 1 commit into from
Dec 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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