spectre_nixcfg/sway/chbright.sh

17 lines
382 B
Bash
Raw Normal View History

2025-06-17 03:42:31 -04:00
bright=`cat /sys/class/backlight/amdgpu_bl1/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_bl1/brightness
fi