How do I restore windows back to their original screen when re-connecting external monitor?
Win Redock has worked best for me. Redock is automatic - saves and restores windows without any intervention. Magic! Its open source too!
I have, in the past, used an Autohotkey tool called Windowpad for this. Apparently this has now been replaced with a new, enhanced version called WindowPadX. Scroll down to see the readme. Full documentation is here.
This was crucial to me on multiple monitors. I loved to be able to easily switch a window between the two.
You can set hotkeys for the following (from the readme):
Possible actions to be configured on hotkeys
Window actions
Multi-Monitor
WPXA_MoveWindowToMonitor: Move window between screens, preserving relative position and size.
WPXA_MinimizeWindowsOnMonitor: Minimize all windows on the given Screen
WPXA_GatherWindowsOnMonitor: "Gather" windows on a specific screen.
WPXA_FillVirtualScreen: Expand the window to fill the virtual screen (all monitors).
General
WPXA_MaximizeToggle: Maximize or restore the window.
WPXA_TopToggle: Toogles "AlwaysOnTop" for given window
WPXA_RollToggle: Toggles "Roll/Unroll" for given window WPXA_Move: move and resize window based on a "pad" concept.
WPXA_TileLast2Windows: Tile active and last window
Multi-Monitor Mouse actions
WPXA_MoveMouseToMonitor: Moves mouse to center of given monitor
WPXA_ClipCursorToCurrentMonitorToggle: Toogles clipping mouse to current monitor
WPXA_ClipCursorToMonitor: Clips (Restricts) mouse to given monitor
General Mouse actions
WPXA_MouseLocator: Easy find the mouse
You can find it and other tools among a "A curated list of awesome AutoHotkey libraries, library distributions, scripts, tools and resources" here