I have 2 monitors plugged in via DisplayPort*, named DP1 and DP2.

I configure them next to each other like this:

xrandr --output DP1 --pos 0x0 --output DP2 --pos 3840x0

Problem: Sometimes, they are detected in the opposite order on startup, so the left monitor is labeled DP2 and the right one becomes DP1 instead. This is random, so after every startup I need to check and eventually reconfigure the layout.

Therefore, I'm looking for a way to reliably detect which monitor is which, across reboots. E.g., is there a way to determine which port ID corresponds to which assigned monitor name?

I'm on Arch. FWIW, Windows 10 remembers the order correctly.

*I'm using a Dell docking station connected via Thunderbolt, if that matters.

1 Answer 1


You might be able to use the EDID block for the monitors. For example, set up the system in the desired way, then run

$ xrandr --prop | grep -A2 EDID > desired-setup.txt

Thereafter, each time after a setup is done, your run the similar

$ xrandr --prop | grep -A2 EDID > current-setup.txt

Then, if current-setup.txt is the same as desired-setup.txt, all is fine, and otherwise you'll need the alternative set up with swapped DP1 and DP2.

This scheme only works if the monitors' EDID report is distinctive, where the first 18 bytes includes manufacturer id, product code and serial number (bytes 12-15), as well as week and year of manufacture. It of course also only works for the particular monitors. (If you need more flexibility, you'll need more advanced decision logic, and a "library" of EDID captures)

The output from xrandr shows the EDID bytes in hex lines of 16 bytes, which is why you may need -A2 to get its first 32 bytes for each monitor. (see eg wikipwedia for a description of the EDID block).

  • Great, exactly what I was looking for! My monitors follow the specs in that their EDIDs include the actual individual serial numbers, which makes them trivial to distinguish.
    – Arminius
    Commented Feb 6, 2019 at 2:35
  • Shouldn't -A1 be enough? Do you need week and year of manufacture to uniquely identify the monitors? With -A1 you get the first 16 bytes as you clearly stated including manufacturer and serial id, that will make things much easier and readable if you want to script the thing later on.
    – UlfR
    Commented Oct 28, 2019 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .