if i start the electron-quick-start application, i get a full OSX menu:
I then add this code, mostly copied from docs, to my main.js:
const Menu = require('menu');
const MenuItem = require('menu-item');
var mainmenu = new Menu();
mainmenu.append(new MenuItem({ label: 'MenuItem1', click: function() { console.log('item 1 clicked'); } }));
Menu.setApplicationMenu(mainmenu);
I also tried to use menu template code from the electron menu docs, with the exact same disappointing result:
I also tried to add the code above to index.html, literally copying the code on Menu's doc. Same thing.
Any idea what is wrong?
electron-prebuilt
that it's used on the electron-quick-start
example has it's own app name (Electron).
To change this you need to rebuild/package your app and it will use the "name" or "productName" from your package.json.
Also there is method to set/get the app name but you have to package your app to see that change on the main menu:
const electron = require('electron');
const app = electron.app;
app.setName('APPNAME');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With