Creating a window menu on OS X

I would like to create the same menu as this application . Since it is on the list of applications using node -webkit / nw.js, I think it is possible. I looked through all the documentation and could not find anything on how to do this. A Google search was also not really fruitful.

Perhaps one of you guys did this earlier and could send me in the right direction?

+6
source share
1 answer

First you need to prevent the application from appearing on the taskbar

{ "name": "My App", "version": "1.0.0", "main": "app.html", "window": { "show": false, "show_in_taskbar": false } } 

Then you need to create the tray menu (top panel): (example from its source)

 tray = new app.node.gui.Tray({ title: '', icon: 'assets/css/images/menu_icon.png', alticon: 'assets/css/images/menu_alticon.png', iconsAreTemplates: false }); 

Then you need to create a hidden window and show it when you click in the tray:

 // create window var params = {toolbar: app.devMode, frame: false, transparent: true, resizable: false, show: false}; window = app.node.gui.Window.open('templates/panel.html', params); function showPopup (x, y) { window.on('document-end', function() window.moveTo(x - (window.window.width / 2) - 6, y); window.show(); window.focus(); }); } // show panel when click in tray tray.on('click', function (evt) { showPopup(evt.x, evt.y); }); 
+7
source

Source: https://habr.com/ru/post/983109/


All Articles