This commit is contained in:
2025-09-28 17:33:28 +03:00
commit c2596fb0ad
4 changed files with 45 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
use std::{
env::{self, args},
process::Command,
thread::sleep,
time::Duration,
};
fn main() {
let args: Vec<String> = args().collect();
let timeout_secs: u64 = args.get(1)
.expect("There should be 1 argument, which specifies amount of time (in seconds) for timer to work!")
.parse()
.expect("The first argument should be a non-negative number");
let home = env::var("HOME").unwrap();
sleep(Duration::from_secs(timeout_secs));
let mut sound_alert = Command::new("pw-play")
.arg(format!("{home}/Music/not_sussy_song.opus"))
.spawn()
.expect("pw-play utility should be installed");
let _ = Command::new("zenity")
.args(["--warning", "--text=Take a break from computer!"])
.spawn()
.unwrap()
.wait();
sound_alert.kill().unwrap();
}