sezanzeb.de

Linux

How to set gamma in Xfce4 on login

December 25, 2019

Table of Contents

1. Workaround using a startup script

Using the "Session and Startup" gui tool in Xfce4 you can go to "Application Autostart" and add something like

sh -c 'sleep 2 && xrandr --output HDMI-A-1 --gamma 0.96:0.95:0.99 && xrandr --output HDMI-A-0 --gamma 0.99:1.03:0.99'

Whenever the gamma seems to vanish, which happens for me when starting games, I have a keyboard shortcut that executes the same command.

2. Why changes to Xfce for this would be nice

Nobody seems to know how to set gamma in Xfce. I tried to investigate various options

Setting the gamma in xorg.conf.d (See below on how this can be done) doesn't help. It will set the gamma in lightdm, but not in Xfce

In [1] it is said that colord should be used, but unfortunatelly no Information was provided how it can be achieved. Even more unfortunate, this was apparently never merged into an Xfce release. I wish at least the option to set --gamma using xfconf was added, just like with --scale [4].

Maybe you are lucky to find a matching .icc profile for all your screens, for example in [6], then you can set it using the "Color Profiles" tool in Xfce.

If you have a colorimeter device like a Spyder5 you can use the "displaycal" package in Manjaro apparently. But I don't. I just want to set gamma values manually. There is a tool called "Monica", but it just sets the gamma for all screens. Proprietary solutions once existed apparently [8] but are no longer available and alternativeto.net doesn't know alternatives to them.

If you want to write a software to create .icc profiles that just change gamma, then good luck with the icc format specification [5]. The german wikipedia says there is a icc "Matrix-Profile" type that can set gamma curves somehow though [7].

If you are wondering why one would like to guess gamma values that are most likely wrong anyways, it's because when there are multiple monitors in use you maybe want them to have at least similar colors, even if they are not quite calibrated correctly. They greys of my GL2250 are rather blue compared to my GW2480, so I want to make them meet in the middle.

There are indeed a few people that would be interested in changing their gamma permamently [1][3][9] and to conclude, I could not find a way to make xfce4 set a custom gamma except for the startup script. Unfortunatelly (some?) games reset the this startup gamma. Display profiles are apparently kept, so maybe Xfce could be able to actually have this as a permament setting that doesn't just go away.

I therefore opened a ticket in the xfce bugtracker for this [10]. Hopefully this is a reasonable feature request!

3. How to set gamma in xorg.conf.d

This unfortunatelly only applies to lightdm, Xfce seems to ignore this.

Those are the contents of a file that I created for this. It just has to end with ".conf", otherwise you can name it whatever you want. /etc/X11/xorg.conf.d/calibration.conf

Section "Monitor"
    Identifier  "CustomNameFoo"
    Gamma 0.99 1.03 0.99
EndSection

Section "Monitor"
    Identifier  "YourOtherMadeUpDisplayName"
    Gamma 0.96 0.95 0.99
EndSection

Section "Device"
    Identifier "Device0"
    Option "Monitor-HDMI-A-1" "CustomNameFoo"
    Option "Monitor-HDMI-A-0" "YourOtherMadeUpDisplayName"
EndSection
Monitor-HDMI-A-1 is simply "Monitor-" + your monitor name when running "xrandr" in a console.

4. Sources

[1] https://bugzilla.xfce.org/show_bug.cgi?id=10069, 25 Dec 2019
[2] https://www.freedesktop.org/software/colord/using.html, 25 Dec 2019
[3] https://www.reddit.com/r/xfce/comments/91zf3j/xfcenvidia_how_to_set_gamma_on_screen_wakeup/, 25 Dec 2019
[4] https://git.xfce.org/xfce/xfce4-settings/commit/?id=6138979657fa7d9e4a9e66872db5050bd61a4a83, 25 Dec 2019
[5] http://www.color.org/specification/ICC.2-2019.pdf, 25 Dec 2019
[6] https://www.tftcentral.co.uk/articles/icc_profiles.htm, 25 Dec 2019
[7] https://de.wikipedia.org/wiki/ICC-Profil, 25 Dec 2019
[8] https://www.dpreview.com/forums/thread/2835622, 25 Dec 2019
[9] https://askubuntu.com/questions/439022/edit-color-profile-icc-to-change-gamma, 25 Dec 2019
[10] https://bugzilla.xfce.org/show_bug.cgi?id=16303