dotfiles/.local/bin/scripts/backlight
2025-07-20 12:57:27 -04:00

23 lines
629 B
Bash
Executable file

#!/bin/sh
# Get the current brightness percentage from brightnessctl -m output
get_brightness() {
brightnessctl -m | awk -F, '{gsub(/%/,"",$4); print $4}'
}
case "$1" in
up)
brightnessctl set 5%+ >/dev/null
brightness=$(get_brightness)
dunstify -a "Backlight" -r 9994 -h int:value:"$brightness" -i "brightness" "Brightness" "Currently at $brightness%" -t 1000
;;
down)
brightnessctl set 5%- >/dev/null
brightness=$(get_brightness)
dunstify -a "Backlight" -r 9994 -h int:value:"$brightness" -i "brightness" "Brightness" "Currently at $brightness%" -t 1000
;;
*)
echo "Usage: $0 {up|down}"
exit 1
;;
esac