please don't stop the music

This commit is contained in:
yigid balaban 2024-09-08 22:47:23 +03:00
parent 71c3ca3721
commit e4f59517b0
Signed by: fyb
GPG Key ID: E21FEB2C244CB7EB

34
pdstm.rs Normal file
View File

@ -0,0 +1,34 @@
//
// yigid balaban <fyb@fybx.dev> 2024
// please don't stop the music
//
// description
// this fella won't let the music stop! depends on playerctl
// rustc pdstm.rs
// use bash: while true; ./pdstm; sleep 1; done
use std::process::Command;
macro_rules! noop {
() => ();
}
fn main() {
let output = Command::new("playerctl")
.arg("status")
.output()
.expect("err: call playerctl status");
let status = String::from_utf8_lossy(&output.stdout);
match status.trim() {
"Paused" => {
let _ = Command::new("playerctl")
.arg("play")
.output();
}
_ => {
noop!();
}
}
}