Mac moves windows to the wrong screen after sleep: how to stop it
When a Mac or its monitor sleeps, macOS can lose the monitor for a moment and pile its windows onto the MacBook's own screen. When the monitor comes back, the windows often stay where macOS put them. macOS has no setting that fixes this. Sashay remembers where your windows sit and puts them back after each wake.
Why it happens
A monitor that goes to sleep, a dock that drops its displays for a second, or a slow cable can each look to macOS as if the monitor was unplugged. macOS then moves every window from that screen onto one that is still there, so you never lose one. It doesn't reliably move them back.
What macOS offers
No setting puts windows back. You can drag each one back by hand. In many apps the Window menu also has a Move to item for each screen, which sends the front window across.
Fix it with Sashay
Sashay keeps a layout of where your windows sit for each set of screens. It saves the layout every 30 seconds and whenever a display arrives, and after sleep it puts back any windows that macOS moved.
- Download Sashay and drag it to Applications.
- Open it, click Open Accessibility Settings and switch Sashay on. macOS asks for this before any app may move another app's windows.
- In Sashay's Settings, under Layouts, leave Remember where windows sit on each set of screens and Put windows back after sleep on. Both start on.
- Use your Mac as usual. After the next wake, the windows macOS moved go back where they were, and a note offers Undo.
The same layouts help when you unplug: each window goes back to where it sat on the MacBook. If the monitor comes back within 20 seconds, as when a dock drops it for a moment, Sashay puts the windows back on it without asking.
To put windows back by hand at any time, press Control-Option-Command-R, or right-click Sashay's menu bar icon and choose Put windows back.
Sashay keeps its layouts on your Mac and stores window titles only as one-way hashes, never as text.
If it doesn't work
- Some windows stay put. Sashay moves windows on each screen's current desktop. Windows on other desktops stay where they are in this version.
- Nothing went back after the first sleep. Give Sashay 30 seconds after you arrange your windows, so it has saved them before the Mac sleeps.
- Sashay can't move windows. Check it is switched on in System Settings, Privacy & Security, Accessibility. If it is on and Sashay still asks, click Reset and try again in its Settings, or run
tccutil reset Accessibility ai.lfglabs.sashayin Terminal and switch it on again.