I’m very pleased with i3wm, but day by day I need to adjust something. At this time, on my new laptop the brightness hardware keys don’t work as expected.
The issue on the Lenovo Thinkpad with Fedora 26 is the same on the Acer ES1-111 with Ubuntu 17.04. At the bottom of i3wm, we found respectively the GNOME and the Unity windows manager. On both GNOME3 and Unity7, the hardware brightness keys work fine.
So, the problem is with i3wm only.
<figure class=”wp-caption alignleft” id=”attachment_417″ style=”width: 790px”><figcaption class=”wp-caption-text”>Light. A GNU/Linux application to control backlights</figcaption></figure>
Many solutions. Changing the brightness
Looking into the infinite knowledge of Google, I found a lot of solutions.
The issue is set by the xbacklight command, I tested it and it doesn’t work also from a terminal session. So, the following lines don’t work.
# Screen brightness controls bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness
The most part of the solutions that I found, planned to make some scripts, changing the brightness with some bash commands:
$ sudo echo VALUE > /sys/class/backlight/intel_backlight/brightness
And save the script in some place, maybe in user bin folder or something in your PATH. Then, call the script from your i3wm .config file. To run the script, it needs super user (sudo) privileges and so you must just give it to the root user to launch it from the configuration file.
Anyway, I preferred a different approach. I found an alternative to xbacklight command, a GNU/Linux application to control backlights called simply light. You can find light over GitHub.
light is packed only for Arch Linux and you can found only packages for this distribution. Luckily, light is really lightweight and easy-easy to compile on every other distribution.
So, just download or clone the source of light:
$ git clone https://github.com/haikarainen/light.git
Compile and install it:
$ sudo make $ sudo make install
On Fedora 26 and Ubuntu 17.04 all went fine. You can check it:
$ light --help
And, finally, replace the lines of code in the i3wm .config file:
# Screen brightness controls # bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness # bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
Source From: fedoraplanet.org.
Original article title: Luca Ciavatta: Brightness control doesn’t work in i3wm.
This full article can be read at: Luca Ciavatta: Brightness control doesn’t work in i3wm.