From e4f59517b0ceda839d3491bc189c0ec9aa52152a Mon Sep 17 00:00:00 2001 From: Yigid BALABAN Date: Sun, 8 Sep 2024 22:47:23 +0300 Subject: [PATCH] please don't stop the music --- pdstm.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pdstm.rs diff --git a/pdstm.rs b/pdstm.rs new file mode 100644 index 0000000..2011034 --- /dev/null +++ b/pdstm.rs @@ -0,0 +1,34 @@ +// +// yigid balaban 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!(); + } + } +}