diff --git a/os/arch/.config/panel/scripts/parse.sh b/os/arch/.config/panel/scripts/parse.sh index a3c07bb8..1565beaa 100755 --- a/os/arch/.config/panel/scripts/parse.sh +++ b/os/arch/.config/panel/scripts/parse.sh @@ -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 diff --git a/os/arch/bin/panel_notify.sh b/os/arch/bin/panel_notify.sh index f1abb999..47b8590b 100755 --- a/os/arch/bin/panel_notify.sh +++ b/os/arch/bin/panel_notify.sh @@ -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" & diff --git a/os/arch/bin/volume.sh b/os/arch/bin/volume.sh index bf536fe4..879915e0 100755 --- a/os/arch/bin/volume.sh +++ b/os/arch/bin/volume.sh @@ -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