diff options
| author | mustafa salih <mustafasalih1991@gmail.com> | 2020-12-30 03:22:00 +0300 | 
|---|---|---|
| committer | mustafa salih <mustafasalih1991@gmail.com> | 2020-12-30 03:22:00 +0300 | 
| commit | dc451435ed739a0c955369980ad571ca077439ae (patch) | |
| tree | 0ea3d8b5b8e0a91886a08cd72685275be7079fd8 /src/sound.rs | |
| parent | 738802e707ca118d82b1599d945c9506970058ae (diff) | |
a little optim
Diffstat (limited to 'src/sound.rs')
| -rw-r--r-- | src/sound.rs | 10 | 
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sound.rs b/src/sound.rs index a37382e..6367cac 100644 --- a/src/sound.rs +++ b/src/sound.rs @@ -6,20 +6,20 @@ use std::process::Command;  pub fn get_sound(setting: &Settings) -> String {      let cmd_content = Command::new("amixer") -        .arg("get") -        .arg("Master") +        .args(&["-D", "pulse", "get", "Master"])          .output() -        .unwrap(); +        .expect("Make sure that you have alsa-utils installed on your system"); -    let mut vol: String = String::from_utf8_lossy(&cmd_content.stdout) +    let vol: String = String::from_utf8_lossy(&cmd_content.stdout)          .lines()          .last()          .expect("failed to get sound volume")          .split('[')          .collect::<Vec<&str>>()[1] +        .split(']') +        .collect::<Vec<&str>>()[0]          .trim()          .to_string(); -    vol.remove(vol.len() - 1);      format!("  {}  {}  {}", setting.volume.icon, vol, setting.seperator)  }  | 
