1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! 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`](wayle_core::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
//!
//! ```no_run
//! 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 |
//!
//! ```no_run
//! 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`](https://github.com/wayle-rs/wayle-services/blob/master/wayle-notification/dbus.md) for the full interface specification.
/// Notification data structures and operations.
pub
/// Error types.
pub
pub
pub
pub
pub
pub
/// Service implementation.
/// freedesktop notification types (Urgency, ClosedReason, Capabilities, etc.).
pub
pub use NotificationServiceBuilder;
pub use Error;
pub use NotificationService;
pub use WayleNotificationsProxy;
;