aboutsummaryrefslogtreecommitdiff
path: root/src/sound.rs
blob: 7a7ce639d201958719718b328817c49d969fdfc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
}