tray
Cross-platform system tray icon library for Rust.
Features
- Native implementations: X11 (Linux), Shell_NotifyIcon (Windows), NSStatusItem (macOS)
- Full event support: Click, double-click, enter, leave, move
- Thread-safe:
TrayIconisSend + Syncfor use with async runtimes - No GTK dependency on Linux by default (optional
appindicatorfeature)
Usage
use ;
let icon = from_rgba?;
let tray = new
.with_icon
.with_tooltip
.build?;
// Poll for events
let receiver = receiver;
loop
Features
| Feature | Description |
|---|---|
appindicator |
Use libappindicator on Linux (StatusNotifierItem) |
serde |
Serialize/deserialize events and IDs |
Platform Notes
- Linux: Uses native X11 system tray protocol by default. Enable
appindicatorfor environments without a system tray (e.g., GNOME). - Windows: Uses
Shell_NotifyIconW. Handles taskbar restart automatically. - macOS: Uses
NSStatusItem. Requires main thread (MainThreadMarker).
License
MIT