Windows Management: Dealing with HDMI Matrix #3809
macdaddie
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Monitor name lost after HDMI matrix switch – workaround using UUID fallback in Hammerspoon
Context
I'm using a macOS setup with multiple external monitors, one of which is routed through an HDMI matrix switch. When I toggle the matrix to another source and then return it back to the Mac, Hammerspoon loses access to the monitor’s display name via
hs.screen:name()— it returnsnilor"".The reason I'm using `name()' rather than the screen position is that following the use of the HDMI matrix the screens can reorder themselves randomly.
Despite trying things like:
hs.reload()hs.screen.restoreGamma()killall -HUP WindowServer…macOS doesn't re-register the display name for the HDMI-matrix-connected monitor. However, interestingly, the monitor's UUID (
hs.screen:getUUID()) remains stable across switches.This breaks any monitor-specific logic that relies on
screen:name()(like placing windows on a named screen).Problem Summary
After switching an HDMI matrix away from and back to a Mac-connected monitor:
screen:name()becomesnilor""hs.reload()or even WindowServer resets do not restore the nameMy Workaround
Since only one of my monitors is routed through the matrix, I wrote logic to assume that any screen with no name is the matrix-connected monitor, and fallback to using its UUID.
This allows me to:
Caveat
This workaround is fine as long as you only have one matrix-routed monitor. It falls down if you have multiple monitors plugged into the HDMI matrix if they all lose their name.
Would love input from others:
hs.screenwith matrixed or virtual monitors?Hopefully this helps someone else running into the same issue!
Beta Was this translation helpful? Give feedback.
All reactions