aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com>2020-12-27 07:17:42 +0300
committerGitHub <noreply@github.com>2020-12-27 07:17:42 +0300
commit0356280b0afb851a313bf2986d15282174626f12 (patch)
tree70ae70ab95836e1c38284633ecdf527b4e622180 /src
parent330e95ed1a9451d4ea23095ff9c5debeaa3943d7 (diff)
parent2953691b9bd5afe6bc3e7193d1ee29bf297e0134 (diff)
Merge pull request #7 from MustafaSalih1993/dev
fixed the volume to run on arch based
Diffstat (limited to 'src')
-rw-r--r--src/sound.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sound.rs b/src/sound.rs
index 7a7ce63..a37382e 100644
--- a/src/sound.rs
+++ b/src/sound.rs
@@ -11,14 +11,15 @@ pub fn get_sound(setting: &Settings) -> String {
.output()
.unwrap();
- let vol: String = String::from_utf8_lossy(&cmd_content.stdout)
- .split('\n')
- .collect::<Vec<&str>>()[4]
+ let mut 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)
}