DebugPointer
Published on

How to change brightness of screen in linux?

How to change brightness of screen in linux?

In this post we will discuss 3 ways to change the brightness on your linux distros like Ubuntu, Arch Linux, Pop OS, Manjaro Linux, Debian etc.,

The first approach is using xrandr.

xrandr - to change the brightness of output

xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. xrandr is just a simple interface to the RandR extension and has no configuration file. It can be used to set the size, orientation or reflection of the outputs for a screen. For configuring multiple monitors see the Multihead page.

Check if the driver of your graphics card supports it, then you can use xrandr. To view the current configuration, run the following command-

$ xrandr --current --verbose

To change the configuration of an output i.e., display, then you need the name of the output. You can find the name of the output using the command xrandr --current, for example LVDS1 is the name of the output.

The brightness can be changed using the following command-

$ xrandr --output <outputname> --brightness 0.75

xrandr is the first approach in case the issue is not at the level of hardware. xrandr will not change the brightness of the screen at hardware level.

In case xrandr doesn't work, we will have to work on the next approach xbacklight.

Note : xrandr accepts values as decimal values ranging from 0.0 to 1.0

xbacklight - to change the brightness at hardware level

As we discussed above, xbacklight changes the brightness of the screen at the level of hardware.

To get the current brightness levels, use the following command-

$ xbacklight -get

To set the brightness by percentage, an absolute percentage value, use the following command-

$ xbacklight -set <percentage>

For example,

$ xbacklight -set 80

xbacklight gives you an option to change the brightness of the screen without even knowing the absolute percentage values. You can change the brightness with relative increment or decrement of value.

To increase the brightness value relatively

$ xbacklight -inc <percentage>

For example,

$ xbacklight -inc 10

To decrease the brightness value relatively

$ xbacklight -dec <percentage>

For example,

$ xbacklight -dec 15

Note : xbacklight accepts values as percentage values ranging from 0 to 100

dbus-send command

If xbacklight fails and if the keyboard shortcuts are working i.e., if you are able to change the brightness using keyboard shortcuts, then the method using dbus-send should work.

Command to set brightness percentage-

dbus-send --session --print-reply --dest="org.gnome.SettingsDaemon" /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:`percentage` 

For example, to set the brightness to 30%-

dbus-send --session --print-reply --dest="org.gnome.SettingsDaemon" /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:30  

If it throws an error-

Error org.freedesktop.DBus.Error.UnknownMethod: Method "SetPercentage" with signature "u" on interface "org.gnome.SettingsDaemon.Power.Screen" doesn't exist

Then your operating system is too old. You'll have to use another tool called xdotool.

xdotool command - legacy systems

To increase the brightness, run the following command-

xdotool key XF86MonBrightnessUp

To decrease the brightness, run the following command-

xdotool key XF86MonBrightnessDown

I hope this worked for you and you are now able to change brightness of your system.