fix: hiding window menu should work on startup (#21436)
* fix: menu visibility should not be overwritten on startup * fix: removing menu for window without global menubar * test: setMenu tests are not for mac
This commit is contained in:
parent
7f6b308bf1
commit
3cb0ed306b
7 changed files with 88 additions and 15 deletions
|
@ -195,13 +195,14 @@ app.on('window-all-closed', () => {
|
|||
}
|
||||
})
|
||||
|
||||
Promise.all([
|
||||
import('@electron/internal/browser/default-menu'),
|
||||
app.whenReady()
|
||||
]).then(([{ setDefaultApplicationMenu }]) => {
|
||||
// Create default menu
|
||||
setDefaultApplicationMenu()
|
||||
})
|
||||
const { setDefaultApplicationMenu } = require('@electron/internal/browser/default-menu')
|
||||
|
||||
// Create default menu.
|
||||
//
|
||||
// Note that the task must be added before loading any app, so we can make sure
|
||||
// the call is maded before any user window is created, otherwise the default
|
||||
// menu may show even when user explicitly hides the menu.
|
||||
app.once('ready', setDefaultApplicationMenu)
|
||||
|
||||
if (packagePath) {
|
||||
// Finally load app's main.js and transfer control to C++.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue