wayle-notification 0.1.0

Desktop notification service with popup management
Documentation

Desktop notification service implementing the freedesktop.org Desktop Notifications spec.

Overview

Registers as org.freedesktop.Notifications on D-Bus to receive notifications from applications. Notifications are stored, displayed as popups, and can be dismissed or have actions invoked.

Reactive Properties

Service state is exposed through Property fields:

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

Service Fields

Field Type Description
notifications Vec<Arc<Notification>> All received notifications
popups Vec<Arc<Notification>> Currently visible popups
popup_duration u32 Popup display time in ms
dnd bool Do Not Disturb mode (suppresses popups)
remove_expired bool Auto-remove expired notifications

Example

use wayle_notification::NotificationService;
use futures::StreamExt;

# async fn example() -> Result<(), wayle_notification::Error> {
let service = NotificationService::new().await?;

// Snapshot access
let count = service.notifications.get().len();

// Reactive stream
let mut stream = service.notifications.watch();
while let Some(notifications) = stream.next().await {
    println!("{} notifications", notifications.len());
}
# Ok(())
# }

Configuration

Method Effect
with_daemon() Control notifications from scripts or other processes
use wayle_notification::NotificationService;

# async fn example() -> Result<(), wayle_notification::Error> {
let service = NotificationService::builder()
    .with_daemon()
    .build()
    .await?;
# Ok(())
# }

D-Bus Interface

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

  • Service: com.wayle.Notifications1
  • Path: /com/wayle/Notifications
  • Interface: com.wayle.Notifications1

See dbus.md for the full interface specification.