aboutsummaryrefslogtreecommitdiff
path: root/src/sound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.rs')
-rw-r--r--src/sound.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sound.rs b/src/sound.rs
new file mode 100644
index 0000000..7a7ce63
--- /dev/null
+++ b/src/sound.rs
@@ -0,0 +1,24 @@
+use crate::load_config::Settings;
+use std::process::Command;
+
+// TODO: what a horrible solution to get the sound, i dont like it
+// find another way you dumb fuck
+
+pub fn get_sound(setting: &Settings) -> String {
+ let cmd_content = Command::new("amixer")
+ .arg("get")
+ .arg("Master")
+ .output()
+ .unwrap();
+
+ let vol: String = String::from_utf8_lossy(&cmd_content.stdout)
+ .split('\n')
+ .collect::<Vec<&str>>()[4]
+ .split('[')
+ .collect::<Vec<&str>>()[1]
+ .split(']')
+ .collect::<Vec<&str>>()[0]
+ .to_string();
+
+ format!(" {} {} {}", setting.volume.icon, vol, setting.seperator)
+}