Mac: 3 monitor setup: My desktop set keep switching places between monitors

Situation:

I have a MacBook pro MacBook Pro (Retina, 15-inch, Mid 2014)

And have 2 External Monitors ASUS VS247 Display connected via thunderbolt.

On each monitor, I have multiple Desktops/Spaces open.

Problem:

When I wake my mac from sleep, sometimes, it switches the recognition of the monitors and all the Desktops/Spaces from Monitor2 are now on Monitor3 and all Desktops/Spaces from Monitor3 are on Monitor2.

The main monitor (the one on the laptop) always stays the same.

This happens on an average once every month. I was unable to find a specific cause for this to happen.

I have my thunderbolt cables and ports color-coded. So, I am definitely not switching the cables around.

More info:

This is how my mission control settings look like.

[NO] Automatically rearrange spaces based on most recent use?
[Yes] When switching to an application, switch to a Space with open windows for the application.
[No] Group windows by application.
[Yes] Displays have separate Spaces.

Does anyone else have the same issue? If so is there a fix?


Solution 1:

I "solved" this problem using https://github.com/jakehilborn/displayplacer. If I connect my hub and the monitors are incorrect, instead of having to rotate screens or reconnect cables, I can now run a script (via a hotkey) to resolve this.

First, make sure your monitors are in the correct configuration. Then install displayplacer and run it.

brew tap jakehilborn/jakehilborn && brew install displayplacer
displayplacer list

At the bottom of the output you'll see that it generates the command which will place your monitors back into the current configuration. Example:

displayplacer "id:C00DE6B5-2BF1-D707-8452-14BD6BFAAC84 res:1920x1080 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:D0823E00-B252-0F5C-DE87-D142F95D0CB4 res:1680x1050 color_depth:8 scaling:on origin:(-1680,0) degree:0" "id:1A13BBCA-7176-912E-4048-7E7E22D786C2 res:1080x1920 hz:60 color_depth:8 scaling:off origin:(1920,-386) degree:90"

I then created a service/action and set a keyboard shortcut for this item. Now a quick keystroke will resolve the issue.

More info: The answer by Dan is the root of this problem for me. I have two identical monitors, both being connected to a hub via Displayport. That hub is connected to my mac via one USB-C connection. Randomly, the dock will load the settings in a different order which causes this issue. Since my 3rd monitor is rotated, this makes two screens now improperly rotated.

For months I have been disconnecting both DisplayPort connections on the hub, and then reconnecting in the reverse order. This solves the problem, but it was really annoying.

Solution 2:

Yes! I have 4 external monitors and this drove me nuts until I figured it out. Play around with moving the "top" bar between screens in the Arrangement window. Assign it to different screens and you will notice it will solve your issue once you find the "right" screen. I can't remember why that worked, but it did.

How to move the top bar between Mac windows

Alternatively, you can also drag one of the Mac windows around and then let it drop back into place.

How to shortly move the Mac windows arrangement