Description
Applying a profile that contains one or more displays that are not connected can lead to a misconfiguration.
From what I see in xfconf, the only value I could use in order to match configured displays with connected displays should be EDID value.
We need a way, in bash, to retrieve that value in the same format, as it isn't the same of what we can get with e.g. xrandr --prop
.
example:
We want to e.g. set profile d6c313ffc53db7cfeee6fa40538985c5eefb24cc. This profile has two configured EDID:
$ xfconf-query -v -l -c displays -p /d6c313ffc53db7cfeee6fa40538985c5eefb24cc | grep '/EDID '
/d6c313ffc53db7cfeee6fa40538985c5eefb24cc/DVI-I-1/EDID d57a084978bbd241c62509aea3ab64a427ffc73e
/d6c313ffc53db7cfeee6fa40538985c5eefb24cc/HDMI-0/EDID 471766147bfc30d2842655fadc76e95ca11d595b
Now we want to be sure those two EDIDs to be connected before set the profile.
So the question is, how?
With xrandr --prop
we can get the connected EDIDs:
...
DVI-I-1 connected
...
EDID:
00ffffffffffff0041622101b12a3000
0314010380341d78eaeed5a555489b26
125054b30c00714f8180810095000101
010101010101023a801871382d40582c
450009252100001e000000fc00566973
656f2032343044580a20000000fd0038
4c1f5312000a202020202020000000ff
004432343043303032343030310a00e4
...
HDMI-0 connected
...
EDID:
00ffffffffffff001e6d010001010101
011e010380a05a780aee91a3544c9926
0f5054a1080031404540614071408180
d1c00101010108e80030f2705a80b058
8a0040846300001e662150b051001b30
4070360040846300001e000000fd0018
781e873c000a202020202020000000fc
004c4720545620535343520a202001e4
02034ff15a6160101f66650413051403
021220212215015d5e5f6263643f4029
0957071507505507006e030c001000b8
3c2400800102030468d85dc401788003
02e200cfe305c000e3060d01e20f3356
5e00a0a0a02950302035004084630000
1e000000000000000000000000000000
000000000000000000000000000000f3
...
but they are not in the same format as those seen in xfconf-query, so we need:
CONNECTED_EDIDS="$(some command to get current connected displays EDID the same way as seen in xconf-query)"
I've been pointed to https://gitlab.xfce.org/xfce/xfce4-settings/-/blob/master/common/edid-parse.c
Any help is greatly appreciated.
IN ANY CASE a part from EDID, various checks are performed to assure a profile can be applied in first place, so this script could be considered reliable, especially if your displays are always the same.