Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display UUIDs sometimes not match physical screens #77

Open
intellild opened this issue Jan 13, 2022 · 26 comments
Open

Display UUIDs sometimes not match physical screens #77

intellild opened this issue Jan 13, 2022 · 26 comments

Comments

@intellild
Copy link

Display UUIDs sometimes not match physical screens
This is an Apple issue but I don't known how to report it to Apple
Maybe we could use display serial as a workaround?

@free-storage
Copy link

I join the problem. If you try to manually change the monitor settings, then through the script it turns out to return the settings. If the laptop wakes up from sleep mode, then the script does not work.

What to do? Has anyone found a solution?

@thoro
Copy link

thoro commented Feb 17, 2022

No sure if the same issue, also with M1 Macbook Pro.

I have dual P2720U via single thunderbolt cable, replugging the cable sometimes fixes positioning. My issue is that macOs just switches around the displays. (1) is the left, and then afterwards (2) is the left display.

ioreg shows the displays are nearly identical, except for a single number in the serial number ..

{"SupportsSuspend"=No,"MaximumRefreshRate"=76,"SupportsActiveOff"=No,"SupportsBT2020cYCC"=64,"PortID"=1,"ProductAttributes"={"ManufacturerID"="BNQ","YearOfManufacture"=2020,"SerialNumber"=21573,"ProductName"="BenQ PD2720U","AlphanumericSerialNumber"="PAL02071019","LegacyManufacturerID"=2513,"ProductID"=32816,"WeekOfManufacture"=43},"MaxVerticalImageSize"=34,"SupportsHLGEOTF"=No,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44032,"Y"=20864},"Green"={"X"=13568,"Y"=46720},"Blue"={"X"=9728,"Y"=3648}},"DefaultColorSpaceIsSRGB"=Yes,"SupportsBT2020YCC"=128,"NativeFormatHorizontalPixels"=3840,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsHDRGammaEOTF"=No,"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"Luminance"={"Max"=23523611,"MaxFrameAverage"=23019548,"Min"=19809},"SupportsPQEOTF"=Yes,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"SupportsBT2020RGB"=512,"SupportsHDRStaticMetadataType1"=Yes,"NativeFormatVerticalPixels"=2160}

{"SupportsSuspend"=No,"MaximumRefreshRate"=76,"SupportsActiveOff"=No,"SupportsBT2020cYCC"=64,"PortID"=2,"ProductAttributes"={"ManufacturerID"="BNQ","YearOfManufacture"=2020,"SerialNumber"=21573,"ProductName"="BenQ PD2720U","AlphanumericSerialNumber"="PAL02081019","LegacyManufacturerID"=2513,"ProductID"=32816,"WeekOfManufacture"=43},"MaxVerticalImageSize"=34,"SupportsHLGEOTF"=No,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44032,"Y"=20864},"Green"={"X"=13568,"Y"=46720},"Blue"={"X"=9728,"Y"=3648}},"DefaultColorSpaceIsSRGB"=Yes,"SupportsBT2020YCC"=128,"NativeFormatHorizontalPixels"=3840,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsHDRGammaEOTF"=No,"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"Luminance"={"Max"=23523611,"MaxFrameAverage"=23019548,"Min"=19809},"SupportsPQEOTF"=Yes,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"SupportsBT2020RGB"=512,"SupportsHDRStaticMetadataType1"=Yes,"NativeFormatVerticalPixels"=2160}

displayplacer shows the uuids from the system, and I believe macos is actually updating the Persistent screen ids and switching them around.

Not sure if there's an option to go from Serial Number to Persistent Screen ID...

@bytejunkie
Copy link

i think if you run displaytracer list it even gives you an example command using the id. its certainly how i've got mine working.

@thoro
Copy link

thoro commented Feb 17, 2022

Yeah, the issue is, the persistent screen ids switch displays 😃

@jpike88
Copy link

jpike88 commented Mar 7, 2022

