spectre_nixcfg/sway/chbright.sh

17 lines
338 B
Bash
Raw Normal View History

2025-06-23 02:28:32 -04:00
bright=$(brightnessctl get)
2025-06-17 03:42:31 -04:00
state=-1
2025-06-23 02:28:32 -04:00
thresh=(0 1 2 3 5 9 15 27 46 80 139 240 415 717 1240 2145 3710 6418 11100 19200)
2025-06-17 03:42:31 -04:00
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
2025-06-23 02:28:32 -04:00
echo $(brightnessctl set ${thresh[$new]})
2025-06-17 03:42:31 -04:00
fi