9

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.

  • I have a similar problem: When I run a game that demands full screen mode but doesn't support my native resolution, all windows move around and get resized. It would be great to have a way to save / restore them. – Aaron Digulla Jan 8 '13 at 9:02
1

I tried to come up with a script but ran out of time. You can find the related discussion here:

https://groups.google.com/d/topic/xdotool-users/ns-pHfwQErc/discussion

1

I have asked a similar question on ask ubuntu and the accepted answer contains (not-ubuntu specific) shell scripts to save / restore window positions.

The key point is to use wmctrl to list active windows and xwininfo to query their geometry and later wmctrl again to restore each window's geometry back.

wmctrl has to be installed separately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.