Guide
Windows moved while you slept? Put them back
You wake your Mac and every window is piled onto one screen, or on the wrong Desktop. Here's what macOS did, what you can change for free, and how a saved layout brings the windows back.
The short answer
When a display disappears, even for a moment during sleep, macOS moves its windows to a screen that's still there. When the display comes back, macOS usually leaves them where they are.
- Check first: whether the monitors themselves moved (that's a different fix), and the free Desktop and Spaces settings below.
- To get windows back: save the layout and restore it, by hand or automatically when the monitors reconnect. Several apps do this, Universal Display Magnet among them.
Two problems that look like one
Before you fix the windows, check the screens. Move the pointer off each edge of each monitor.
- The pointer leaves at the wrong edge, or the menu bar moved: macOS changed the display arrangement. Fix that first with the monitor arrangement guide; restoring windows onto a wrong arrangement puts them in the wrong place.
- The screens are right, the windows aren't: read on.
Why windows move
- A monitor drops off during sleep. Some monitors and docks disconnect completely when they sleep. macOS sees a display removed and gathers its windows onto the screens that remain.
- Displays wake at different times. For a few seconds only one screen exists, and windows land there.
- Desktops rearrange themselves. macOS can reorder Desktops by how recently you used them, so windows appear to move between Spaces.
- Apps place their own windows. Some apps reopen windows where they last saved them, whatever the screens look like.
Free checks first
- Stop Desktops reordering. In System Settings → Desktop & Dock, under Mission Control, turn off Automatically rearrange Spaces based on most recent use.
- Keep each Desktop on its display. In the same section, Displays have separate Spaces gives each monitor its own Desktops. Leave it set the way you use it; changing it takes effect after you log out.
- Assign apps to a Desktop. Control-click an app in the Dock, choose Options, then pick a Desktop under Assign To. That app's windows open there.
- Look at the monitor's own settings. Power-saving and automatic input options can make a monitor disconnect while asleep. If yours has them, try turning them off.
- Test without the dock. If windows stay put with the monitors connected directly, the dock or adapter is dropping the display. Check its maker for a firmware update.
These help, but macOS has no setting to save where every window was and put it back later. For that you need an app.
Save and restore your layout
Several Mac apps save window layouts and restore them, some automatically when a display connects: Rectangle Pro, Moom, Display Maid, Stay and ShiftPlus among them. The comparison page sets out what each one documents.
Universal Display Magnet is one of these options. It saves which monitor, which Desktop or full-screen Space and where each window was, for each set of monitors. The workspaces page shows the whole feature. Here's how it handles the sleep and reconnect case:
- Allow access. Turn on Universal Display Magnet under System Settings → Privacy & Security → Device Control and Data Access (Accessibility on older versions of macOS). It never asks to record your screen.
- Save a workspace. Lay out your windows, then choose Save Workspace… in the menu bar. Choose which apps to include, set a shortcut if you like, and turn on Also restore the monitor arrangement and resolutions if you want the screens put back too.
- Let snapshots run. The app keeps an automatic snapshot of window positions every few minutes and as the screens go to sleep, separately for each set of monitors.
- Sleep, wake or reconnect. When a monitor setup reconnects, or the Mac wakes with its displays changed, the app restores what you chose under When a display setup reconnects, restore in Settings: Last automatic snapshot (the default), Most recent saved layout or Don't restore.
- Restore by hand any time. Click a workspace in the menu bar, or press ⌃⌥⌘R to restore the latest window layout.
To put windows back on their Desktop, the app uses the macOS Switch to Desktop shortcuts. Turn them on with Workspaces → Enable ⌃1…⌃0 if they're off. You'll see Desktops switch briefly during a restore.
What a restore can't do
- Apps that aren't running. Automatic restores after wake or a reconnect never open apps; they move the windows of apps that are open. Restoring a saved workspace opens the workspace's apps that aren't running, then moves their windows. Restoring a window layout by hand, such as the latest snapshot with ⌃⌥⌘R, opens missing apps only if Open apps that aren't running when restoring manually is on in Settings; it's off until you turn it on.
- Documents, tabs and sessions. Only the app opens. It shows the windows it reopens by itself, and those are moved into place. Unsaved documents, browser tabs and project state aren't part of a workspace.
- Windows that no longer exist. Saved windows are matched to open ones by app and, where it can, by window title. A window you closed is skipped, and the result tells you how many windows were restored.
- Scrolling Windows. While the optional Scrolling Windows is on, automatic snapshots and restores pause. A manual workspace restore turns Scrolling Windows off first.
- Every app, Space and dock. Some apps move their own windows after they're placed, and some docks drop a display long enough to start the shuffle again. A restore puts back what macOS lets it move; it isn't a guarantee for every setup.
Where this has been tested
Universal Display Magnet requires macOS 14 or later and is verified on every version from 14 to 27, on Apple silicon and Intel Macs. To install it and save a first workspace, see getting started.
Questions, answered
Why do all my windows end up on my laptop screen after sleep?
Can macOS save and restore window positions by itself?
Will Universal Display Magnet reopen my documents and browser tabs?
Does it need Screen Recording permission?
My monitors are in the wrong order too. What do I fix first?
Read next
- WorkspacesSave every app's windows with their monitor, Desktop and full-screen Space, and restore them all with a click or a shortcut.
- Monitor arrangement keeps changingWhy macOS moves your displays around after sleep or a reconnect, what to check first, and how to keep the arrangement.
- Compare Mac display and window managersUniversal Display Magnet next to macOS, ChainYourMac, Magnet, Moom, ShiftPlus and BetterTouchTool: every feature side by side, with prices.
- Getting startedFrom your Polar purchase to an activated app, the right permissions and a first saved layout.
Snap your desk into place
One-time purchase · Three Macs · macOS 14 or later