My hardware supports full 256 steps of screen brightness. Unfortunately Ubuntu's default brightness driver uses wrong steps: I need to increase granularity of steps in the dark end of the spectrum, and decrease on the bright end.
The following script bright.sh
demonstrates how I'd like the brightness to be handled:
#/bin/bash
sciezka="/sys/class/backlight/intel_backlight"
if [ "$1" == "+" ]; then
maxbright=`cat $sciezka/max_brightness`
bright=`cat $sciezka/brightness`
bright=`echo "print(int(min($maxbright,$bright + max($bright * 0.5, 1))))" | python`
else
if [ "$1" == "-" ]; then
bright=`cat $sciezka/brightness`
bright=`echo "print(int(max(0,$bright - max($bright * 0.33, 1))))" | python`
fi
fi
echo $bright | sudo tee $sciezka/brightness
How do I replace the XF86KbdBrightnessDown
and XF86KbdBrightnessUp
handler with my custom one? I'd like to keep this cool OSD slider, but use my logic for the actual brightness adjustment.