Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Here is my configuration:

  • Ubuntu 12.04 (with Unity)
  • Laptop
  • External screen to use the laptop in dual screen mode
  • Several windows spread on both screens and on 4 workspaces

When I have meetings I unplug the screen from my laptop to take the laptop to the meeting room, so all the windows are re-positioned to fit in one screen only. After the meeting, when I plug it back to the external screen, I need to manually move all the windows back in place.

Is there a way to save and restore the windows, so that I don't have to do this manually everytime? A script with save/restore options would be great!


Note: I don't think this is a duplicate of "How do I save sessions or reopen last-used applications?", since I keep my computer turned on (the solution explained in the other post is about using an hibernation tool tweak).

Note 2: I found this script, but it does not work.

Edit (2013-06-03) the tool wmctrl can help to get and set windows positions. I created a Shell script with it, but there is a known bug in Unity which makes it impossible to use there. Even on XFCE the result is random sometimes...

share|improve this question

1 Answer 1

If you press Super+P until it goes to mirror, before unplugging the monitor, it might be more likely to save the positions, rather than just unplugging it.

share|improve this answer
The command you gave just log my session out (in Ubuntu 14.04 at least). When I connect back, all the windows are gone and I have to restart all my programs, so it's not good. – Pierre Jul 14 '14 at 6:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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