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
| 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;
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
| Method | Effect |
|---|---|
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§
- Notification
Service Builder - Builder for configuring and creating a NotificationService instance.
- Wayle
Notifications Proxy - D-Bus client proxy for Wayle notification extensions.