//use zbus::blocking::Connection; use zbus::Connection; use zbus::fdo::Result; use zbus::Message; use zbus::MatchRule; use zbus::blocking::Proxy; use zbus::MessageStream; //use futures_util::stream::TryStreamExt; fn main() -> Result<()> { // Establish a connection to the session bus let connection = Connection::session()?; // Proxy let prox = Proxy::new( &connection, "org.freedesktop.Notifications", // Service/Bus name "/org/freedesktop/Notifications", // Object path "org.freedesktop.Notifications", // Interface name )?; // Define a match rule for the notifications let match_rule = MatchRule::builder() .msg_type(zbus::MessageType::Signal) .interface("org.freedesktop.Notifications")? .path("/org/freedesktop/Notifications")? .build(); // Add the match rule to the connection //connection.add_match(match_rule)?; let mut stream = MessageStream::from(connection); while let Some(msg) = stream.body? { println!("Got message: {}", msg); } // Process notifications /*loop { /* let message = connection.receive_signal()?; if let Some(member) = message.member() { if member.as_str() == "Notify" { println!("Received a notification: {:?}", message); } } */ }*/ Ok(()) }