Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide Electron.js menubar

Tags:

electron

I'm trying to remove the Electron menubar from my window. I use this

myWindow.isMenuBarVisible(false);

But this doesn't work. Setting the 'AutoHideMenuBar' property works but that only hides the menu until the alt key is pressed.

What is the proper way to remove the Electron menubar?

like image 998
Jerry Avatar asked Oct 31 '25 22:10

Jerry


2 Answers

I am using electron version 10. For me, I added parameter to hide menubar on BrowserWindow()

const mainWindow = new BrowserWindow({
        width: 800,
        height:600,
        autoHideMenuBar: true //hide menu bar
    })
like image 166
Mohammed Sabbir Avatar answered Nov 02 '25 12:11

Mohammed Sabbir


You cannot alter visiblity of the menu with isMenuBarVisible(). It can only tell you if menu is visible or not.

isMenuBarVisible() Returns Boolean - Whether the menu bar is visible.

Try setMenu(null).

setMenu(menu) Sets the menu as the window's menu bar, setting it to null will remove the menu bar.

like image 25
jayarjo Avatar answered Nov 02 '25 12:11

jayarjo