diff --git a/Cargo.toml b/Cargo.toml index 33657e2..a085537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ authors = ["candifloss "] [dependencies] zbus = "4.4.0" +zvariant = "4.2.0" tokio = { version = "1.40.0", features = ["full"] } futures-util = "0.3.30" # rson_rs = "0.2.1" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 192386a..83db161 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,21 @@ -use zbus::{Connection, Result, MessageStream}; use futures_util::stream::TryStreamExt; +use zbus::{Connection, MessageStream, Result}; +use zvariant::{Type, Value}; #[tokio::main] async fn main() -> Result<()> { let connection = Connection::session().await?; connection - .request_name("org.freedesktop.Notifications") // Requesting dbus for this service name + .request_name("org.freedesktop.Notifications") // Requesting dbus for this service name .await?; - // - loop {} -} \ No newline at end of file + // Process incoming notifs + use futures_util::stream::TryStreamExt; + + let mut stream = zbus::MessageStream::from(&connection); // Convert the connection into a message stream + while let Some(msg) = stream.try_next().await? { + /// + } + + Ok(()) +} diff --git a/src/notifications.rs b/src/notifications.rs index 8fc9d3b..2607701 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -23,7 +23,7 @@ use zbus::proxy; #[proxy(interface = "org.freedesktop.Notifications", assume_defaults = true)] trait Notifications { /// CloseNotification method - fn close_notification(&self, arg_0: u32) -> zbus::Result<()>; + fn close_notification(&self, app_name: u32) -> zbus::Result<()>; /// GetCapabilities method fn get_capabilities(&self) -> zbus::Result>; @@ -35,25 +35,25 @@ trait Notifications { #[allow(clippy::too_many_arguments)] fn notify( &self, - arg_0: &str, - arg_1: u32, - arg_2: &str, - arg_3: &str, - arg_4: &str, - arg_5: &[&str], - arg_6: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>, - arg_7: i32, + app_name: &str, + replace_id: u32, + icon: &str, + summary: &str, + body: &str, + actions: &[&str], + hints: std::collections::HashMap<&str, &zbus::zvariant::Value<'_>>, + expir_timeout: i32, ) -> zbus::Result; /// ActionInvoked signal #[zbus(signal)] - fn action_invoked(&self, arg_0: u32, arg_1: &str) -> zbus::Result<()>; + fn action_invoked(&self, app_name: u32, replace_id: &str) -> zbus::Result<()>; /// ActivationToken signal #[zbus(signal)] - fn activation_token(&self, arg_0: u32, arg_1: &str) -> zbus::Result<()>; + fn activation_token(&self, app_name: u32, replace_id: &str) -> zbus::Result<()>; /// NotificationClosed signal #[zbus(signal)] - fn notification_closed(&self, arg_0: u32, arg_1: u32) -> zbus::Result<()>; + fn notification_closed(&self, app_name: u32, replace_id: u32) -> zbus::Result<()>; }