https://github.com/nwutils/faux-tray-menu
(WIP) Example of a custom right-click menu on a tray icon using a frameless window
https://github.com/nwutils/faux-tray-menu
Last synced: 4 months ago
JSON representation
(WIP) Example of a custom right-click menu on a tray icon using a frameless window
- Host: GitHub
- URL: https://github.com/nwutils/faux-tray-menu
- Owner: nwutils
- License: mit
- Created: 2020-11-03T13:30:52.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-20T12:16:47.000Z (almost 5 years ago)
- Last Synced: 2025-03-03T00:25:56.313Z (over 1 year ago)
- Homepage: https://nwutils.io
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# faux-tray-menu
Example of a custom right-click menu on a tray icon using a frameless window.
This is a placeholder repo for an idea.
## The problem
In NW.js v0.34.0-beta a bug was introduced that causes the taskbar to display NW.js when you open a context menu on a tray app.

**UPDATE:** This bug was fixed in NW.js v0.48.0!
## The idea
The `tray` feature only supports a native menu on right-click (which causes this bug) and a `click` event on left-click.
```js
tray.on('click', function (evt) {
nw.Window.get().showDevTools();
console.log(evt.x);
console.log(evt.y);
});
```
Using the x,y coords, you could spawn a custom frameless window that simulates a menu at that location. Frameless windows would have `show_in_taskbar: false`. This approach would also allow for much greater control over the rendering and interactivity of the menu.