Skip to main content

Crate wayle_systray

Crate wayle_systray 

Source
Expand description

System tray management via the StatusNotifier (SNI) and DBusMenu protocols.

§Overview

The service discovers and monitors system tray items registered on D-Bus, providing reactive access to item properties, icons, and menus. It can operate as either a StatusNotifierWatcher (central registry) or a StatusNotifierHost (consumer of items from an existing watcher).

§Reactive Pattern

All tray item properties use Property<T>:

  • .get() returns the current value snapshot
  • .watch() returns a stream of value changes

§Quick Start

use wayle_systray::SystemTrayService;

let service = SystemTrayService::new().await?;

// Get current items
for item in service.items.get().iter() {
    println!("{}: {}", item.id.get(), item.title.get());
}

§Watching for Changes

use wayle_systray::SystemTrayService;
use futures::StreamExt;

// React to tray item changes
let mut stream = service.items.watch();
while let Some(items) = stream.next().await {
    println!("Tray items changed: {} items", items.len());
}

§Configuration

MethodEffect
with_daemon()Interact with tray items from scripts or other processes
mode(TrayMode)Set operating mode: Watcher, Host, or Auto (default)
use wayle_systray::{SystemTrayService, types::TrayMode};

let tray = SystemTrayService::builder()
    .with_daemon()
    .mode(TrayMode::Auto)
    .build()
    .await?;

§D-Bus Interface

When with_daemon() is enabled, the service registers on the session bus.

  • Service: com.wayle.SystemTray1
  • Path: /com/wayle/SystemTray
  • Interface: com.wayle.SystemTray1

See dbus.md for the full interface specification.

§Service Fields

FieldTypeDescription
is_watcherboolWhether operating as the watcher registry
itemsProperty<Vec<Arc<TrayItem>>>Currently registered tray items

Re-exports§

pub use dbus::SystemTrayWayleProxy;
pub use service::SystemTrayService;

Modules§

adapters
UI framework adapters (GTK4) for native systray menu rendering. UI framework adapters implementation.
core
System tray item model.
dbus
D-Bus interface for CLI control. D-Bus interface for the system tray service.
error
Error types.
service
Main service implementation.
types
SNI and DBusMenu protocol types.

Structs§

SystemTrayServiceBuilder
Builder for configuring a SystemTrayService.