Control screen backlight brightness from the command line

I have a Dell Latitude E5430 running Linux Mint 19 Tara. In Cinnamon, my function keys for brightness work correctly, but that was not the case with i3wm session. My first bet was to bind shortcuts executing xbacklight command but it doesn’t work because of this bug. So, I started to research for workaround and I found brightlight – “a program that can get and
set the screen backlight brightness on Linux systems using the kernel sysfs
interface.”. Sounds perfect but there are no prebuild binaries so you need to do it by yourself. The following steps are short guide how to build and install brightlight on Ubuntu and Ubuntu derivatives.

1) Install needed build tools

sudo apt install libc6-dev libbsd-dev

2) Compile

cd ~/Downloads
git clone https://github.com/multiplexd/brightlight.git
cd brightlight
make

3) Use SUID in order to run executable without sudo from every system user

sudo chown root ./brightlight
sudo chmod u+s ./brightlight
sudo mv ./brightlight /usr/share/bin

… and finally add key bindings in your ~/.config/i3/config file:

# increase screen brightness 10% up
bindsym XF86MonBrightnessUp exec brightlight -p -i 10 
# decrease screen brightness 10% down
bindsym XF86MonBrightnessDown exec brightlight -p -d 10 

Leave a Reply

Your email address will not be published. Required fields are marked *