Change screen brightness in LXDE

I decided to play around with LXDE on a cheap laptop I bought in an employee auction recently (on which I’m running Linux Mint Debian Edition). Everything works great – I forgot how fast and comfortable LXDE is to me, since it’s been quite a while since I used it regularly.

However, the keybindings don’t work for adjusting the screen brightness, and I had to struggle for a bit to figure out how to get them properly mapped to this functionality. Here’s how I did it.

Use xrandr

The xrandr command was already available, so the first thing I did was run the following in a terminal to see what the display name was on this laptop:

$ xrandr -q | grep connected

For me, on this particular laptop, it resulted in this (and I bolded the part that I was specifically looking for):

LVDS-1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 345mm x 194mm
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
eDP-1 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
VGA-1 disconnected (normal left inverted right x axis y axis)

That gives me the name of the display I need to specify in the --output portion of the xrandr command I want to use to adjust the screen brightness.

For me, 50% is just about right on this particular screen, so I tested the command in the terminal with this syntax to set the brightness at half its normal value:

xrandr --output LVDS-1 --brightness 0.5

… and it worked! Muuuuuch better. The backlight on this laptop at 100% is a bit harsh, so this makes it far less piercing.

I put that command into a shell script I put into my home directory, and I created another shell script that does the same thing, except pops the brightness back to 100%, and put that in my home directory as well. Here’s what that one says:

xrandr --output LVDS-1 --brightness 1.0

Map the commands to the keybindings in lxde-rc.xml

Next I went to ~/.config/openbox/lxde-rc.xml and at the end of the section and added the following to map keys to the shell scripts (link to the actual text here, since the XML isn’t rendering properly in WordPress):


What that does is map the Windows key + the F9 and F10 keys to drop the brightness to 50% and raise it back to 100%, respectively.

Before choosing this combination, I made sure that it wasn’t already in use for anything – I wouldn’t want to create a conflict.

Then, I saved the lxde-rc.xml file, and from a terminal, I ran the following:

openbox --reconfigure

If there’s anything wrong with the syntax of what you added to config, it will pop up an error message here, but if nothing happens, it’s all good.

Then I tested the change by hitting Windows+F9 and Windows+F10 and both worked!

Your mileage may vary based on hardware, but this worked well for me on an HP Elitebook 8540p.


10 thoughts on “Change screen brightness in LXDE

    • First thing I tried! Could not get it to work on this laptop no matter what I did. I agree, that would have been much easier. 🙂

  1. Thanks so much for this! I just moved to Debian Jessie, and since I despise the fancy-shmancy Gnome 3 environment, I chose to use the desktop environment closest to my beloved Gnome 2. There’s definitely a learning curve to LXDE – like learning how to add new icon definitions by working with /usr/share/applications to make non-repo packages appear in the application menu. Posts like this though certainly ease this curve a lot.

    My eyes were burning because I didn’t know how to set the brightness. Now with one alias command, inspired by this post, I can now protect my eyes much better.

    • Glad I could help! I guarantee the next time I find myself having to remember how to do this, I’ll be back here myself, referring to my own post. I do that a lot. 🙂

  2. Pingback: # Change screen brightness – linux, xubunto, python
  3. Does this really change the backlight for you? For me it leaves the backlight unchanged, but instead makes the picture less bright (and real ugly).
    For a laptop you most likely will find something in /sys/class/backlight/ to control the brightness. For my desktop monitor I found an ancient tool called gddccontrol, that communicates with the monitor over i2c to set the brightness.

  4. Running LXDE on a Thinkpad X201. The regular IBM keys (Fn+Home, Fn+End) don’t work.
    xrandr works as you’ve stated.
    However I also found xbacklight, which conveniently adjusts the brightness in percentage steps.
    I made a script ~/ with the line xbacklight -10 (dims by 10%)
    and ~/ with xbacklight +10

    Then linked them to the F10 and F11 keys in lxde-rc.xml as per your example above
    So now just tapping F10 repeatedly dims the screen in 10% steps

    • Also, my screen was slightly low-contrast.
      xrandr gamma (with a value of .7) fixed that.
      xrandr showed my screen is LVDS1
      The line xrandr –output LVDS1 –gamma .7:.7:.7 works
      For convenience I just added it to my ‘’ script so it acts when I hit F10

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s