Monday, September 26, 2022

MacOS Display Derangement

Overview

The title is intentional, because MacOS falls short of actually accomplishing display arrangement in some circumstances.

Circumstances

When multiple monitors of certain brands and models are plugged into a MacBook, the part of MacOS that derives a "unique" identifier for each monitor fails to distinguish between them.  The HP E243 is one example, but there may also be other brands/models that reveal this flaw in MacOS' handling of external monitor identification.  Since MacOS cannot tell which specific display was previously arranged in a particular position (relative to the internal display, or other external displays, or each other), the overall arrangement sometimes gets mangled.  The only common way to re-arrange the monitors is by way of the cumbersome "System Preferences -> Displays" dialog in MacOS.

Remedy

After years of searching for a reasonable solution to this issue, and hoping Apple would get it fixed (but has not as of Monterey / 12.6), I finally found, sorta by accident, a command line utility (the best kind IMO) with the source code published on Github, called DisplayPlacer.  DisplayPlacer removes "most" of the annoyance of this Apple MacOS bug.  It still requires a manual step (running a command/script) to force displays back into a captured/desired arrangement, but is WAYYYYYYYY better than using the MacOS "System Preferences -> Displays" UI every time.

Steps

  • Install displayplacer (brew tap instructions on the github repo)
    • https://github.com/jakehilborn/displayplacer
  • Arrange displays using the MacOS System Preferences -> Displays (yup... one last time)
  • Run displayplacer list and copy/capture the displayplacer command that is printed to the console, which contains all of the distinct display ids, resolutions, refresh rates, and relative positions.
  • Create a shell script containing the captured command.
  • Whenever MacOS !@#$% the display arrangement again, run the shell script to pop everything back where it is supposed to go.

Conclusion

This isn't my utility.  The author Jake Hilborn had done us all a favor by making MacOS less annoying while we all continue to wait, maybe indefinitely, for Apple to finally acknowledge this is a problem and fix it themselves.  I would recommend sending Jake a thank you, or maybe find a way to buy him a cup of coffee (or similar).  I only posted this so there will be yet one more way some of you might end up finding Jake's excellent work, and maybe end some of your frustration with the display "derangement" on your MacBook.