diff options
author | Nicholas Tay <nick@windblume.net> | 2022-08-14 17:00:58 +1000 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-08-14 17:00:58 +1000 |
commit | a36b59792e85ae0bd57fc452257473dfccf9495e (patch) | |
tree | 05e3ad7eb0ad464e3bc6cd5b40765274fe0db900 | |
parent | 918eeb7695b56bffa465a6a7ea2411d0229f769d (diff) | |
download | electron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.tar.gz electron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.tar.bz2 electron-flash-a36b59792e85ae0bd57fc452257473dfccf9495e.zip |
Tweak macOS menu bar
-rw-r--r-- | main.js | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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 +}); |