Mac loses window positions when you lock it
27 October 2026 · Martín Acuña Lledó · Applies to macOS 13 Ventura through macOS 27
You lock the Mac, go for a coffee, come back five minutes later, and every window from your external monitors is piled on the laptop screen or on one of the monitors. You did not sleep the Mac, you did not unplug anything, you only locked it. It happens to people with one external monitor and to people with three, on MacBooks, Mac minis and Mac Studios. Here is why, how to confirm it on your own Mac, and what you can do about it.
Why locking moves your windows
Locking the screen is not the problem by itself. What moves the windows is what happens a little later: macOS turns the displays off to save power, and many monitors take that as a signal to go to sleep too.
- A sleeping DisplayPort monitor is an unplugged monitor. DisplayPort, USB-C and Thunderbolt monitors usually drop their link when the panel goes to sleep. From the Mac's point of view, that is exactly the same as pulling the cable out.
- macOS rescues the windows, then forgets them. When a display disappears, macOS moves its windows to a display that is still there, usually the built-in screen or the main monitor. When the monitor comes back after you unlock, macOS does nothing to move them back.
- Monitors wake slowly and in no fixed order. The Mac wakes in under a second; monitors take a few seconds, often one before the other. Windows get laid out on whatever exists at each moment, so they can end up scattered across the wrong screens rather than piled on one.
That is why the same desk can behave differently from day to day: it depends on whether the monitors had time to fall asleep while you were away. A quick lock and unlock often leaves everything alone; a long lunch usually does not. HDMI monitors tend to stay connected while asleep, which is why some people only see this on one of their screens.
Check it on your Mac
Two Terminal commands show what is going on. The first prints how many minutes of inactivity it takes for macOS to turn the displays off:
pmset -g | grep displaysleep
The second lists when the displays were actually turned off and on:
pmset -g log | grep "Display is turned"
If the times your windows moved match a "Display is turned off" line, you are looking at this problem. Locking with Control-Command-Q and walking away is enough to trigger it once the display timer runs out.
Settings that stop it
The goal of every fix below is the same: keep the monitors from disconnecting while you are away.
- Never turn the display off; use a screen saver instead. In System Settings → Lock Screen, set "Turn display off when inactive" to Never, choose a screen saver, and require a password when it starts. The screen is still protected, but the monitors stay on and connected, so nothing moves. This is the most reliable fix for the coffee-break case.
- Turn off deep sleep in the monitor's menu. Many Dell, LG and BenQ monitors have a setting, often called "DisplayPort deep sleep", "Deep sleep" or "Auto standby", that cuts the link completely when the panel sleeps. With it off, the monitor can sleep while keeping the link alive, and macOS sees no disconnect.
- Keep the Mac awake on power. In System Settings → Energy, turn on "Prevent automatic sleeping on power adapter when the display is off". It does not stop the display case on its own, but it avoids the Mac sleeping on top of it, which makes the next unlock much messier.
- Try HDMI for the monitor that misbehaves. HDMI monitors usually stay connected while asleep. The trade-off on many Macs is a 4K at 60 Hz limit on HDMI and no daisy-chaining.
More options, including dummy plugs and scripts, are in every fix for windows moving after sleep.
What those settings do not fix
Keeping the displays awake solves the lock case, but only that one. Your windows still move when:
- the Mac itself goes to sleep, or you close the MacBook lid;
- you unplug the dock or a monitor cable and plug it back;
- the monitor's own power saving kicks in regardless of the Mac's settings, which some models do;
- you have two identical monitors that swap places when they reconnect, covered in two identical monitors swap places after sleep.
The settings also have a cost: monitors that stay on all day while you are away, or a cable choice you would not otherwise make.
How Many Displays handles it
Many Displays takes the other route: it lets the monitors sleep and puts the windows back afterwards. It saves where every window is as you work, within about a second and a half of a change. The moment the Mac locks, sleeps, a display sleeps or a display disconnects, saving freezes, so the mess macOS makes while you are away is never recorded.
When you come back and the displays have been stable for a few seconds, it returns every window to its physical display, position and size, in several quick passes because macOS keeps nudging windows for a while after a wake. If macOS also changed the arrangement, the main display, the resolution or the rotation, those are put back first. For three minutes after a restore, moves nobody asked for are undone. You do not save layouts or press a shortcut; there is one (Control-Option-Command-R) if you ever want to restore on demand.
One thing it cannot do: 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.
Download the free trial How it works
Questions
Why do my windows move when I lock my Mac?
Locking the Mac usually turns the displays off a moment later. A DisplayPort, USB-C or Thunderbolt monitor that turns off drops its link, macOS treats that as the monitor being unplugged and moves its windows to a display that is still there. When you unlock, the monitor comes back but macOS does not move the windows back.
How do I stop windows moving when I lock the screen?
Keep the displays from turning off while you are away: set Turn display off when inactive to Never in Lock Screen settings and lock with a screen saver, or turn off the deep sleep option in the monitor's menu. Both keep the link alive, so macOS sees no disconnect. Neither helps when the Mac itself sleeps or you unplug a dock.
Is this a bug in my monitor or my cable?
Usually not. It happens with DisplayPort and Thunderbolt monitors from every brand, because the link really drops when the panel sleeps. HDMI monitors tend to stay connected while asleep, which is why some people only see it on one of their screens.
Does it happen on macOS 26 and 27?
Yes. As of October 2026 no macOS release has changed how windows are placed when a display disconnects and comes back.