Same problem. Occasionally two monitors switch UUIDs and screw up the command I use, I have to switch settings on them each time.

On M1 Max, one monitor is plugged in via HDMI, one is plugged in via USB-C using HDMI => USB-C cable

@jpike88
Copy link

jpike88 commented Mar 7, 2022

@jakehilborn Persistent screen ids always stay the same this is not the case as per your documentation. Can you confirm that this is likely an Apple-side issue? I'm not well versed in C

@FloWi
Copy link

FloWi commented Mar 14, 2022

I think I found a way to link the monitors built-in serial number to the "Contextual screen id" that displayplacer reads from the quartz graphics layer.

MacOS' system_profiler shows all the relevant information. See example below.

system_profiler SPDisplaysDataType

system_profiler SPDisplaysDataType -json | jq '[ .SPDisplaysDataType[].spdisplays_ndrvs[]? |
  { _name: ._name,
    "spdisplays_display-serial-number": ."spdisplays_display-serial-number",
    _spdisplays_displayID: ._spdisplays_displayID,
    "_spdisplays_display-week": ."_spdisplays_display-week",
    "_spdisplays_display-year": ."_spdisplays_display-year",
    _spdisplays_pixels: ._spdisplays_pixels,
    _spdisplays_resolution: ._spdisplays_resolution,
  }
] '
[
  {
    "_name": "Color LCD",
    "spdisplays_display-serial-number": null,
    "_spdisplays_displayID": "4281006",
    "_spdisplays_display-week": "16",
    "_spdisplays_display-year": "2017",
    "_spdisplays_pixels": "3360 x 2100",
    "_spdisplays_resolution": "1680 x 1050"
  },
  {
    "_name": "LEN LT3053pwA",
    "spdisplays_display-serial-number": "V1188942    ",
    "_spdisplays_displayID": "2b982909",
    "_spdisplays_display-week": "43",
    "_spdisplays_display-year": "2013",
    "_spdisplays_pixels": "2560 x 1600",
    "_spdisplays_resolution": "2560 x 1600 @ 60.00Hz"
  },
  {
    "_name": "LEN LT3053pwA",
    "spdisplays_display-serial-number": "V1187020    ",
    "_spdisplays_displayID": "2b98290a",
    "_spdisplays_display-week": "41",
    "_spdisplays_display-year": "2013",
    "_spdisplays_pixels": "2560 x 1600",
    "_spdisplays_resolution": "2560 x 1600 @ 60.00Hz"
  }
]

note the trailing whitespaces at the end of the serial number

json --> csv --> markdown shenanigans

➜ system_profiler SPDisplaysDataType -json | jq '[ .SPDisplaysDataType[].spdisplays_ndrvs[]? |
  { _name: ._name,
    "spdisplays_display-serial-number": ."spdisplays_display-serial-number",
    _spdisplays_displayID: ._spdisplays_displayID,
    "_spdisplays_display-week": ."_spdisplays_display-week",
    "_spdisplays_display-year": ."_spdisplays_display-year",
    _spdisplays_pixels: ._spdisplays_pixels,
    _spdisplays_resolution: ._spdisplays_resolution,
  }
] ' | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' | csv2md
_name spdisplays_display-serial-number _spdisplays_displayID _spdisplays_display-week _spdisplays_display-year _spdisplays_pixels _spdisplays_resolution
Color LCD 4281006 16 2017 3360 x 2100 1680 x 1050
LEN LT3053pwA V1188942 2b982909 43 2013 2560 x 1600 2560 x 1600 @ 60.00Hz
LEN LT3053pwA V1187020 2b98290a 41 2013 2560 x 1600 2560 x 1600 @ 60.00Hz

the _spdisplays_displayIDis the hex representation of the Contextual screen idthat displayplacer shows.

