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
hacklightin a path you OS will find it. (See here). Something like e.g/usr/sbin/hacklight -
Edit
hacklightto 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
hacklightasrootwithout password. To do this runsudo visudo, and append the line giving the correct permissions. See thesudoersfile for an example, and also the man which has examples near the end. -
Add the contents of
i3configto youri3config 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
hacklightto change the value of the variablebrightness_fileto the appropriate path. -
Put
hacklightin a path you OS will find it. (See here) -
Add the contents of
i3configto youri3config file (likely found at.config/i3/config). Removesudoin front of each command.