MacOS – Preserve spaces order on monitor unplug on MacBook

displaymacosspaces

I'm running the latest macOS (10.12.6) and something keeps annoying me a lot with Spaces: if you have an external monitor plugged in and spend some time configuring/customising your spaces placement, when you unplug the monitor, everything is semi-randomized. Semi, because most of the spaces will stay in the same order, but the number of spaces and the location of the spaces will still change.

Here is what I have when the monitor is plugged in:

  • Monitor
    • space 1: empty
    • space 2: app
    • space 3: app
    • space 4: empty
  • mac book screen
    • space 5-10: app (1 per space)
    • space 11: empty

When I unplug the monitor, it becomes this:

  • space 1: apps that was previously on space 5 and 6
  • space 2-3: ok, same apps as before
  • space 4-5: empty
  • space 6: app that was previously on space 7
  • space 7: app that was previously on space 8
  • ^ repeat up to space 9 / previously space 10
  • space 10: empty
  • no more space 11

This is mostly annoying because I use keyboard shortcut to move between spaces, so basically I have a mental mapping of shortcut to app, but then it's all mixed up as soon as I unplug the monitor.

Is there a way to prevent this behaviour?

Best Answer

Our questions weren't identical (which is why I went ahead and posted my own question) but I think the answer to mine would help you too: Spaces disappear (but not their application windows) when I unplug external monitors

In brief: you can prevent the behavior by unchecking "Displays have separate Spaces" in System Preferences -> Mission Control, but you may or may not like the new behavior any better. Spaces won't disappear anymore but you'll cycle through Spaces on all monitors at the same time, and when you plug your monitors back in, you may find that all application windows stay in the right Spaces but lose their placement (i.e. if you carefully arranged the application windows to fit nicely next to each other on your screen, you may find the windows all stacked on top of each other when you plug the monitor back in).

Whether or not you choose to uncheck "Displays have separate Spaces," you can use a window management app such as Stay or DisplayMaid to save your window configuration and move the windows back to your preferred arrangment after a change.