nix-dotfiles/wayland/changebrightness.sh
vorboyvo 770b7d23e9 Changed a bunch of packages installed through home manager
Added brightness and volume scripts to bind to media keys. Still imperfect
Refactored to put neovim in its own file, will do the same for others
2024-01-15 14:11:14 -05:00

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