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
awkoutput is wrapped inechoto ensure it properly sends the result to$WOBSOCK. - This avoids any issue with
&&chaining interfering with theawkoutput.
- The
Ensure Sequential Execution:
- The
wpctlcommand adjusts the volume or mute state. - The
awkcommand fetches the current volume and outputs it towob.
- The
Behavior:
- Raise Volume:
XF86AudioRaiseVolumewill increment the volume by 5% and display it inwob. - Lower Volume:
XF86AudioLowerVolumewill decrement the volume by 5% and display it inwob. - Mute/Unmute:
XF86AudioMutetoggles mute and shows0inwobwhen muted or the current volume percentage when unmuted.