MacOS: My Screens Keep Switching – How to Quickly Rearrange Displays

I am not sure what happened to macOS, but lately when my MacBook Pro goes to sleep, when I wake it back up about 50% of the time, the monitors will be completely flipped.

So I have to open up system settings, go to displays, click a monitor, position it, move the menu bar to the preferred monitor. It’s ok if this happen every great once in a while… but when it a rush… I need to get up and running quick. This can be fixed with an apple script called “displayplacer”.

Install home-brew

  • open terminal
  • paste that bash command in

Install displayplacer

  • In your terminal window, paste the following…
    • brew tap jakehilborn/jakehilborn && brew install displayplacer

Gather the Preferred Display Setup

  • Arrange your monitors they preferred way
  • In your terminal window run displayplace list
    • example:
    • Execute the command below to set your screens to the current arrangement:
      				displayplacer "id:23149686-42B2-4A98-939A-8D05AAA23CE8 res:1920x1080 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:CF07EF7A-0F98-4D27-90BE-3A40330C0DB1 res:1920x1080 hz:60 color_depth:8 scaling:off origin:(1920,0) degree:0"
  • At the bottom of the output copy the displayplacer command (yours will be different than mine)
  • find the true path of the displayplacer app with the which command
    • which displayplacer
    •  % which displayplacer

Create MacOs Shortcut

  • Open shortcuts
  • In the Quick Actions sidebar: Click the plus sign to make a new shortcut
  • Call it, display_update
  • In the “search for apps and actions”
    • Search for “Run Shell Script”
  • Drag it to the center for “add actions”
  • Replace the text echo "Hello World" with the displayplacer command from the earlier step.
    • replace the displaceplacer with the fullpath like:
      • /opt/homebrew/bin/displayplacer
  • Click the button “Pin in Menu Bar”
  • The finished shortcut should look like this:
  • You can mess up your displays, then click the play button to test if you like

Create a Keyboard Shortcut

  • In the Shortcuts app, Click the button while having the “displayupdate” open.
  • Click “add keyboard shortcut”
  • Press the keyboard key combination you would like.
    • I suggest cmd+9 or a cmd and a number for now
  • Now go to system preferences > Keyboard > shortcuts > Services
  • Now scroll down to find the new shortcut you created and “display update” and click the shortcut commands.
  • Update it with “shift+ctrl+cmd+9”
  • That is more successful so it doesn’t conflict with other keyboard shortcuts with other apps

Run it!

The next time your computer displays are not in the preferred format… fix it with 1 of 2 ways

Keyboard shortcut

  • Press “shift+ctrl+cmd+9”

Menu Bar Click

  • At the top of your screen, you should see the shortcuts icon
  • Click that and it should list the “display update” shortcut we just created.
  • Click that and it will run.

About Daniel Fredrick

Technology enthusiast, Programmer, Network Engineer CCIE# 17094

View all posts by Daniel Fredrick →

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.