projects
/
xsetrootd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bbc46eb
)
Display current playback status
author
Jacob Casper
<dev@jacobcasper.com>
Fri, 6 Nov 2020 23:16:23 +0000
(17:16 -0600)
committer
Jacob Casper
<dev@jacobcasper.com>
Fri, 6 Nov 2020 23:16:23 +0000
(17:16 -0600)
src/main.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/main.rs
b/src/main.rs
index
4aec86b
..
e128efe
100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-54,7
+54,8
@@
fn update_map(arc_map: Arc<Mutex<HashMap<String, String>>>, key: &str, val: &str
let _ = Command::new("xsetroot")
.arg("-name")
.arg(format!(
let _ = Command::new("xsetroot")
.arg("-name")
.arg(format!(
- "[🔊 {title} - {artist}] | ✉ {unread_count} | {date_time}",
+ "[{playback_status} {title} - {artist}] | ✉ {unread_count} | {date_time}",
+ playback_status = map.get("playback-status").unwrap_or(&String::from("🔈")),
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("?")),
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("?")),
@@
-120,6
+121,15
@@
fn main() -> Result<(), Box<dyn std::error::Error>> {
}
Some(())
});
}
Some(())
});
+ let playback_status = &pc.changed_properties["PlaybackStatus"].0;
+ update_map(
+ spotify_match_map.clone(),
+ "playback_status",
+ match &*playback_status.as_str().unwrap_or("🔈") {
+ "Playing" => "🔊",
+ _ => "🔈",
+ },
+ );
true
},
);
true
},
);