0

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?

just-a-hriday
  • 148
  • 1
  • 13
  • 3
    Does this answer your question? [Remove menubar from Electron app](https://stackoverflow.com/questions/39091964/remove-menubar-from-electron-app) – Ray Oct 19 '21 at 10:50

2 Answers2

2

There are normally a few ways to do this, here are some suggestions:

  1. Set menu to null when creating the window:

    const mainWin = new BrowserWindow({menu: null});

  2. 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([]));

  3. Using the Menu module from electron:

    const { Menu } = require('electron');

    Menu.setApplicationMenu(null);

mpmcintyre
  • 614
  • 5
  • 16
0

You could try this

const { Menu } = require('electron');
Menu.setApplicationMenu(null);
AnanthDev
  • 1,605
  • 1
  • 4
  • 14