echo $((16#2b98290a))
731392266
_name spdisplays_display-serial-number _spdisplays_displayID manually converted display id
Color LCD 4281006 69734406
LEN LT3053pwA V1188942 2b982909 731392265
LEN LT3053pwA V1187020 2b98290a 731392266

convert using bash:

displayplacer

Contextual screen id origin type
69734406 (0,0) - main display MacBook built in screen
731392266 (1680,-380) 30 inch external screen
731392265 (4240,-380) 30 inch external screen

731392266 should be on the left side of 731392265
-->
V1187020 should be on the left side of V1188942

I saw that quartz can extact the monitors serial number.
https://developer.apple.com/documentation/coregraphics/1455409-cgdisplayserialnumber
Maybe this could be used as a more stable identifier within displayplacer?

@thoro
Copy link

thoro commented Mar 14, 2022

@FloWi This doesn't work for me, here's the output from system_profiler:

{
  "SPDisplaysDataType" : [
    {
      "_name" : "Apple M1 Pro",
      "spdisplays_metalfamily" : "spdisplays_mtlgpufamilyapple7",
      "spdisplays_ndrvs" : [
        {
          "_name" : "BenQ PD2720U",
          "_spdisplays_display-product-id" : "8030",
          "_spdisplays_display-serial-number" : "5445",
          "_spdisplays_display-vendor-id" : "9d1",
          "_spdisplays_display-week" : "43",
          "_spdisplays_display-year" : "2020",
          "_spdisplays_displayID" : "2",
          "_spdisplays_pixels" : "3840 x 2160",
          "_spdisplays_resolution" : "1920 x 1080 @ 60.00Hz",
          "spdisplays_ambient_brightness" : "spdisplays_yes",
          "spdisplays_main" : "spdisplays_yes",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_online" : "spdisplays_yes",
          "spdisplays_pixelresolution" : "spdisplays_2160p",
          "spdisplays_resolution" : "1920 x 1080 @ 60.00Hz",
          "spdisplays_rotation" : "spdisplays_supported"
        },
        {
          "_name" : "BenQ PD2720U",
          "_spdisplays_display-product-id" : "8030",
          "_spdisplays_display-serial-number" : "5445",
          "_spdisplays_display-vendor-id" : "9d1",
          "_spdisplays_display-week" : "43",
          "_spdisplays_display-year" : "2020",
          "_spdisplays_displayID" : "3",
          "_spdisplays_pixels" : "3840 x 2160",
          "_spdisplays_resolution" : "1920 x 1080 @ 60.00Hz",
          "spdisplays_ambient_brightness" : "spdisplays_yes",
          "spdisplays_mirror" : "spdisplays_off",
          "spdisplays_online" : "spdisplays_yes",
          "spdisplays_pixelresolution" : "spdisplays_2160p",
          "spdisplays_resolution" : "1920 x 1080 @ 60.00Hz",
          "spdisplays_rotation" : "spdisplays_supported"
        }
      ],
      "spdisplays_vendor" : "sppci_vendor_Apple",
      "sppci_bus" : "spdisplays_builtin",
      "sppci_cores" : "14",
      "sppci_device_type" : "spdisplays_gpu",
      "sppci_model" : "Apple M1 Pro"
    }
  ]
}

@thoro
Copy link

thoro commented Mar 14, 2022

But, I can retrieve the real serial number via ioreg:

see AlphanumericSerialNumber, it's only different by a single number!

ioreg -lw0  | grep PD2720
    | |   | |         |     |   "Device Model Name" = "PD2720U"
    | |   | |         |     |     |   "Device Model Name" = "PD2720U"
    | |   |   |   "DisplayAttributes" = {"SupportsSuspend"=No,"MaximumRefreshRate"=76,"SupportsActiveOff"=No,"SupportsBT2020cYCC"=64,"PortID"=1,"ProductAttributes"={"ManufacturerID"="BNQ","YearOfManufacture"=2020,"SerialNumber"=21573,"ProductName"="BenQ PD2720U","AlphanumericSerialNumber"="PAL02071019","LegacyManufacturerID"=2513,"ProductID"=32816,"WeekOfManufacture"=43},"MaxVerticalImageSize"=34,"SupportsHLGEOTF"=No,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44032,"Y"=20864},"Green"={"X"=13568,"Y"=46720},"Blue"={"X"=9728,"Y"=3648}},"DefaultColorSpaceIsSRGB"=Yes,"SupportsBT2020YCC"=128,"NativeFormatHorizontalPixels"=3840,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsHDRGammaEOTF"=No,"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"Luminance"={"Max"=23523611,"MaxFrameAverage"=23019548,"Min"=19809},"SupportsPQEOTF"=Yes,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"SupportsBT2020RGB"=512,"SupportsHDRStaticMetadataType1"=Yes,"NativeFormatVerticalPixels"=2160}
    | |   |       |         |   "device name" = "BenQ PD2720U"
    | |   |   |   "DisplayAttributes" = {"SupportsSuspend"=No,"MaximumRefreshRate"=76,"SupportsActiveOff"=No,"SupportsBT2020cYCC"=64,"PortID"=2,"ProductAttributes"={"ManufacturerID"="BNQ","YearOfManufacture"=2020,"SerialNumber"=21573,"ProductName"="BenQ PD2720U","AlphanumericSerialNumber"="PAL02081019","LegacyManufacturerID"=2513,"ProductID"=32816,"WeekOfManufacture"=43},"MaxVerticalImageSize"=34,"SupportsHLGEOTF"=No,"MaxHorizontalImageSize"=60,"HasHDMILegacyEDID"=No,"Chromaticity"={"Red"={"X"=44032,"Y"=20864},"Green"={"X"=13568,"Y"=46720},"Blue"={"X"=9728,"Y"=3648}},"DefaultColorSpaceIsSRGB"=Yes,"SupportsBT2020YCC"=128,"NativeFormatHorizontalPixels"=3840,"DefaultWhitePoint"={"X"=20544,"Y"=21568,"Gamma"=144179},"SupportsHDRGammaEOTF"=No,"SupportsVariableRefreshRate"=No,"AspectRatio"=15,"MinimumRefreshRate"=50,"Luminance"={"Max"=23523611,"MaxFrameAverage"=23019548,"Min"=19809},"SupportsPQEOTF"=Yes,"WhitePoints"=({"X"=20544,"Y"=21568,"Gamma"=144179}),"PreciseAspectRatio"=115652,"ContinuousFrequencySupport"="None","SupportsStandby"=Yes,"SupportsBT2020RGB"=512,"SupportsHDRStaticMetadataType1"=Yes,"NativeFormatVerticalPixels"=2160}
    | |   |       |         |   "device name" = "BenQ PD2720U"

