Fix incorrect volume state display and panel_notify.sh

This commit is contained in:
Henrik Lissner 2016-10-22 14:04:50 +02:00
parent 8c953a87b3
commit 90126c016f
3 changed files with 15 additions and 8 deletions

View file

@ -115,7 +115,8 @@ do
*) vol="\ue203" *) vol="\ue203"
;; ;;
esac esac
vol="%{A:volume.sh toggle:} $vol %{A}"
;; ;;
esac esac
echo -e "%{l}${wm}${playing}%{r}${mail} ${wifi} ${date} ${clock} ${bt}${vol} " echo -e "%{l}${wm}${playing}%{r}${mail} ${wifi} ${date} ${clock} ${bt}${vol}"
done done

View file

@ -1,8 +1,11 @@
#!/usr/bin/bash #!/usr/bin/bash
pgrep panel.sh >/dev/null || exit
FIFO=/tmp/panel-fifo FIFO=/tmp/panel-fifo
[[ -f $FIFO ]] || exit if [[ ! -p $FIFO ]]
echo "$@" > "/tmp/panel-fifo" then
>&2 echo "FIFO not initialized"
exit
fi
echo "$@" > "$FIFO" &

View file

@ -2,7 +2,10 @@
if [[ $# == 0 ]] if [[ $# == 0 ]]
then then
echo "$(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)" data=$(amixer get Master)
vol=$(echo "$data" | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)
state=$(echo "$data" | grep '\[on\]')
[[ $state ]] && echo $vol || echo 0
exit exit
fi fi
@ -22,5 +25,5 @@ if amixer get Master | grep '\[off\]' >/dev/null
then then
panel_notify.sh "V0" panel_notify.sh "V0"
else else
panel_notify.sh "V$(amixer get Master | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)" panel_notify.sh "V$vol"
fi fi