Merge pull request #7 from MustafaSalih1993/dev

fixed the volume to run on arch based
This commit is contained in:
Mustafa Salih 2020-12-27 07:17:42 +03:00 committed by GitHub
commit 0356280b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}