A MacBook, a dock and different monitors at home and at the office
3 November 2026 · Martín Acuña Lledó · Applies to macOS 13 Ventura through macOS 27
You work from a dock with two monitors at home, a different monitor at the office, and the laptop alone on the train. Every time you plug in, the windows are piled on the laptop screen, or the monitors are in the wrong order, and the first minutes at the desk go on dragging things back. This page explains what macOS keeps and what it drops, what you can do without an app, and where a dock makes things harder.
Why a MacBook forgets at every desk
- Unplugging the dock is a real disconnect. Every monitor behind the dock disappears at once, and macOS moves their windows to the built-in screen, the only display left.
- macOS does not move them back. When you plug the dock in again, the monitors come back as empty screens. The windows stay on the laptop until someone drags them.
- macOS remembers monitors, not window layouts. It keeps the arrangement, main display, resolution and rotation for monitors it can recognise, so a known desk often looks right while its windows are in the wrong place. There is no window layout stored for "home" or "office".
- Monitors come back one at a time. They wake a few seconds apart and in no fixed order, and macOS lays windows out on whatever exists at each moment. If yours report the same serial, the arrangement can swap as well: see two identical monitors swap places after sleep.
- A lock can do the same. Monitors that sleep usually drop their link: see Mac loses window positions when you lock it.
Check what the dock hides
On a Mac with Apple silicon, this shows which port of the Mac each external monitor arrives through:
ioreg -r -c IOMobileFramebufferShim -l -w0 | grep -o '"PortID"=[0-9]*'
You get one line per monitor. Different numbers mean different ports. Behind one dock, two monitors usually share a port, so you will usually see the same number twice. This one shows what each monitor reports about itself:
ioreg -r -c IOMobileFramebufferShim -l -w0 | grep -o '"ProductAttributes"={[^}]*}'
Compare SerialNumber, YearOfManufacture and WeekOfManufacture. If the serials are equal or 0, read the section on identical monitors first.
Fixes without an app
None of these keeps a window layout per desk, but they remove part of the mess.
- Turn off "Displays have separate Spaces" in System Settings → Desktop & Dock → Mission Control. A desktop then spans all displays, so sleep changes a window's display but not its desktop. It does not stop windows moving between displays or back to the laptop.
- Plug each monitor into the same dock output every time. If you swap the cables, macOS and every tool can see the monitors as swapped. It does not move a single window.
- Plug in, wait, then unlock. Let every monitor show a picture before you log in. Giving the monitors a head start reduces the shuffle at wake. Windows that macOS moved to the laptop when you undocked stay there.
- Update the dock's firmware. CalDigit, OWC and Plugable all have knowledge-base articles on monitors not waking or returning in the wrong order. It can fix a monitor that wakes late, not what macOS does with the windows.
- Keep one displayplacer command per desk. displayplacer is a free command-line tool that sets resolution, rotation, position and the main display. You can keep one script for home and one for the office. It does not move windows, and with identical monitors its IDs can change between sleeps.
One thing that does not help here: the anti-sleep settings. Keeping the display awake with a screen saver, or turning off deep sleep in the monitor's menu, avoids disconnects at a desk where everything stays plugged in. Pulling the dock out still disconnects everything. The rest of the list is in every fix for windows moving after sleep.
Apps that store a layout per desk
There are two approaches, depending on whether your layout is fixed.
- A set of windows per combination of displays. Stay's site says it can store a set of windows for every combination of displays you use, and can be configured to restore them automatically as displays connect and disconnect.
- A named layout you activate. Moom lets you lay out your windows, save a layout and activate it when you want it. Its site says saved layouts try to adjust to displays of a different size. The windows go where the layout says, not where they last were, so it suits a fixed way of working.
The hard case: identical monitors behind one dock
A dock removes the best clue for telling two identical monitors apart. On Apple silicon the physical port is a reliable way to do it, as long as each monitor has its own port on the Mac. Behind one dock, two monitors usually share the Mac's port, so the port cannot separate them.
What is left is the manufacture date in the EDID. Monitors bought at different times are told apart by it. Two identical ones from the same batch, behind one dock, are the hardest case: serial, port and date can all match, and only their position remains, which is exactly what macOS may have just swapped. If your dock setup allows it, moving one monitor to its own port on the Mac gives any tool a clue that holds. More on these clues: what can tell two identical monitors apart.
How Many Displays handles it
Many Displays keeps one layout per combination of displays, so home and office are separate without you naming or saving anything. It saves as you work, within about 1.5 seconds of a window moving, and freezes saving the moment the Mac locks, sleeps or a display disconnects, so the pile on the laptop screen is never recorded.
- You undock. With no external displays the app goes idle and never moves a window on the MacBook alone. If undocking leaves the built-in screen at a wrong resolution, it restores the last known good mode.
- You dock again. Once the displays have been stable for a few seconds, it puts back the arrangement, main display, resolution, refresh rate, rotation and HDR, and then returns every window to its physical display, position and size. You press nothing.
- You connect a set it has never seen. A new office monitor, or the same monitors with the lid open, is restored from the closest saved setup and then remembered separately. If a display's resolution changed, positions are scaled proportionally.
- Your windows changed while you were away. Windows you closed are never reopened. New windows are left alone and remembered from then on.
Three limits to know about. Keep each monitor on the same port or dock output, because if you swap the cables the app will think the monitors swapped too. Two identical monitors from the same batch behind one dock fall back to position. And since macOS 14.5 no app can move another app's window to a different desktop (Space) without disabling System Integrity Protection, so it restores display, position and size, not the desktop. If a window ends up on a different Space, the menu says so. More on that in desktops move to the wrong monitor after lock.
The free trial lasts 14 days, with no account and no card.
Download the free trial How it works
Questions
Why does my MacBook lose its window positions when I unplug the dock?
Unplugging the dock disconnects every monitor behind it, so macOS moves their windows to the built-in screen. When you plug the dock back in, the monitors return as empty screens and macOS does not move the windows back.
Can a Mac keep a different window layout for home and for the office?
Not by itself. macOS remembers settings for monitors it can recognise, such as their arrangement and resolution, but it keeps no window layout for each set of monitors. For that you need a script or an app that stores a layout per combination of displays.
Do the anti-sleep settings help with a dock?
Only with locks and idle time at the desk. Keeping the display awake or turning off deep sleep avoids a disconnect while the monitors stay plugged in. Unplugging the dock is a real disconnect, and no setting prevents it.
What if two identical monitors are behind the same dock?
They usually share the Mac's port, so the port cannot separate them. Monitors bought at different times can still be told apart by manufacture date. Two identical ones from the same batch behind one dock are the hardest case.