#tokio #tray #statusnotifieritem #dbusmenu

system-tray

Async StatusNotifierItem and DBusMenu client for custom tray implementations

13 releases (7 breaking)

0.8.4 Oct 12, 2025
0.8.1 Jun 27, 2025
0.7.0 Feb 8, 2025
0.5.0 Dec 15, 2024
0.1.4 Aug 13, 2023

#171 in GUI

Download history 116/week @ 2025-08-30 164/week @ 2025-09-06 562/week @ 2025-09-13 483/week @ 2025-09-20 252/week @ 2025-09-27 203/week @ 2025-10-04 468/week @ 2025-10-11 286/week @ 2025-10-18 211/week @ 2025-10-25 196/week @ 2025-11-01 181/week @ 2025-11-08 121/week @ 2025-11-15 119/week @ 2025-11-22 104/week @ 2025-11-29 95/week @ 2025-12-06 61/week @ 2025-12-13

407 downloads per month
Used in 2 crates

MIT and maybe LGPL-3.0-only

90KB
2K SLoC

System Tray

An async implementation of the StatusNotifierItem and DbusMenu protocols for building system trays.

Requires Tokio.

Example

use system_tray::client::Client;

#[tokio::main]
async fn main() {
    let client = Client::new().await.unwrap();
    let mut tray_rx = client.subscribe();

    let initial_items = client.items();
    
    // do something with initial items...
    
    while let Ok(ev) = tray_rx.recv().await {
        println!("{ev:?}"); // do something with event...
    }
}

dbusmenu-gtk3

Although the library provides a built-in Rust-native implementation of the DBusMenu protocol, if you are creating a menu UI, you need to parse the whole tree set up each element, and track all changes manually.

To circumvent this, bindings to the dbusmenu-gtk3 system library are included. When the feature of the same name is enabled, you can listen for UpdateEvent::MenuConnect and create the GTK element based on that:

fn on_update(update: system_tray::Event) {
    match update {
        Event::Update(address, UpdateEvent::MenuConnect(menu)) => {
            let menu: gtk::auto::Menu = system_tray::gtk_menu::Menu::new(&address, &menu);
            // do something with the menu element
        }
    }
}

[!NOTE] This feature is disabled by default to reduce compilation times. You must have libdbusmenu-gtk3 installed on your system to build and use this feature. No equivalent library exists for GTK4.

Attributions

Some of the code in this repository, namely the SNI host, is taken from eww under MIT. Many thanks to elkowar.

Dependencies

~14–32MB
~424K SLoC