X-Git-Url: https://git.jacobcasper.com/?p=xsetrootd.git;a=blobdiff_plain;f=src%2Fmain.rs;fp=src%2Fmain.rs;h=a5b3c32f36ff81ef69710abab028b8bf37619ef3;hp=0aaba48855bd66e8b7c99e7b6b8d752c30cf9a7e;hb=42fef3a7dd68fc6bf8f1ad8a0602bd5e4fef4482;hpb=12bd87b05d1169761be06713f9e56b967b4e029a diff --git a/src/main.rs b/src/main.rs index 0aaba48..a5b3c32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use dbus::blocking::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged; use dbus::blocking::Connection; use dbus::message::Message; use std::collections::HashMap; +use std::process::Command; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -36,9 +37,15 @@ fn update_map(arc_map: Arc>>, key: &str, val: &str let clone_arc = arc_map.clone(); let mut map = clone_arc.lock().unwrap(); map.insert(String::from(key), String::from(val)); - for (k, v) in &*map { - println! {"{}: {}", k.clone(), v.clone()}; - } + let _ = Command::new("xsetroot") + .arg("-name") + .arg(format!( + "[🔊 {title} - {artist}] | ✉ {unread_count}", + title = map.get("title").unwrap_or(&String::from("")), + artist = map.get("artist").unwrap_or(&String::from("")), + unread_count = map.get("unread_count").unwrap_or(&String::from("?")), + )) + .spawn(); } fn main() -> Result<(), Box> {