Iteration order can cause the xsetroot command to be updated with only
one or the other value at times, which remains incorrect until after
another update call such as from the clock or mail listeners.
let clone_arc = arc_map.clone();
let mut map = clone_arc.lock().unwrap();
map.insert(String::from(key), String::from(val));
let clone_arc = arc_map.clone();
let mut map = clone_arc.lock().unwrap();
map.insert(String::from(key), String::from(val));
+}
+
+fn update_xsetroot(arc_map: Arc<Mutex<HashMap<String, String>>>) {
+ let clone_arc = arc_map.clone();
+ let map = clone_arc.lock().unwrap();
let _ = Command::new("xsetroot")
.arg("-name")
.arg(format!(
let _ = Command::new("xsetroot")
.arg("-name")
.arg(format!(
"unread_count",
m.count.to_string().as_str(),
);
"unread_count",
m.count.to_string().as_str(),
);
+ update_xsetroot(mail_match_map.clone());
+ update_xsetroot(spotify_match_map.clone());
+ update_xsetroot(spotify_match_map.clone());
"date_time",
get_local_time_string().as_str(),
);
"date_time",
get_local_time_string().as_str(),
);
+ update_xsetroot(date_time_map.clone());
}
thread::sleep(Duration::from_millis(5000));
}
}
thread::sleep(Duration::from_millis(5000));
}