@FloWi
Copy link

FloWi commented Mar 14, 2022

I noticed that on my system it's called spdisplays_display-serial-number and _spdisplays_display-serial-number on yours, @thoro. That all feels quite broken 🙈
I'm on mac OS 11.6.4 btw.

Does displayplacer use your _spdisplays_displayIDs in the output under Contextual screen id?

@FloWi
Copy link

FloWi commented Mar 14, 2022

lol - when I run your command I get the audio information about my monitors :D

ioreg -lw0 | grep LT305
    | |   |         | |   "IOAudioEngineDescription" = "LEN LT3053pwA"
    | |   |         | | |   "IOAudioSelectorControlAvailableSelections" = ({"IOAudioSelectorControlTransportValue"=1685090932,"IOAudioSelectorControlSelectionValue"=876114020,"IOAudioSelectorControlSelectionDescriptionKey"="LEN LT3053pwA"})
    | |   |           |   "IOAudioEngineDescription" = "LEN LT3053pwA"
    | |   |           | |   "IOAudioSelectorControlAvailableSelections" = ({"IOAudioSelectorControlTransportValue"=1685090932,"IOAudioSelectorControlSelectionValue"=876114020,"IOAudioSelectorControlSelectionDescriptionKey"="LEN LT3053pwA"})

