diff options
-rwxr-xr-x | bin/volume | 19 | ||||
-rw-r--r-- | system/xmobarrc.symlink | 5 |
2 files changed, 14 insertions, 10 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[*]} diff --git a/system/xmobarrc.symlink b/system/xmobarrc.symlink index 3aeec5d..778a890 100644 --- a/system/xmobarrc.symlink +++ b/system/xmobarrc.symlink @@ -10,8 +10,7 @@ Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*" , Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10 , Run Com "wireless-status" ["wlan0"] "wlan0stat" 10 , Run Battery ["--normal","red","--high","green","-t","<left>% (<timeleft>)"] 150 - , Run Com "volume" ["L"] "vol-l" 10 - , Run Com "volume" ["R"] "vol-r" 10 + , Run Com "volume" [] "volume" 10 , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10 , Run Memory ["-t","Mem: <usedratio>%"] 10 , Run Swap [] 10 @@ -24,6 +23,6 @@ Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*" ] , sepChar = "%" , alignSep = "}{" - , template = "%StdinReader% | %battery% | %vol-l% %vol-r% | %cpu% | %memory% * %swap% | %eth0% - %wlan0% %wlan0stat% }{<fc=#ee9a00>%date%</fc> | %uname% | %kbd% | %EHSB% " + , template = "%StdinReader% | %battery% | %volume% | %cpu% | %memory% * %swap% | %eth0% - %wlan0% %wlan0stat% }{<fc=#ee9a00>%date%</fc> | %uname% | %kbd% | %EHSB% " } -- vim:ft=haskell:tw=9999: |