How to change LCD brightness from command line (or via script)?

To work around bug #1005495 (changing LCD brightness via hotkeys impossible), I'd like to have one command line query for increasing and one for reducing the brightness of my LCD. I could then map a hotkey to each one of this queries.

The problem is: I don't know how to increase and reduce the LCD brightness on the command line. Do you?


Solution 1:

Open your terminal and type this

xrandr -q | grep " connected"

it will gives you the output as

LVDS1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 331mm x 207mm

There LVDS1 Stands for your display. So now you have to do as

xrandr --output LVDS1 --brightness 0.5

there 0.5 stands for brightness level and it ranges from 0.0 to 1.0 . 0.0 -> Full black .so you have to choose the required value of brightness .

This doesn't change brightness at a hardware level. From randr manual:

--brightness brightness Multiply the gamma values on the crtc currently attached to the output to specified floating value. Useful for overly bright or overly dim outputs. However, this is a software only modification, if your hardware has support to actually change the brightness, you will probably prefer to use xbacklight.

Solution 2:

Note: xbacklight only works with Intel, not properly on Radeon and not at all with modesetting driver (source). It also only works on X11, not Wayland.


One more way we have to do this is with another new program named as xbacklight , open your terminal and type this

sudo apt-get install xbacklight

then type this xbacklight -set 50

there 50 stands for brightness range we can get it upto 100 from 0 .

you can also increase and decrease the brightness from present value to specified level.as you mentioned if you want to increase to 10% from current value of brightness then you can give this

xbacklight -inc 10

and to decrease 10% you can give this

xbacklight -dec 10