Fix dwm's crash when both mic and speaker were muted.

This commit is contained in:
Bartek Stalewski 2022-02-20 03:09:18 +01:00
parent 38636e2196
commit bbac22c95e

View file

@ -13,7 +13,13 @@ if [ "${1}" = "micmute" ]; then
kill -46 $(pidof dwmblocks) kill -46 $(pidof dwmblocks)
else else
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%') vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] && volinfo="^c#161616^^b#fd4285^\ue04f mute^d^" || volinfo="\ue050 ${vol}%%" volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] && micinfo="^c#161616^^b#fd4285^\ue02b mute^d^" || micinfo="" micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
printf "${micinfo} ${volinfo}" if [ "$volmute" = yes ] && [ "$micmute" = yes ]; then
printf "^c#161616^^b#fd4285^\ue02b + \ue04f^d^"
else
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] && volinfo="^c#161616^^b#fd4285^mute \ue04f^d^" || volinfo="${vol}%% \ue050"
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] && micinfo="^c#161616^^b#fd4285^\ue02b mute^d^" || micinfo=""
printf "${micinfo} ${volinfo}"
fi
fi fi