Skip to main content

wayle_notification/
wayle_proxy.rs

1//! D-Bus client proxy for Wayle notification extensions.
2#![allow(missing_docs)]
3
4use zbus::{Result, proxy};
5
6/// D-Bus client proxy for Wayle notification extensions.
7///
8/// Connects to a running notification daemon and allows external control
9/// of notifications, DND mode, and popup settings.
10#[proxy(
11    interface = "com.wayle.Notifications1",
12    default_service = "com.wayle.Notifications1",
13    default_path = "/com/wayle/Notifications",
14    gen_blocking = false
15)]
16pub trait WayleNotifications {
17    /// Dismisses all notifications.
18    async fn dismiss_all(&self) -> Result<()>;
19
20    /// Dismisses a specific notification by ID.
21    async fn dismiss(&self, id: u32) -> Result<()>;
22
23    /// Sets Do Not Disturb mode.
24    async fn set_dnd(&self, enabled: bool) -> Result<()>;
25
26    /// Toggles Do Not Disturb mode.
27    async fn toggle_dnd(&self) -> Result<()>;
28
29    /// Sets the popup display duration in milliseconds.
30    async fn set_popup_duration(&self, duration_ms: u32) -> Result<()>;
31
32    /// Lists all notifications.
33    ///
34    /// Returns a list of tuples: (id, app_name, summary, body).
35    async fn list(&self) -> Result<Vec<(u32, String, String, String)>>;
36
37    /// Do Not Disturb status.
38    #[zbus(property)]
39    fn dnd(&self) -> Result<bool>;
40
41    /// Popup display duration in milliseconds.
42    #[zbus(property)]
43    fn popup_duration(&self) -> Result<u32>;
44
45    /// Number of notifications.
46    #[zbus(property)]
47    fn count(&self) -> Result<u32>;
48
49    /// Number of active popups.
50    #[zbus(property)]
51    fn popup_count(&self) -> Result<u32>;
52}