Listen for changed spotify properties
[xsetrootd.git] / src / main.rs
1 use dbus::blocking::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged;
2 use dbus::blocking::Connection;
3 use dbus::message::Message;
4 use std::time::Duration;
5
6 fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let conn = Connection::new_session()?;
8
9 let proxy = conn.with_proxy(
10 "org.mpris.MediaPlayer2.spotify",
11 "/org/mpris/MediaPlayer2",
12 Duration::from_millis(5000),
13 );
14
15 let _ = proxy.match_signal(
16 |pc: PropertiesPropertiesChanged, _: &Connection, _: &Message| {
17 println! {"dumping {:#x?}", pc.changed_properties["Metadata"]};
18 true
19 },
20 );
21
22 loop {
23 conn.process(Duration::from_millis(1000))?;
24 }
25 }