Fix incorrect volume state display and panel_notify.sh
This commit is contained in:
parent
8c953a87b3
commit
90126c016f
|
@ -115,6 +115,7 @@ 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}"
|
||||||
|
|
|
@ -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" &
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue