summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-08-14 17:00:58 +1000
committerNicholas Tay <nick@windblume.net>2022-08-14 17:00:58 +1000
commita36b59792e85ae0bd57fc452257473dfccf9495e (patch)
tree05e3ad7eb0ad464e3bc6cd5b40765274fe0db900
parent918eeb7695b56bffa465a6a7ea2411d0229f769d (diff)
downloadelectron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.tar.gz
electron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.tar.bz2
electron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.zip
Tweak macOS menu bar
-rw-r--r--main.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/main.js b/main.js
index 566a954..b528725 100644
--- a/main.js
+++ b/main.js
@@ -3,6 +3,9 @@ const path = require('path');
const config = require(path.join(__dirname, 'config.json'));
+if (config.name)
+ app.setName(config.name);
+
// Load flash
let flash;
if (process.arch !== 'x64')
@@ -26,6 +29,16 @@ app.commandLine.appendSwitch('ppapi-flash-version', '32.0.0.371');
// Menu
// https://www.electronjs.org/docs/latest/api/menu
const menuTemplate = [
+ // macOS first menu is always the "app name" one.
+ ...(process.platform === 'darwin' ? [{
+ label: app.name,
+ submenu: [
+ { role: 'about' },
+ { type: 'separator' },
+ { role: 'quit' }
+ ]
+ }] : []),
+
{
label: 'File',
submenu: Object.keys(config.urls).map(urlName => ({
@@ -33,7 +46,7 @@ const menuTemplate = [
click: function(menuItem, browserWindow, event) {
browserWindow.loadURL(config.urls[urlName]);
}
- })).concat([
+ })).concat(process.platform === 'darwin' ? [] : [
{ type: 'separator' },
{ role: 'quit' }
])
@@ -83,4 +96,4 @@ app.whenReady().then(() => {
app.on('window-all-closed', () => {
// Quit when all windows closed - even on macOS.
app.quit()
-}); \ No newline at end of file
+});