question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MacOS: MenuBar replaced with default on nw.Window.open()

See original GitHub issue

NWJS Version : 0.27.1-sdk Operating System : MacOS 10.11.6

Expected behavior

I installed a new, custom menu. I expect that to remain even if I open a new window.

Actual behavior

If you set window: { show: false } in your package.json (so the window is responsible for showing itself after launch) then open a sub-window, the main global menu is reset to the default menu you get if you don’t customize anything.

How to reproduce

Open the attached archive, and run nw . in the same directory as the package.json. Note the structure of the top-level menu. Then, click the link. Note that the top-level menu changes.

Now, close the app. Change to show: true in package.json and try it again. Note that the menu does not change this time.

Archive.zip

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
semmelcommented, Mar 7, 2022

This seems to be fixed with the NW2 renderer "chromium-args": "--enable-features=nw2" on nwjs v0.42.3 Mac OS 10.14.6! 👍

To see, just add the line to package.json in @scottnonnenberg 's demo.

If adding the mac built-in Edit or Window menus using menubar.createMacBuiltin however, that call MUST PRECEDE any menubar.append() calls or the menus get mixed up.

In index.html

menubar.createMacBuiltin("delete-later"); // must come first!!
menubar.append(new nw.MenuItem({ label: 'File', submenu: file })); 
menubar.append(new nw.MenuItem({ label: 'View', submenu: view }));

Edit 7th March 2022:

It is still not fixed in nwjs v0.62.0

0reactions
semmelcommented, Mar 7, 2022

This issue (+ workaround switching steps 2 and 3) still occurs with nwjs v0.62.0 on MacOS 11.6.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Desktop & Dock settings on Mac - Apple Support
On your Mac, use Desktop & Dock settings to change the appearance of the Dock, and to select items to show in the...
Read more >
How to change the OSX menubar in wxPython without any ...
I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop...
Read more >
macos - Is there a way to make the Menu bar show at all times ...
Simply uncheck that box, and now when you bring an app into full-screen, the menu bar will remain at the top of the...
Read more >
Window - NW.js Documentation
Window object. This function is supported since 0.42.6. Window.open(url, [options], [callback]). Behavior Changed. The ...
Read more >
From 0.12 to 0.13 - NW.js Documentation
The default protocol is changed from file:// to chrome-extension:// , where the host part ... NW will use a default JS to open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found