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

104

32

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?

Sai Phaninder Reddy J

Posted 2016-07-26T14:48:14.987

Reputation: 1 141

11Every time I connect my external monitors, its a crapshoot. As often as not, the displays are flipflopped. – George Cummins – 2017-05-08T14:17:09.867

3

Try this: https://superuser.com/questions/505234/keep-mac-desktops-in-place?rq=1

– Geva – 2017-06-08T07:40:37.013

4@geva This is not the same issue as desktops getting rearranged by recent usage. – Sai Phaninder Reddy J – 2017-06-12T18:04:17.953

1

Same problem today, with a MacBook Pro (15-inch, 2019). Two monitors, HDMI with adapter for USB-C. It happens at every plug/unplug if they are separated by minutes. @Josh answer applied, time will tell...

– Rémi Belzanti – 2019-08-09T12:18:22.693

2Well it's been 3 days and the problem is still there. Thus I must say the problem is also present after I lock the screen and unlock it minutes later... This means no physical plug/unplug operations, yet I'm in trouble :( – Rémi Belzanti – 2019-08-13T13:18:15.127

Problem solved. It was due to one of my screens that had a VGA connexion to another computer. I unplugged it to let the screen be connected only to my macbook through HDMI and the issue's gone. I assume it is due to the screen itself and the time it responds to the macbook pro may vary from times to times as it also checked the VGA connexion meanwhile. – Rémi Belzanti – 2019-09-05T14:13:11.010

Answers

46

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

Josh

Posted 2016-07-26T14:48:14.987

Reputation: 592

4

Screenshots here: https://apple.stackexchange.com/a/296905/206646

– ognockocaten – 2017-08-30T19:24:34.103

Just had this happen to me again (hasn't happened for a while so I forgot the solution) and this post came back up.

Thank you... again! – davestewart – 2017-09-15T09:13:04.220

2That's great. I had to re read my own post too recently! – Josh – 2017-09-17T14:56:17.040

5This doesn't work for me. :( – ForeverWintr – 2018-08-09T05:54:29.307

This changes the ordering of the desktops, though. If I use hotkeys to move an app from one monitor to another, they're now out of order. – red – 2019-07-18T14:23:12.900

4This is also just a temporary solution that needs to be done every time this problem happens. This also happens for me when the laptop wakes up from sleep mode (with all the screens still plugged in) – Vidak – 2019-07-22T12:24:12.037

Placing the top bar on my laptop (so that my laptop display is the primary display) is now working for me. If others have success with this method, please comment which screen you set to primary! – ForeverWintr – 2019-10-30T03:53:14.070

27

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.

aveneyer

Posted 2016-07-26T14:48:14.987

Reputation: 370

2this worked like a charm for me. upvoted! – Micah Stubbs – 2019-08-21T21:17:44.697

1Thanks for this! – Gary Reckard – 2019-08-31T03:40:34.897

Re: two identical monitors: FWIW, I use the laptop display (MBP 15") and 2 different external monitors -- one LG, one Samsung, both connected via CalDigit TS3+. I regularly see the desktops associated with the laptop display and the LG switch. (Planning to try displayplacer, thanks.) – Peter Cardona – 2019-09-13T12:22:46.660

1Somehow this still doesn't solve the issue that the monitor in front of me is suddenly not "LG HDR 4K (1)" anymore but "LG HDR 4K (2)" and vice versa for the monitor to the right. Thus selecting "Display 2" or "Display 3" in apps chooses a different screen. Is there a way to also change this? – Karsten S. – 2019-10-01T17:38:56.337

1I am using this with Better Touch Tool on the new Macbooks. I can customize the top touch bar, and have now added a 1 button click to automatically adjust the monitors.

Great solution, thank you. – Will – 2019-10-17T22:02:01.357

@KarstenS. You may want to check the Displayplacer information for your issue. Displayplacer shouldn't be giving you the name of your monitors, but instead should be giving you a screen id ("id"). Those IDs should not change, but Displayplacer documentation does give caution about a situation where it could.

Persistent screen ids always stay the same. Contextual screen ids change when switching GPUs or when switching ports. It's recommended to use persistent screen ids. In some rare cases, you may need to use contextual screen ids since the modes list changes when macOS switches GPUs. – aveneyer – 2019-10-21T20:46:56.143

3@aveneyer I tried displayplacer but it didn't help. The problem is rather that the actual spaces are moved to different monitors after wakeup but the monitors and monitor setup stays the same. Thus displayplacer list gives me identical values even though all windows are wrong. It completely switches the spaces you may have set up and suddenly my monitor to the right has 2 spaces and the center only one. Should be the other way round. – Karsten S. – 2019-11-06T08:57:11.940

16

For me it's based on which cable I plug in first, even when I plug them into the same ports. I'm using two HDMI cables. If my screens end up swapped, I just unplug one of the cables and plug it back in. If the screens are still swapped, I unplug the other one and plug it back in. The screens will both flicker and they'll swap back to normal.

This seems like an OS bug, but I have no way of knowing for sure.

Dan

Posted 2016-07-26T14:48:14.987

Reputation: 612

4we use CalDigit TB3 docks and have this issue, intermittently – race_carr – 2019-03-08T17:42:45.550

1I'm using HDMI cables plugged directly into the laptop via USB-C converters. – Dan – 2019-08-29T19:14:21.517

That was it!!! Thank you so much for finding this. I was driving me nuts!! – nolazybits – 2020-02-13T19:35:25.667

3

Apple Support helped me out with this:

  • Go to the Finder (click on desktop) and then hover over the "Go" menu at the top of your computer screen
  • Now press the "option" button while still hovering over "Go" and you will see the "Library" folder choice appear
  • Choose "Library" by highlighting it.
  • With the Library folder open in front of you, locate the "Caches" folder.
  • Now drag it to the trash.
  • Empty the trash.
  • Restart.

Eureka! This solved this annoying screen switch problem for me in mission control, where my Mac desktops would automatically switch by themselves when working in one of the four open Mac desktops.

Jerry Levine

Posted 2016-07-26T14:48:14.987

Reputation: 39

Just tried this, hopefully it will work as this happens to me every time my Mac sleeps! – Josh Cole – 2018-10-31T10:57:13.007

2This doesn't work for me. :( – SpaceDog – 2019-05-29T08:56:02.940

Doesn't work for me either. :( – ForeverWintr – 2019-06-15T19:03:30.407

2

UPDATE - I figured out how to get this working by automating the rearrange displays menu bar system preference. Please view my solution from this thread. This solution is for ALL the peeps that have to manually change the menu bar in the displays system preference.

Unfortunately, I've tried all the solutions mentioned and the only thing that works for my computer (macOS 10.14.6 , MacBook Pro 15-inch, 2018, Radeon Pro Vega 20 4 GB – view screenshot) is opening Displays in System Preferences and dragging the menu bar through all the displays and ending back on the main monitor you started from. It's such a pain...

For those using the Keyboard Maestro method (and it works for you), but you use another shell like oh-my-zsh, you'll have an issue using the displayplacer script because it's using bash instead of oh-my-zsh. There are 2 fixes for this that I've listed below.

Option 1: Export PATH in .bash_profile

  1. Edit your .bash_profile using your editor
  2. Insert export PATH="$PATH:/usr/local/bin"
  3. Save file and restart Terminal or Keyboard Maestro

Option 2: Use absolute path reference

  1. Add /usr/local/bin/displayplacer [enter_display_code] to your Keyboard Maestro shortcut, e.g. view Keyboard Maestro screenshot

Billy

Posted 2016-07-26T14:48:14.987

Reputation: 21

1

What seems to work for me so far, after one week of trying, is simply connect each monitor to an USB-C port on a different side of the laptop.

Karel

Posted 2016-07-26T14:48:14.987

Reputation: 11

1

It is based on which application you are using when you plug in; it will try to keep current application on your Macbook.

Michael Wong

Posted 2016-07-26T14:48:14.987

Reputation: 11

0

I've got a display-setup with two identical displays connected via two separate HDMI-Adapters in two separate USB-C ports. My Macbook Pro is always connected to the displays and whenever it wakes up from sleep-mode, the displays-arrangement is mixed up. My solution until this day was to rearrange the displays via "System Preferences". Now I'm using aveneyer's displayplacer-solution in combination with a shortcut setup to launch a shell-script in Keyboard Maestro and it works like a charm on Mojave!

roman-rhme

Posted 2016-07-26T14:48:14.987

Reputation: 11