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:

  1. Explicit echo:

    • The awk output is wrapped in echo to ensure it properly sends the result to $WOBSOCK.
    • This avoids any issue with && chaining interfering with the awk output.
  2. Ensure Sequential Execution:

    • The wpctl command adjusts the volume or mute state.
    • The awk command fetches the current volume and outputs it to wob.

Behavior:

  • Raise Volume: XF86AudioRaiseVolume will increment the volume by 5% and display it in wob.
  • Lower Volume: XF86AudioLowerVolume will decrement the volume by 5% and display it in wob.
  • Mute/Unmute: XF86AudioMute toggles mute and shows 0 in wob when muted or the current volume percentage when unmuted.