@thoro
Copy link

thoro commented Mar 14, 2022

Probably system difference how it's connected, I have two Benq daisy chained via TB4 on a M1 Macbook 14", OS is 12.2.1

@jpike88
Copy link

jpike88 commented Mar 15, 2022

I have M1 Max, with four separately connected Samsung monitors.

system_profiler approach doesn't work, because _spdisplays_display-serial-number is the same across them all (some nonsense value like 5a5a4d52 which matches to nothing I can find online). All other fields in the output are useless (I piped system_profiler SPDisplaysDataType -json to a file and look at it directly without selecting any fields to be sure).

Using ioreg -lw0 | grep DisplayAttributes seems to get valid unique serial numbers (with field ID AlphanumericSerialNumber), but there's nothing in there that I can use to match back to an identifier that displayplacer understands (closest thing I could find is PortID, but doesn't seem like a good fit). If there's a way to match the AlphanumbericSerialNumber with the persistent or contextual screen ids, I think that might do it. But no idea how to do that match.

Incredibly frustrating.

@FloWi
Copy link

FloWi commented Mar 15, 2022

That's a bummer. I thought I was on track of finding the holy grail :-/

@jpike88
Copy link

jpike88 commented Mar 15, 2022

@xedin am mentioning you because you're the first guy I see on the Swift project, and am pretty desperate to figure this out, as Apple's issues regarding multiple monitor handles seem to go back years... can you please try to maybe direct the relevant team/individual in Apple onto this, or point us to someone who can address it?

It's really unfortunate that some open source repo on life support is the closest thing to proper multi-monitor behaviour on macOS, I don't understand why it's been overlooked. Maybe if we get the right guy's attention on this area, we can put an end to the shortcomings that we see here.

@westito
Copy link

westito commented Mar 27, 2022

After I switched to M1 MacBook Pro the two monitor IDs swaps every time. The last saved displayplacer script not works next time after swapping. So I have two Automator scripts with different ID order and I run those alternately. When used script 1 last time, I have to run script 2 next time and so on. I have "MonitorSet1" and "MonitorSet2" Automator scripts and I can run those with Spotlight search very quick. Because Spotlight shows the last used one in the first row, I always choose the second one.

@CensoredUser
Copy link

Just chiming in here to say I've got this same issue, on a 2022 M1 MacBook Pro on macOS 12.3.1 - I've got 2 HP Z27 monitors plugged in via Thunderbolt. After the mac sleeps, or I unplug the monitor(s), it'll come back with switched "persistent" IDs, and my layout won't work.
I'm going the same route as @westito right now, setting up a script that will toggle which is the right and which is the left display.
Pretty frustrating issue with macOS tbh, and I think it's actually gotten worse on the M1 vs the Intel.

@westito
Copy link

westito commented Apr 20, 2022

Just chiming in here to say I've got this same issue, on a 2022 M1 MacBook Pro on macOS 12.3.1 - I've got 2 HP Z27 monitors plugged in via Thunderbolt. After the mac sleeps, or I unplug the monitor(s), it'll come back with switched "persistent" IDs, and my layout won't work.
I'm going the same route as @westito right now, setting up a script that will toggle which is the right and which is the left display.
Pretty frustrating issue with macOS tbh, and I think it's actually gotten worse on the M1 vs the Intel.

twocs's solution is better:
#80 (comment)

@alagden
Copy link

alagden commented Apr 4, 2023

FYI
Similar issue with two Samsung LS32A70 monitors both connected to MacBook Pro 16" 2019 (Monteray) via direct USB-C to DP cables.
I also noticed i have identical unrelated duplicate numeric serial numbers in "_spdisplays_display-serial-number" of the system profiler output, but can see unique partial serial numbers in "spdisplays_display-serial-number" that match parts of what the monitor show on their information menus.

