I have a laptop with a docking station that has a large monitor connected to it. When the laptop is docked, I use the monitor as my primary display, and the laptop screen as a secondary display.
When I undock, the laptop screen becomes my primary display, and all the windows move over to it. When I dock the laptop, the monitor automatically becomes the primary display again, but the windows all stay on the laptop screen. I have to drag each one over to the monitor and resize it.
How can I get my windows to automatically resume the positions and sizes they had just before I undocked (assuming they're still open)? All I've been able to find are answers talking about restoring programs when you log in. That's not what I'm looking for.
I'm using Gnome 3 on Arch Linux.