tray
System tray icon with a context menu.
- Kind: module (
.owm), optional - Version: 0.1.0
- Platforms: Linux, Windows
Optional because it needs a StatusNotifierWatcher (Linux) or equivalent; it is omitted from builds without the dependencies.
Functions
| Function | Signature |
|---|---|
create |
(id) → null |
setImage |
(pngBase64) → null |
setPressedImage |
(pngBase64) → null |
setToolTip |
(text) → null |
setTitle |
(text) → null |
setContextMenu |
({ items }) → null |
popupContextMenu |
() → null |
destroy |
() → null |
Events
| Event | Payload |
|---|---|
tray.event |
{ button: 'left' | 'right' | 'middle' } |
menu.click |
{ id, role, windowId } (from the context menu) |
Platform notes
- Linux: a hand-rolled
org.kde.StatusNotifierItem+com.canonical.dbusmenuimplementation over GDBus (no libappindicator). Works on GNOME (appindicator extension), KDE, and XFCE (SNI plugin). setPressedImageis a no-op on Linux.- Windows (
Shell_NotifyIcon) is the intended backend; verify in CI.
Prefer the SDK
Use Tray in the main process: it converts images to
PNG base64, wires events, and reuses Menu for the context menu.