From 325d1996c61843ed7d0f3af5948cfa31c1b6892c Mon Sep 17 00:00:00 2001 From: Pascal Widdershoven Date: Mon, 15 Feb 2016 08:38:21 +0100 Subject: [PATCH] Add default Mac application menu All Mac apps generally have this menu, allows to hide the app with the default shortcut. --- src/main/menus/app.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/menus/app.js b/src/main/menus/app.js index 68fdb8a4..e56dec54 100644 --- a/src/main/menus/app.js +++ b/src/main/menus/app.js @@ -7,6 +7,24 @@ var createTemplate = function(mainWindow) { var app_name = electron.app.getName(); var first_menu_name = (process.platform === 'darwin') ? app_name : 'File'; var template = []; + + const platformAppMenu = process.platform === 'darwin' ? [{ + type: 'separator' + }, { + label: 'Hide ' + app_name, + accelerator: 'Command+H', + selector: 'hide:' + }, { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + selector: 'hideOtherApplications:' + }, { + label: 'Show All', + selector: 'unhideAllApplications:' + }, { + type: 'separator' + }] : []; + template.push({ label: first_menu_name, submenu: [{ @@ -17,7 +35,7 @@ var createTemplate = function(mainWindow) { click: function(item, focusedWindow) { mainWindow.loadURL('file://' + __dirname + '/browser/settings.html'); } - }, { + }, ...platformAppMenu, { label: 'Quit', accelerator: 'CmdOrCtrl+Q', click: function(item, focusedWindow) {