Show mic volume on statusbar.

This commit is contained in:
Bartek Stalewski 2022-02-20 03:24:37 +01:00
parent a58960169f
commit 07bcbdd8d3
2 changed files with 7 additions and 5 deletions

View File

@ -17,10 +17,12 @@ else
volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}')
micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
if [ "$volmute" = yes ] && [ "$micmute" = yes ]; then
printf "^c#161616^^b#fd4285^\ue02b mute \ue04f mute^d^"
printf "^c#161616^^b#fd4285^mute \ue02b mute \ue04f^d^"
elif [ "$vol" -eq 0 ] && [ "$mic" -eq 0 ]; then
printf "^c#161616^^b#fd4285^mute \ue02b mute \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="${mic}%% \ue029"
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && volinfo="^c#161616^^b#fd4285^mute \ue04f^d^" || volinfo="${vol}%% \ue050"
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micinfo="^c#161616^^b#fd4285^\ue02b mute^d^" || micinfo="${mic}%% \ue029"
printf "${micinfo} ${volinfo}"
fi
fi

View File

@ -143,8 +143,8 @@ static Key keys[] = {
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sb-volume micmute") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("doas xbacklight -inc 10") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("doas xbacklight -dec 10") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("pactl set-source-volume @DEFAULT_SOURCE@ +5%; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("pactl set-source-volume @DEFAULT_SOURCE@ -5%; kill -46 $(pidof dwmblocks)") },
};
/* button definitions */