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
Installation
Usage
use ;
let icon = from_rgba?;
let tray = new
.with_icon
.with_tooltip
.build?;
// Poll for events
let receiver = receiver;
loop
Feature Flags
| Feature | Description |
|---|---|
serde |
Serialize/deserialize events and IDs |
Platform Notes
- Linux: Uses native X11 system tray protocol.
- Windows: Uses
Shell_NotifyIconW. Handles taskbar restart automatically. - macOS: Uses
NSStatusItem. Requires main thread (MainThreadMarker).
License
MIT