projects
/
xsetrootd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
12bd87b
)
Spawn xsetroot command on value update
author
Jacob Casper
<dev@jacobcasper.com>
Fri, 30 Oct 2020 23:07:37 +0000
(18:07 -0500)
committer
Jacob Casper
<dev@jacobcasper.com>
Fri, 6 Nov 2020 22:36:34 +0000
(16:36 -0600)
src/main.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/main.rs
b/src/main.rs
index
0aaba48
..
a5b3c32
100644
(file)
--- 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 dbus::blocking::Connection;
use dbus::message::Message;
use std::collections::HashMap;
+use std::process::Command;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use std::sync::{Arc, Mutex};
use std::time::Duration;
@@
-36,9
+37,15
@@
fn update_map(arc_map: Arc<Mutex<HashMap<String, String>>>, 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));
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<dyn std::error::Error>> {
}
fn main() -> Result<(), Box<dyn std::error::Error>> {