How to put windows back when you reconnect a monitor
Use KeyRoutines' Display changed trigger set to connected, check Monitor count so it only runs with all your monitors on, wait a moment with Delay, then run Restore layout with a layout from your Layouts library. Your windows go back to their monitors every time you dock.
Steps
- 1
Save your layout
Arrange your windows across your monitors and save it to the Layouts library, for example as Docked.
- 2
Watch the displays
Add the Display changed trigger and set it to fire when a monitor connects.
- 3
Check all monitors are on
Add an If with Monitor count set to at least 2 (or however many you dock to).
- 4
Give Windows a moment
Add a Delay of 3 seconds so Windows finishes rearranging the desktop.
- 5
Restore the layout
Add Restore layout from the library with the Docked layout.
Tips
- Monitors are matched by their saved id and name, not Windows' number, so the layout follows the right screen even if Windows renumbers them.
- Make a second layout for undocked use and restore it when Monitor count is 1.
Questions
- Will it fire when a monitor just wakes from sleep?
- If Windows treats the wake as the monitor reconnecting, yes. That's exactly when windows tend to move, so it helps there too.
- Can it also move the taskbar or change the main monitor?
- No. Restore layout moves app windows; it doesn't change Windows' display settings.