projects
/
xsetrootd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prevent small race when both track and artist change
[xsetrootd.git]
/
src
/
main.rs
diff --git
a/src/main.rs
b/src/main.rs
index
d6beac7
..
d2d1df2
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-51,6
+51,11
@@
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));
+}
+
+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!(
@@
-82,6
+87,7
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
"unread_count",
m.count.to_string().as_str(),
);
"unread_count",
m.count.to_string().as_str(),
);
+ update_xsetroot(mail_match_map.clone());
true
},
);
true
},
);
@@
-119,6
+125,7
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
_ => (),
}
}
_ => (),
}
}
+ update_xsetroot(spotify_match_map.clone());
Some(())
});
}
Some(())
});
}
@@
-135,6
+142,7
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
_ => "🔈",
},
);
_ => "🔈",
},
);
+ update_xsetroot(spotify_match_map.clone());
}
None => (),
}
}
None => (),
}
@@
-155,6
+163,7
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
"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));
}