Control brightness on xubuntu when using i3wm
and where xbacklight
fails
After updating to xubuntu 18.04 I couldn't change brightness when using i3wm. These didn't seem to solve the problem.
The brightness can be controlled by a file.
For me this was /sys/class/backlight/intel_backlight/brightness
.
The script hacklight
just edits this file.
WARNING: Incorrect use of sudoers can be dangerous.
-
Put
hacklight
in a path you OS will find it. (See here). Something like e.g/usr/sbin/hacklight
-
Edit
hacklight
to point to brightness file by changing variablebrightness_file
(see default). -
Change the owner of this file to root e.g
sudo chown root:root /usr/sbin/hacklight
-
Let the user run
hacklight
asroot
without password. To do this runsudo visudo
, and append the line giving the correct permissions. See thesudoers
file for an example, and also the man which has examples near the end. -
Add the contents of
i3config
to youri3
config file (likely found at.config/i3/config
).
WARNING: On rebooting file owner of the brighness file seems to reset.
For this reason it seems necessary to use sudoer
to avoid having to use a password each time.
If you don't reboot often, or don't care to use sudoers
then...
- Change the owner of the brightness file to you e.g.
sudo chown ME brightness
where ME
is you.
Problem: On rebooting this seems to reset to root.
You'd have to do this every time.
-
Edit
hacklight
to change the value of the variablebrightness_file
to the appropriate path. -
Put
hacklight
in a path you OS will find it. (See here) -
Add the contents of
i3config
to youri3
config file (likely found at.config/i3/config
). Removesudo
in front of each command.