volume-control (1283B)
1 #!/bin/sh 2 3 # Taken from: https://github.com/salanpro/hyprland/tree/047f998e710b0ffe8d841a89fb7749b50c931b2c/.config/hypr/scripts 4 5 # Volume up and down 6 if [[ "$1" == "up" ]]; then 7 wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ \ 8 && wpctl get-volume @DEFAULT_AUDIO_SINK@ | \ 9 awk '{print int($2*100)}' | xargs -I[] \ 10 notify-send -e -u low -h string:x-canonical-private-synchronous:volume_notif -h \ 11 int:value:[] " Volume []" 12 elif [[ "$1" == "down" ]]; then 13 wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%- \ 14 && wpctl get-volume @DEFAULT_AUDIO_SINK@ | \ 15 awk '{print int($2*100)}' | xargs -I[] \ 16 notify-send -e -u low -h string:x-canonical-private-synchronous:volume_notif -h \ 17 int:value:[] " Volume []" 18 elif [[ "$1" == "mute" ]]; then 19 wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle \ 20 && (wpctl get-volume @DEFAULT_AUDIO_SINK@ \ 21 | grep -q MUTED && \ 22 notify-send -e -u low -h \ 23 string:x-canonical-private-synchronous:volume_notif \ 24 " Muted" || wpctl get-volume @DEFAULT_AUDIO_SINK@ | \ 25 awk '{print int($2*100)}' | xargs -I[] \ 26 notify-send -e -u low -h string:x-canonical-private-synchronous:volume_notif -h \ 27 int:value:[] " Volume []") 28 fi