Apple - Maintain allocation of windows to spaces on restart and external monitor unplugging

After some experimentation, I've been able to keep all windows in the proper spaces across unplug/replug by adding 1 extra blank space on my laptop screen.

While plugged in to external monitor, I have #1 on monitor and #2 & 3 on the laptop (call these 1a, 2a, 3a). #2a is kept blank.

Upon unplugging, there is some merging and rearranging of the Spaces happening:

1a + 2a -> 1b (This is why I left 2a blank)

3a -> 2b

End result when unplugged is my original stuff which was separated is still separated, I just don't have the extra blank display.

There's probably some way to extrapolate this merging behavior with more than 3 displays.


There may be other options, but I’ve enjoyed using an app called Stay, from Cordless Dog: https://cordlessdog.com/stay/.

It takes a few steps to save and edit your window arrangement, but once you set it up, Stay handles plugging/unplugging of displays pretty seamlessly.

To set it up, you "store" window(s) for the current application, or all applications. These "stored windows" are saved for your current display configuration.

I don’t use Spaces regularly, but according to the docs for Stay, if you download the app directly from the developer, instead of the Mac App Store, the app does support Spaces: https://cordlessdog.com/stay/documentation/faq/#spaces

One tip: if you want all windows for a particular app to always be the same size and position of the current window you have open, use the "Match all windows" pattern after you store the window (look up "Window Title Pattern Matching" in the website Docs).