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

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.

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.

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.

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.