diff options
| author | Camil Staps | 2016-02-09 15:42:12 +0100 | 
|---|---|---|
| committer | Camil Staps | 2016-11-30 19:11:06 +0100 | 
| commit | b2348fe0ef6dc5af4f7815bf852ae722f12f044d (patch) | |
| tree | 86ff4e9385abc0cc9223567ecc9b0f6639c2496e /bin/volume | |
| parent | Keyboard layout; volume in xmobar (diff) | |
Improved volume in status bar (recognises mute)
Diffstat (limited to 'bin/volume')
| -rwxr-xr-x | bin/volume | 19 | 
1 files changed, 12 insertions, 7 deletions
| @@ -1,8 +1,13 @@  #!/bin/bash -volumes=$(amixer get Master |grep % |awk '{print $5}'|sed 's/[^0-9]//g') -#avg=$(awk '{ print ($1+$2)/2 }' <(echo $volumes)) -if [[ $1 == 'L' ]]; then -    echo "$(echo $volumes | cut -d' ' -f1)%" -else -    echo "$(echo $volumes | cut -d' ' -f2)%" -fi +outputs=(Left Right) +i=1 +for o in ${outputs[@]}; do +    vol=$(amixer get Master |grep "$o" |grep %) +    if [[ "$vol" == *"off"* ]]; then +        volumes[$i]="M" +    else +        volumes[$i]=$(echo $vol |awk '{print $5}'|sed 's/[^0-9%]//g') +    fi +    let i=i+1 +done +echo ${volumes[*]} | 
