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

@ -112,10 +112,11 @@ do
0|off)
vol="%{F$COLOR_FREE_FG}\ue202%{F-}"
;;
*) vol="\ue203"
*) vol="\ue203"
;;
esac
vol="%{A:volume.sh toggle:} $vol %{A}"
;;
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

View file

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

View file

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