dotfiles/i3/backlight.sh
M1dgard 55c3bbd7c9
Up backlight FPS
42 is too low. 60 is much better.
2018-05-29 12:26:09 +02:00

25 lines
652 B
Bash
Executable file

#!/bin/bash
# Don't start a new transition if the previous one isn't done yet
pgrep -u $UID -x xbacklight >/dev/null && exit
# Calculate new target brightness
current_brightness=$(xbacklight -get)
case $1 in
up)
target=$((current_brightness * 15 / 10))
[ $target -ne $current_brightness ] || target=$((target + 1))
;;
down)
target=$((current_brightness * 10 / 15))
[ $target -ne $current_brightness ] || target=$((target - 1))
;;
esac
# Boundaries: can't go higher than 100% or lower than 1%
[ $target -le 1 ] && target=1
[ $target -ge 100 ] && target=100
# Smoothly set the new brightness
xbacklight -time 100 -fps 60 -set $target