@jakehilborn
Copy link
Owner

@intellild @free-storage @thoro @bytejunkie @jpike88 @FloWi @CensoredUser @alagden displayplacer v1.4.0 supports addressing screens by serial id. If all of the screens in your setup have unique serial ids, this should fix the id switching issue.

Could you try out the new version and let me know if it works on your setup?

@FloWi
Copy link

FloWi commented Jun 12, 2023

@jakehilborn
I don't recall exactly where the entry of the rabbit-hole was located ;-)
Tried the new version, but both my external monitors yield the same serial screen id.

➜ displayplacer list | grep "Serial screen id"
Serial screen id: s4251086178
Serial screen id: s16843009
Serial screen id: s16843009

Here is my config.

system_profiler SPDisplaysDataType -json | jq .
{
  "SPDisplaysDataType": [
    {
      "_name": "Apple M1 Pro",
      "spdisplays_mtlgpufamilysupport": "spdisplays_metal3",
      "spdisplays_ndrvs": [
        {
          "_name": "Color LCD",
          "_spdisplays_display-product-id": "a050",
          "_spdisplays_display-serial-number": "fd626d62",
          "_spdisplays_display-vendor-id": "610",
          "_spdisplays_display-week": "0",
          "_spdisplays_display-year": "0",
          "_spdisplays_displayID": "1",
          "_spdisplays_pixels": "3456 x 2234",
          "_spdisplays_resolution": "1728 x 1117 @ 120.00Hz",
          "spdisplays_ambient_brightness": "spdisplays_yes",
          "spdisplays_connection_type": "spdisplays_internal",
          "spdisplays_display_type": "spdisplays_built-in-liquid-retina-xdr",
          "spdisplays_main": "spdisplays_yes",
          "spdisplays_mirror": "spdisplays_off",
          "spdisplays_online": "spdisplays_yes",
          "spdisplays_pixelresolution": "spdisplays_3456x2234Retina"
        },
        {
          "_name": "LEN LT3053pwA",
          "_spdisplays_display-product-id": "60a4",
          "_spdisplays_display-serial-number": "1010101",
          "_spdisplays_display-vendor-id": "30ae",
          "_spdisplays_display-week": "43",
          "_spdisplays_display-year": "2013",
          "_spdisplays_displayID": "2",
          "_spdisplays_pixels": "2560 x 1600",
          "_spdisplays_resolution": "2560 x 1600 @ 60.00Hz",
          "spdisplays_mirror": "spdisplays_off",
          "spdisplays_online": "spdisplays_yes",
          "spdisplays_pixelresolution": "2560 x 1600",
          "spdisplays_resolution": "2560 x 1600 @ 60.00Hz",
          "spdisplays_rotation": "spdisplays_supported"
        },
        {
          "_name": "LEN LT3053pwA",
          "_spdisplays_display-product-id": "60a4",
          "_spdisplays_display-serial-number": "1010101",
          "_spdisplays_display-vendor-id": "30ae",
          "_spdisplays_display-week": "41",
          "_spdisplays_display-year": "2013",
          "_spdisplays_displayID": "3",
          "_spdisplays_pixels": "2560 x 1600",
          "_spdisplays_resolution": "2560 x 1600 @ 60.00Hz",
          "spdisplays_mirror": "spdisplays_off",
          "spdisplays_online": "spdisplays_yes",
          "spdisplays_pixelresolution": "2560 x 1600",
          "spdisplays_resolution": "2560 x 1600 @ 60.00Hz",
          "spdisplays_rotation": "spdisplays_supported"
        }
      ],
      "spdisplays_vendor": "sppci_vendor_Apple",
      "sppci_bus": "spdisplays_builtin",
      "sppci_cores": "16",
      "sppci_device_type": "spdisplays_gpu",
      "sppci_model": "Apple M1 Pro"
    }
  ]
}

