1 #!/bin/bash 2 3 # amount=$(echo "$1" | cut -d " " -f 2) 4 send_notification() { 5 # dunstify -r 13123 -h "int:value:$1" "$2 Volume ($1%)" -t 2000 6 dunstify -r 13123 "$2 Volume $1%" -t 1750 7 } 8 9 get_icon() { 10 if [ "$curr" -gt "50" ]; then 11 icon="🔊" 12 elif [ "$curr" -eq "0" ]; then 13 icon="🔇" 14 elif [ "$curr" -lt "25" ]; then 15 icon="🔈" 16 else 17 icon="🔉" 18 fi 19 } 20 21 pactl set-sink-mute @DEFAULT_SINK@ toggle; 22 23 if [ "$(pamixer --get-mute)" == "false" ]; then 24 curr=$(pamixer --get-volume) 25 get_icon $icon 26 send_notification $curr $icon 27 else 28 send_notification "0" "🔇" 29 fi 30 31 kill -35 $(pidof dwmblocks) 32 33 # min=$((0 + $amount)) 34 # max=$((100 - $amount)) 35 36 # (($curr<=$max)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount%) 37 38 # [ $curr -ne $min ] && [ $curr -ne $max ] && curr=$(($curr + $amount)) 39 40 # send_notification $curr $icon