nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

Mac menu merging creates duplicate menus

Open erikjjohnson opened this issue 13 years ago • 2 comments

I found several other issues reported regarding the merging of native menus in Mac. E.g., #506) and some discussion about how this can be done by recompiling node-webkit. I'm semi-reopening this issue in hopes that we can get a javascript interface to merging mac menu items. Let me give a concrete example to reproduce the problem. This code attempts to add the normal "zoom" item to the Mac Window menu:

nw: 0.7.5 Mac: 10.8.5

Add this code to index.html (or where ever in the app's startup):

function buildMacWindowMenu(nwGui) { var menu = new nwGui.MenuItem({label: 'Window'}); menu.submenu = new nwGui.Menu(); var menuItem = new nwGui.MenuItem({label: 'Zoom'}); menuItem.click = function () { nwGui.Window.get().maximize(); } menu.submenu.append(menuItem); }

var nwGui = require('nw.gui'); var menubar = new nwGui.Menu({type: 'menubar'}); menubar.append(buildMacWindowMenu(nwGui)); nwGui.Window.get().menu = menubar;

The result is two Window menus on mac. The documented "merge" with the system menus does not occur.

I also tried to first read nwGui.Window.get().menu to see if I could find the existing Window menu and muck with it, but that menu comes back as undefined.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

erikjjohnson avatar Oct 10 '13 18:10 erikjjohnson

+1 please fix :)

xmnboy avatar Oct 14 '13 23:10 xmnboy

This should be working with latest version now.

In 0.13 we changed to an optimized architecture so more features can be supported, see http://nwjs.io/blog/whats-new-in-0.13/ and it's good for keeping up with Chromium upstream -- we released with Node.js v6.0 and new Chromium versions within 1 day after upstream release.

The new version would fixed many issues reported here and we're scrubbing them. This issue is closed as we believe it should be fixed. Please leave a message if it isn't and we'll reopen it.

rogerwang avatar Apr 29 '16 02:04 rogerwang