flake/flakes/home-manager/guanranwang/common/dotfiles/bin/wrapped-pamixer

33 lines
964 B
Text
Raw Normal View History

2023-09-19 00:17:43 +00:00
#!/bin/sh
# Original Script: https://github.com/ericmurphyxyz/dotfiles/blob/master/.local/bin/changebrightness
# Increment, decrement, or mute the volume and send a notification
# of the current volume level.
case $1 in
down)
# Set the volume on (if it was muted)
pamixer -u
pamixer -d 5 # --allow-boost
volume=$(pamixer --get-volume)
dunstify -a "changevolume" -u low -r 9993 -h int:value:"$volume" -i "volume-minus" "Volume: ${volume}%" -t 2000
;;
up)
pamixer -u
pamixer -i 5 # --allow-boost
volume=$(pamixer --get-volume)
dunstify -a "changevolume" -u low -r 9993 -h int:value:"$volume" -i "volume-plus" "Volume: ${volume}%" -t 2000
;;
mute)
pamixer -t
if eval "$(pamixer --get-mute)"; then
dunstify -a "changevolume" -u low -r 9993 -u low -i "volume-mute" "Muted" -t 2000
else
volume=$(pamixer --get-volume)
dunstify -a "changevolume" -u low -r 9993 -h int:value:"$volume" -i "volume-high" "Volume: ${volume}%" -t 2000
fi
;;
esac