Skip to main content

Crate wayle_notification

Crate wayle_notification 

Source
Expand description

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

FieldTypeDescription
notificationsVec<Arc<Notification>>All received notifications
popupsVec<Arc<Notification>>Currently visible popups
popup_durationu32Popup display time in ms
dndboolDo Not Disturb mode (suppresses popups)
remove_expiredboolAuto-remove expired notifications

§Example

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

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());
}

§Configuration

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

let service = NotificationService::builder()
    .with_daemon()
    .build()
    .await?;

§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.

Re-exports§

pub use error::Error;
pub use service::NotificationService;

Modules§

core
Notification data structures and operations. Notification data and internal types.
error
Error types.
service
Service implementation.
types
freedesktop notification types (Urgency, ClosedReason, Capabilities, etc.). Types from the freedesktop.org Desktop Notifications Specification.

Structs§

NotificationServiceBuilder
Builder for configuring and creating a NotificationService instance.
WayleNotificationsProxy
D-Bus client proxy for Wayle notification extensions.