I use that in my hacky python script to get the correct ordering of ids based on the week/year combo for hammerspoon.

@ThBeS
Copy link

ThBeS commented Aug 17, 2023

@jakehilborn @FloWi
Let me ask if someone could give me a hint on how to also set the “_spdisplays_displayID” or „Contextual screen id“ as this is being used in e.g. Microsoft Office.
Luckily, I have unique Serial screen ids on my external displays “Eizo FlexScan EV2785 S/N: 99887042”, to the left, and “Eizo FlexScan EV2785 S/N: 26867072”, to the right, see also below.
displayplacer is great, but within System Settings/ Display/ Arrange Displays on M2 Pro Ventura 13.5, I need “EV2785 (1)” top left of “Built-In Display” and “EV2785 (2)” top right with:

  • EV2785 (1): Eizo FlexScan EV2785 S/N: 99887042 plus “_spdisplays_displayID” or „Contextual screen id“ equals 2
  • EV2785 (2): Eizo FlexScan EV2785 S/N: 26867072 plus “_spdisplays_displayID” or „Contextual screen id“ equals 3

displayplacer list | grep "Serial screen id"
Serial screen id: s4251086178
Serial screen id: s99887042
Serial screen id: s26867072

system_profiler SPDisplaysDataType -json | jq '[ .SPDisplaysDataType[].spdisplays_ndrvs[]? |
{ _name: ._name,
"_spdisplays_display-serial-number": ."_spdisplays_display-serial-number",
_spdisplays_displayID: ._spdisplays_displayID,
"_spdisplays_display-week": ."_spdisplays_display-week",
"_spdisplays_display-year": ."_spdisplays_display-year",
_spdisplays_pixels: ._spdisplays_pixels,
_spdisplays_resolution: ._spdisplays_resolution,
}
] '
[
{
"_name": "Color LCD",
"_spdisplays_display-serial-number": "fd626d62",
"_spdisplays_displayID": "1",
"_spdisplays_display-week": "0",
"_spdisplays_display-year": "0",
"_spdisplays_pixels": "3456 x 2234",
"_spdisplays_resolution": "1728 x 1117 @ 120.00Hz"
},
{
"_name": "EV2785",
"_spdisplays_display-serial-number": "5f427c2",
"_spdisplays_displayID": "2",
"_spdisplays_display-week": "17",
"_spdisplays_display-year": "2022",
"_spdisplays_pixels": "3840 x 2160",
"_spdisplays_resolution": "1920 x 1080 @ 60.00Hz"
},
{
"_name": "EV2785",
"_spdisplays_display-serial-number": "199f580",
"_spdisplays_displayID": "3",
"_spdisplays_display-week": "28",
"_spdisplays_display-year": "2022",
"_spdisplays_pixels": "3840 x 2160",
"_spdisplays_resolution": "1920 x 1080 @ 60.00Hz"
}
]

@ThBeS
Copy link

ThBeS commented May 28, 2024

Hi all,
any idea what I could do? Did I miss anything?
Thanks and best regards
Thomas

@FloWi
Copy link

FloWi commented May 28, 2024

Let me ask if someone could give me a hint on how to also set the “_spdisplays_displayID” or „Contextual screen id“ as this is being used in e.g. Microsoft Office.

@ThBeS I think those values are immutable and set by macOS. You need to use those displayIDs in the programs. I use a hammerspoon script that hooks into the screensDidUnlock event and executes a python script to get the IDs and does stuff with it (e.g. write it into a config file of an app)

@ThBeS
Copy link

ThBeS commented May 30, 2024

Hi FloWi,
may I ask you to send me your script?
Best regards
Thomas

@FloWi
Copy link

FloWi commented May 30, 2024

sure - don't have time to clean it up or put down much comments though. I'm also kinda happy it still works, because it was a hack ;-)

Good luck!

https://gist.github.com/FloWi/107ba7e80ea4411e8935da7cbc38df0e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests