Dim your screen/monitor with Xrandr

Dim your screenmonitor with “xrandr”

On Ubuntu, with a clear setup, there is only a UI element in the right top corner of the desktop screen which allows us to decrease the brightness level, but when you switch to an external monitor, that UI element will flush and you will be left the with the button options which resides in your side of the monitor. At least it was my problem, and my monitor doesn’t let me decrease the brightness to a level that will comfort my eyes, and I tried to find out other ways to dim the light. I found xrandr, which is very easy to use.

According to wiki, “xrandr is an official configuration utility to the RandR (Resize and Rotate) X Window System extension. It can be used to set the size, orientation or reflection of the outputs for a screen” (and has some other type of capabilities).

Firstly list the monitors. This command will show you a line for each of your working monitors. Now I’m mirroring my laptop screen and monitor, and I’m seeing two lines of result:

nurettin@nurettin-ThinkPad-L13:~$ xrandr --listmonitors
Monitors: 2
 0: +*HDMI-1 1920/598x1080/336+0+0  HDMI-1
 1: +eDP-1 1920/294x1080/165+0+0  eDP-1

Now, using the name “HDMI-1” I can do operations on my monitor like changing the brightness level. The brightness can be adjustable with a range between 0 and 1.0, so if I want to set it to 0.5 then this command will be enough:

xrandr --output HDMI-1 --brightness 0.25

Xrandr is very handy and has easy-to-understand option names. You can make a simple slider for brightness, gamma level, etc, and develop your eye-care software with a small Python script, read your books at night.