I'm running Ubuntu 16.04 on a System76 laptop. The brightness controls (i.e. Fn+F8 and Fn+F9) work great in Unity/Compiz/Gnome/whatever is default, but when I change to using i3wm instead I get... nothing.
Under the default, xev reports something different. With i3 it reports XF86MonBrightnessUp
and XF86MonBrightnessDown
, which would be pretty cool if xbacklight worked, but it doesn't. It just has zero effect.
wayne@waynego:~$ xbacklight -set 10
wayne@waynego:~$ echo $?
0
And my monitor is still as bright/dark as it was before.
The only thing that I've been able to get to work is this:
sudo sh -c "cat /sys/class/backlight/intel_backlight/max_brightness > /sys/class/backlight/intel_backlight/brightness"
Which you can probably agree is not ideal - cause I have to involve sudo, I mean I could gksudo
or something but that's annoying, too. Clearly something works right with compiz/unity... I just don't know what it's doing.
Is there some way to get xbacklight to work, or some alternative? I'd prefer not to have to run sudo to change my backlight settings.
Following the instructions that I found on https://itsfoss.com/fix-brightness-ubuntu-1310/ combined with what I already knew, that I had an Intel card, I did
In that file I put the following:
And now I can use xbacklight, as mreq mentions:
I added the following to my
~/.config/i3/config
The best part here is that I can actually turn my backlight all the way off, so if I wanted to use my computer as a dream journal like Adam Savage does, I totally could.
I ran into an issue upon a fresh installation of
i3wm
on my laptop where, for whatever reason, myXF86MonBrightnessUp/Down
keys weren't being registered (I checked withxev
). What I ended up doing is creatingacpi
actions and events which corresponded to the keys being pressed.The following are the actions/events I defined in
/etc/acpi/actions
and/etc/acpi/events
, respectively:Actions
/etc/acpi/actions/bl-down.sh
/etc/acpi/actions/bl-up.sh
Events
/etc/acpi/events/bl-down
/etc/acpi/events/bl-up
You can verify your brightnessup/down acpi event codes by using
acpi_listen
in your terminal and then pressing the relevant key combination (e.g., for me, it's Fn + Down Arrow for brightness down).Finally, don't forget to restart
acpid
withsudo /etc/init.d/acpid reload
Note: Your backlight device may be defined in a different location than
/sys/class/backlight/acpi_video0
- that's just where mine happened to be. Do some poking around.I also wrote in a little function in my
~/.bashrc
that let's me set the brightness from the terminal. My max brightness value is 24000, so I'm just multiplying a number from 0 to 10 by 2400. It's nice when I want to dim or brighten my screen instantly.(Also, out of curiosity, which System76 machine did you get, and how do you like it? I was considering buying one a while back.)
The simplest solution github/particleofmass:
Note: I am the author of this code.
I found this, it might help :)
https://itsfoss.com/fix-brightness-ubuntu-1310/