use zbus::{Connection, MessageStream, MatchRule, fdo}; use zbus::zvariant::{OwnedValue, Type}; #[derive(Debug)] struct Notification { // ... fields // } #[tokio::main] async fn main() -> Result<(), zbus::Error> { let conn = Connection::new_session()?; // Create a match rule to filter for notification signals let match_rule = MatchRule::new_signal() .interface("org.freedesktop.Notifications") .member("Notify") .build()?; // Add the match rule to the connection conn.add_match(&match_rule)?; let stream = MessageStream::new(&conn)?; while let Some(msg) = stream.next().await? { // Extract notification data from the message // ... // Create a Notification struct let notification = Notification { // ... }; // Handle the notification println!("Received notification: {:?}", notification); } Ok(()) }