I recently started making a desktop app with Electron, and staring at that menu bar that's always there at the top is getting annoying.
So, I went online and scoured the web for a good solution - but most answers I found were either very old, might not be supported in all operating systems, or just weren't what I was looking for. So, here I am, asking a question which will probably be marked a duplicate.
I want to hide the menubar in my app permanently - so setting the autoHideMenuBar
property to true
won't work, as then the alt key would still show it.
I want to keep functionality like using F11 to get fullscreen as well.
Does anyone know how I can do that?
CodePudding user response:
You could try this
const { Menu } = require('electron');
Menu.setApplicationMenu(null);
CodePudding user response:
There are normally a few ways to do this, here are some suggestions:
Set menu to null when creating the window:
const mainWin = new BrowserWindow({menu: null});
Remove menu after window object has been created (Set a blank menu with MacOS):
const { Menu } = require('electron');
process.platform === "win32" && mainWin.removeMenu();
process.platform === "darwin" && Menu.setApplicationMenu(Menu.buildFromTemplate([]));
Using the Menu module from electron:
const { Menu } = require('electron');
Menu.setApplicationMenu(null);