nix-dotfiles/scripts/changebrightness.sh

17 lines
382 B
Bash

bright=`cat /sys/class/backlight/amdgpu_bl0/brightness`
state=-1
thresh=(1 2 3 4 5 6 8 10 13 16 21 27 34 44 57 73 94 120 155 199 255)
for i in ${!thresh[@]}; do
if [ $bright -ge ${thresh[$i]} ]
then
state=$i
fi
done
new=$(($1 + $state))
if [ $new -ge 0 ] && [ $new -le 20 ]
then
echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness
fi