bindsym --locked XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ && echo $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf "%.0f", $2*100}') > $WOBSOCK
bindsym --locked XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && echo $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{printf "%.0f", $2*100}') > $WOBSOCK
bindsym --locked XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && echo $(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{if ($3 == "[MUTED]") print 0; else printf "%.0f", $2*100}') > $WOBSOCK
Key Changes:
Explicit
echo
:- The
awk
output is wrapped inecho
to ensure it properly sends the result to$WOBSOCK
. - This avoids any issue with
&&
chaining interfering with theawk
output.
- The
Ensure Sequential Execution:
- The
wpctl
command adjusts the volume or mute state. - The
awk
command fetches the current volume and outputs it towob
.
- The
Behavior:
- Raise Volume:
XF86AudioRaiseVolume
will increment the volume by 5% and display it inwob
. - Lower Volume:
XF86AudioLowerVolume
will decrement the volume by 5% and display it inwob
. - Mute/Unmute:
XF86AudioMute
toggles mute and shows0
inwob
when muted or the current volume percentage when unmuted.