.config/i3/brightness.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#!/bin/sh
# brightness.sh: this script exists because, on my ThinkPad X1 Yoga, as the
# screen brightness _value_ increases/decreases linearly, actual brightness
# does NOT increase/decrease linearly, so I had to make a hack that would
# inc/dec the value accordingly
current_brightness="$(xbacklight -get | cut -f1 -d'.')" # convert float->int
level=2 # default level
if [ "$current_brightness" -lt "1" ]; then # brightness < 1
level=0.2
elif [ "$current_brightness" -lt "5" ]; then # brightness < 5
level=0.8
elif [ "$current_brightness" -lt "11" ]; then # brightness < 11
level=1.5
elif [ "$current_brightness" -lt "21" ]; then # brightness < 21
level=3
elif [ "$current_brightness" -lt "51" ]; then # brightness < 51
level=6
else # brightness >= 50
level=10
fi
if [ "$1" == "inc" ]; then
xbacklight -inc "$level"
elif [ "$1" == "dec" ]; then
xbacklight -dec "$level"
fi
|