Mac Window Layout Keeps Resetting? How to Put Your Windows Back After You Dock or Wake Your Mac
macOS scrambles your window positions when you dock, undock, or wake from sleep. Here's how to put them back: automatically when your monitors change, or with one hotkey.
Every time you unplug your MacBook from its monitor, or wake it from sleep, macOS moves your windows - shuffling them onto whichever display it feels like, resizing them, stacking them in a pile on your built-in screen. There is no built-in way to save your window positions and have macOS restore them automatically when your setup changes. Here is what actually works.
Why does macOS keep moving windows when I dock or undock?
When you disconnect an external monitor, macOS has to do something with the windows that were on it - so it dumps them all onto your remaining display, usually resized and overlapping. When you reconnect, it does not remember where anything was. It treats each connection as a fresh start.
This is not a bug Apple is rushing to fix. The operating system has no concept of a "display profile" - it does not know that your desk setup with two monitors is the same setup you use every day. Each time the monitor configuration changes, macOS just reflows windows according to its own rules, not yours.
Sleep and wake can cause similar disruption, particularly with external monitors connected via DisplayPort or docks that briefly disconnect during wake. The monitor re-announces itself, macOS registers a display change event, and windows shift again.
Does macOS Sequoia's built-in window tiling help?
Not really - and this is worth being direct about. Sequoia's window tiling lets you snap windows into halves, quarters, and preset arrangements, but it does not save those arrangements. Tile your windows into a perfect layout, close the lid, come back the next morning, and you are starting from scratch.
Sequoia also introduced a "restore windows" option when reopening apps, but this is per-app and unreliable - it applies to individual app state, not to a multi-app layout across multiple displays. If you have a coding environment with your editor on the left monitor, a browser on the right, and a terminal at the bottom, Sequoia has no mechanism to restore that as a saved configuration.
How to save and restore window layouts automatically on Mac
The only reliable way to do this is with a third-party window manager that understands display profiles. Not all of them do - Rectangle, for example, handles snapping very well but has no concept of saved layouts or monitor detection.
Layoutish is built specifically around this problem. You set up your windows the way you want them, save a named layout, and Layoutish can restore it automatically when it detects the right monitor configuration. The key feature here is display profile detection: Layoutish identifies your monitor setup (by each monitor's name and resolution) and applies the matching layout without you doing anything. Dock your MacBook and your work layout appears. Undock and switch to your single-screen layout. No manual steps.
For apps that were not already open when you docked, Layoutish launches them and positions them - you do not need to open everything first.
A few things worth knowing before you buy:
- Layoutish requires macOS 13.5 or later and one permission, Device Control and Data Access (Accessibility before macOS 27), which any window manager needs to move windows for you
- Some apps resist being repositioned. Layoutish checks where each window landed and tries once more for any that missed
- The price is $9.99 as a one-time purchase, with all future updates included
Setting up automatic layout restore when you dock your MacBook
Here is the setup flow that actually works for a dock/undock scenario:
- Connect your external monitors and arrange everything - position every window exactly where you want it across all your displays
- Open Layoutish from the menu bar and save the current layout with a name like "Desk"
- Save a display profile for this setup: click the layout's Display Profile button and save a profile for these monitors, with "Desk" as its layout
- Set up your laptop-only layout - disconnect your monitors, arrange your windows for single-screen use, and save that as "Laptop"
- Save a display profile for the laptop on its own, with "Laptop" as its layout. Automatic apply is on by default, so there's nothing else to switch on
From that point, Layoutish detects which monitors are connected when you dock or undock and applies the matching layout automatically. You can also apply any layout with its global hotkey or the Quick Switcher (⌘⇧L). That's also the way to put windows back if a wake leaves them out of place.
Time-based scheduling is also available - so if you want your "Morning" layout applied automatically at 9am on weekdays, that works too.
A few habits that help when you dock
- Use the same port for your dock every time: macOS can treat a different port as a different display setup.
- Keep your monitors in the same arrangement on the desk, matching System Settings → Displays → Arrange…
- Turn on apps' own window restore where they have one, such as IDEs and design tools, alongside a layout manager.
- Give macOS a moment after docking before you start opening windows, while it finishes setting up the displays. (Layoutish waits for the displays to settle before it applies a layout.)
If the Dock itself ends up on the wrong screen after you dock, see how to move the Mac dock to your external monitor.
What about apps that won't stay where I put them?
Some apps - Electron apps like Slack and Notion are common offenders - reposition themselves after launch rather than staying where a window manager puts them. They launch, draw their window, then move it based on their own saved state.
Layoutish checks where each window landed and tries again once if it missed. It is not perfect for every app in every situation, but it handles the common cases that trip up simpler window managers.
If an app is particularly stubborn, the workaround is to clear that app's own saved window position data (usually in ~/Library/Saved Application State/) so it stops fighting the layout restore.
Does this work with three or more monitors?
Yes - Layoutish saves layouts across however many displays you have connected. Each saved layout stores the position and size of every window on every screen, and display profile detection works with any monitor combination, not just two-display setups.
For a three-monitor desk setup, you save one layout. A meeting room with a projector can have its own too. For a single-screen laptop mode, you save another. If you have a second desk with a different monitor (different resolution or arrangement), you save a third. Layoutish tells them apart by each monitor's name and resolution.
For the wider how-to, including schedules and keyboard shortcuts, see how to save window positions on Mac and restore them automatically.
Common questions
Why do my windows all end up on my laptop screen when I unplug my monitor?
This is default macOS behaviour - when a display disconnects, all windows on it are moved to the primary internal display. macOS does not save or remember where they were. A window manager with display profile support is the only way to automatically restore them when you reconnect.
Does Rectangle save and restore window layouts?
Rectangle does not save named layouts or detect display configurations. It is excellent for keyboard-shortcut snapping and quick arrangements, but it has no persistent layout memory. If you need layouts that survive a dock/undock cycle, you need a tool like Layoutish that is built for that use case.
Will my apps be relaunched automatically if they were closed when I dock?
Yes, with Launch Apps on Restore turned on in Layoutish's Settings: when a layout is applied, any of its apps that aren't open are opened and their windows placed.