在 Electron 1.8.7 中我可以这样做:
.on('browser-window-created', (e, window) => {
window.setMenu(null);
})
但是在 Electron 4.0.1 中这似乎不再起作用了。
最佳答案
它应该以相同的方式工作,但看起来 Electron 中有一个错误( https://github.com/electron/electron/issues/15901 )。 注释中建议了一种解决方法:在创建 BrowserWindow 对象时将 autoHideMenuBar
-option 设置为 true。不幸的是,当按下 alt 键时仍然会显示菜单。
编辑:有一个更好的解决方法。使用BrowserWindow.setMenuBarVisibility(false)
.
或者,您可以尝试 Electron 版本 3。
关于electron - 在 Electron 4.0.1 下如何隐藏 linux 下的菜单栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54205638/