5

I have a laptop with an external monitor connected via HDMI (output name is HDMI1). The command xbacklight works only with my primary screen (which is the laptop screen).

It doesn't work even if I try running it with argument -display HDMI1 (which gives me an error RANDR Query Version returned error -1) or --display HDMI1 (which gives me the help information).

I have seen this - Turn off the backlight of an external monitor - question but it only mentions how to change the brightness, not backlight.

EDIT: the option -display is not documented in the manual page of xbacklight, but after a quick look into the source code I've found where it's used. In the function xcb_connect it represents the X display, not the actual screen name.

2

You can do it with ddcutil, as mentioned here, but it's not that responsive and requires root privileges:

# ddcutil capabilities | grep Brightness
  Feature: 10 (Brightness)

# ddcutil getvcp 10
VCP code 0x10 (Brightness                    ): current value =    60, max value =   100

# ddcutil setvcp 10 70

I don't think that there's "one size fits all" solution since the backlight configuration depends on the hardware. In some situations, you cannot control the backlight even of the built-in laptop monitor.

  • All I'm getting is Display not found, even after adding -d flag. ): – Jezor Jun 4 '18 at 18:43
0

An alternative to ddcutil (for instance if your monitor does not support DDC/CI, or you don't want to load an extra kernel module (i2c-dev), or you don't have permission to access /dev/i2c-*), is to use redshift.

redshift controls the color temperature, but it also controls the screen brightness.

You can set a config file to have different brightness (and different color temperatures too if you wish) during the day and at night, or you can change either of these on the fly from the command line.

From the command line, in a multi-monitor situation, you need to use the -m flag. Your primary monitor is crtc=0 and your external crtc=1. You can also use the name of your monitor given by xrandr.

So, for instance, to set a brightness of 70% on your external monitor, you can run:

redshidft -m randr:crtc=1 -b 0.7 &

If you are using a config file, add to it:

[randr]
screen=0
crtc=1

(It would be crtc=0 for the config file of your primary monitor. This issue covers this.)

If you are already using redshift on your primary screen, you can have 2 running instances of redshift with different settings for each of your monitor. You can even have 2 different config files (load the 2nd redshift instance with the -c flag to give it the path to your 2nd config file).

One thing to be aware of is that, even after you have killed a redshift instance, the settings remain active. To go back to your normal settings, you need to run redshift -x (so, again, for your external monitor, this would be redshift -m randr:crtc=1 -x). If you kill an instance, then launch another one without first running this command, the settings will be cumulative. This is bit of a weird behaviour, but it actually has some advantages: in some cases, depending on how they are launched, 2 concomitant instances can create some flickering. If this were ever to happen, you can simply kill one (or both) to stop the problem: the settings will remain.

All this may seem very complicated, but once you are familiar with it and you have set some config files, or aliases, or keybindings, it actually works very well. And if you launch your redshift instances from .xinitrc for instance, you may never have to fiddle with it anymore as the brightness will automatically adjust at dusk and down.


edit: My comment about redshift not resetting the default monitor values upon being killed above was a mistake on my part:

  • if gently asked to die and cleanup with signal 15 (e.g. kill -15 <pid>, which is the default signal value for kill), it will actually reset things as part of the cleanup

  • if killed with signal 9 (e.g. kill -9 <pid>), it will stop without resetting anything

This makes sense, but I had never realized it. In the situations in which multiple instances of redshift create some flickering, I take advantage of this and launch, then immediately kill (with some function) a new instance. It is probably not very clean... but it has worked for me very well so far.

-1

xbacklight may be your answer:

https://wiki.archlinux.org/index.php/backlight#xbacklight

Brightness and Backlight seems to be the same thing. If so, go for xrandr since every output are supported.

  • 1
    These two are NOT the same thing. Brightness in xrandr represents pixels "whiteness", backlight in xbacklight represents the LED backlight. I took a picture of both of my screens - i.imgur.com/oSXfCGr.jpg The left screen has brightness set to 0 with xrandr, the right one has backlight set to 0 with xbacklight. Notice the "glare" - these are pixels displaying black color and being shined on. (; – Jezor Feb 2 '18 at 0:48
  • See also the wikipedia article: en.wikipedia.org/wiki/Backlight – Jezor Feb 2 '18 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.