flake/pkgs/scripts/_bin/wrapped-pamixer

32 lines
974 B
Bash
Executable file

#!/usr/bin/env bash
# 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