Skip to main content
electron-menubar can attach a native Electron Menu to the tray icon through the contextMenu option. The library handles the platform differences, so left-click still toggles the window where possible.

Attach a context menu

Pass the menu as contextMenu:
main.js

Platform behavior

The menu is bound via tray.setContextMenu (required by libappindicator / StatusNotifierItem) and re-published on every show/hide to defeat the indicator’s menu cache.

Update the menu

See the native menu example for a complete app.