3

I'm using a Dell XPS13 on Ubuntu 18.04 and I'm able to use the screen brightness keys just fine when I'm using the default desktop environment (Unity? GNOME?). However, when I log in with i3 the keys do not adjust screen brightness anymore.

I've tried following a different guide for adding keybindings through an i3 config but it relies on using xbacklight, which when I install and use directly is unable to adjust my screen brightness.

How do I port this functionality over from the default desktop environment over to i3?

  • 1
    I don't use i3-wm but does https://cialu.net/brightness-control-not-work-i3wm/ offer you any clues? – DK Bose May 07 '18 at 03:40
  • @DKBose this is really interesting! I can build and install the light utility, but it only works when I run it as sudo. Unfortunately, binding a key combo to this does not work for me (yet) because i3wm runs as me, not as root, so all keybindings that need sudo will fail :(. How do i figure out how ubuntu's default DE adjusts brightness? – Conrad.Dean May 08 '18 at 00:16
  • @DKBose I spoke too soon, after a restart I noticed the errors I was seeing were syntax errors. After installing the built utility properly I am able to adjust brightness with it without sudo/error and so I'm able to adjust brightness.

    I still wish I understood how 18.04's default DE can do this without the light utility but whatever.

    Thank you!

    – Conrad.Dean May 08 '18 at 02:24
  • If you found a solution, please post it as an answer. It would help others with the same issue. – DK Bose May 08 '18 at 03:26
  • You helped me find one solution but I was hoping that I could reuse whatever ubuntu 18.04 comes with to adjust brightness. I'll make my question a little more focused and post a more specific question about ubuntu 18.04's internals. – Conrad.Dean May 08 '18 at 11:04

2 Answers2

3

Thanks to @DKBose for pointing me to https://cialu.net/brightness-control-not-work-i3wm/ , I was able to install an application for adjusting screen brightness and mapping the original screen brightness keys to calling it.

Start by cloning the repo locally, building, and installing it:

git clone https://github.com/haikarainen/light.git
cd light
make
sudo make install

Then add keybindings to call light and adjust screen brightness to your i3 config:

# my i3 config is at ~/.config/i3/config
# increase screen brightness with notification
bindsym XF86MonBrightnessUp exec "light -A 5; notify-send 'brightness up'"
# decrease screen brightness with notification
bindsym XF86MonBrightnessDown exec "light -U 5; notify-send 'brightness down'"

Reload your i3 config to have the changes take effect. By default this is $mod+Shift+c but look for the command reload in your config to see what this is mapped to for you.

2

This one helped me on my XPS13: Display brightness cannot be adjusted 18.04

  • changed the content of /etc/default/grub by adding video.only_lcd=0 to GRUB_CMDLINE_LINUX_DEFAULT
  • updated grub with sudo update-grub
  • strangely I can still change my brightness using 18.04's default desktop environment. In fact, I can close i3 and go back to the login screen, tap the bightness buttons from there on my keyboard, and log back into i3 and the brightness level is maintained as it was on the login screen. but this is useful and i will look into this close, thanks! – Conrad.Dean May 07 '18 at 23:48