Using a direct access to /sys/class/backlight



My Debian laptop is configured with a very minimal setup, using i3 as window manager and without any graphical tool for system management.

To manage the screen brightness i choosed not using a specific command line tool: i use the script below that directly access to the backlight handler under /sys/class/backlight


[embed]https://gist.github.com/andreafortuna/6eea255e1846c894d46c4b7d8b813878[/embed]

The script allow to increase or decrease the screen brightness with a single paramether passing the variation percentage:

# brightness.sh +20 (Increase brightness by 20%)

or

# brightness.sh -20 (Decrease brightness by 20%)

Finally, i have mapped this script to the functions keys of my laptop, with this lines in ~/.i3/config

bindsym XF86MonBrightnessUp exec brightness.sh +20
bindsym XF86MonBrightnessDown exec brightness.sh -20