trayicon provide you system tray icon for your nodejs application.
const Tray = require('trayicon');
Tray.create(function(tray) {
let main = tray.item("Power");
main.add(tray.item("on"), tray.item("on"));
let quit = tray.item("Quit", () => tray.kill());
tray.setMenu(main, quit);
});
Create a new Tray instance, return a promise / emit a callback when the trayicon is ready.
If defined, action
callback is triggered when double clicking the tray.
Set useTempDir
to true
or "clean"
to copy executable files to temporary directory (clean
removes temp files on tray.kill()
). Allows using the package with pkg.
Set the systray title.
Set the systray icon.
Display a notification balloon.
Set the systray menu.
(Item) tray.item("foo", { ?checked : boolean, ?disabled : boolean, ?bold : boolean, ?action :
function})
Create a menu item. If defined, the action
callback is triggered when the item is selected.
Create a submenu of childrenItems under parentItem.
Create an item of type "separator"
- Work when running node as SYSTEM\NT authority (trayicon will fallback to interactive session if needed)