4

KDE's Night Color feature I guess uses xrandr's gamma functionality, but I was hoping to adjust the brightness of my display using it. Unfortunately, doing so like this loses the "night color" because it resets the gamma:

xrandr --output DP-0 --brightness .8

Is there some way to query the currently applied values from xrandr so I can reapply them?

Slbox
  • 182

3 Answers3

1

To change brightness independently of xrandr:

From my tests on my stock Ubuntu 20.04 system, it seems the input and output of the xgamma tool are completely independent to xrandr. So, if you change the brightness using xgamma -gamma 0.8 then that shouldn't affect the xrandr night light settings :)


To query the currently applied gamma values of xrandr:

xrandr --verbose | grep "Gamma"

I had a look at man xrandr for documentation, and it seems the --verbose flag gives out the details for the gamma.

It does say

Please note that the gamma and brightness informations are only approximations of the complete color profile stored in the server.

and my tests seem to show that the value output by this is not the same as what is passed during input.

For example, if I enter xrandr --output eDP-1 --gamma 2:0.5:0.2 and then xrandr --verbose | grep "Gamma", it outputs:

    Gamma:      0.50:2.0:5.0

I closed Redshift before running these tests, so hopefully that didn't interfere.

There might be some way to figure out a transformation to interpret the value, but I am not sure about that.

Timotheos
  • 121
  • 3
  • The value to enter in the command line option are the inverse of the value written in the ouput: 1/2.0 = 0.5, 1/0.5 = 2.0, 1/0.2=5.0 (not sure why! In any case that doesn't seem to be a good solution for Night Color, see my answer below) – armando.sano May 12 '22 at 16:47
1

Cross-posting my answer there:

For best result adjusting brightness with xrandr and still using KDE's Night Color feature, I suggest to install redshift (apt install redshift) and to use it either as:

redshift -oP -O 4500 -b 0.5

for a temperature of 4500 and brightness of 0.5, or in combination with xrandr (and, optionally, xrandr-invert-colors to invert colours):

xrandr --output eDP-1 --brightness 0.5
xrandr-invert-colors
redshift -o -O 4500

Note that calling xrandr on its own will cancel any redshift effect. The -P option of redshift also resets the screen brightness and color instead of incrementally superimposing adjustments. Incremental adjustments (no -P option) are needed if using in conjunction with xrandr like in the second use case.

Finally, instead of using xrandr-invert-colors, one can also use a negative brightness value in xrandr (but not in redshift), but the result is not as nice.

0

Only a partial answer to my full question, but it turns out the brightness is applied by adjusting the gamma

Note that it doesn’t change hardware level brightness, it is just a software level filter with adjusted gamma values.

So presumably I can find these values somewhere.

Slbox
  • 182