spectre_nixcfg/sway/chbright.sh
2025-07-03 22:26:41 -04:00

40 lines
585 B
Bash
Executable file

bright=$(brightnessctl get)
state=-1
thresh=(0
286
642
1070
1568
2138
2778
3490
4272
5126
6050
7046
8112
9250
10458
11738
13088
14510
16002
17566
19200)
# Linear
#(0 960 1920 2880 3840 4800 5760 6720 7680 8640 9600 10560 11520 12480 13440 14400 15360 16320 17280 18240 19200)
# Exponential
#(0 1 2 3 5 9 15 27 46 80 139 240 415 717 1240 2145 3710 6418 11100 19200)
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 $(brightnessctl set ${thresh[$new]})
fi