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.
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.
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?
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.
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:
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.