Remembering Window Positions (and preferrably sizes, too) in Ubuntu 14.04

(My other answer describes why restoring a window position is not possible for the general case.)

For special cases where saving and restoring a window position is feasible, one can use shell scripts to save and restore the position or geometry (geometry is position plus size) for cases that can not be handled by the window manager configuration (see below).

There are various command line tools to read and set properties of windows - for example wmiface and wmctrl.
A minimal example:

Get the geometry of a window in X geometry format (usually WxH+X+Y) (note the y coordinate - I am using 16 compiz virtual desktops/viewports):

$ wmiface windowGeometry 46137711
1256x814+1186+5005

Move the window elsewhere (note the different format for geometry):

wmctrl -i  -r 46137711 -e "0,1186,4005,1256,814"


Another approach is to define fixed positions for certain windows instead of restoring its position. This can usually be configured in the details of window handling configuration, like ccsm.

Install ccsm (CompizConfigSettingsManager).

After starting ccsm (launched from the Unity Search Button) perform the following:

(Click on) Windows Manager
(Click on) Place Windows

Use these settings:

Workarounds Unticked
Multi Output Mode Place across all outputs

The Placement Mode Smart is the key for remembering your desired position.

Please keep in mind that some applications are programmed to override your system's perferred settings.


Window positions are not that simple to handle as "common sense" may suggest.
A position is ralative to some reference - like "the screen". But tere are so many variants of what "the screen" could mean here (see below), that it is not possible to save positions in a general way.

Of course it can be done in various ways which are adapted to some environment - but if it's about "just save a position, and restore later" - that's not possible because the coordinate system to restore the position in is unclear.

So, what's difficult about showing a window at some position on a screen?

Under Ubuntu - as on any modern X11-based system - the "screen" can change in various ways - during runtime, so saving position needs to handle that.

For example, the shape can change; From one rectangle to two rectangles side by side, to three rectangles with unaccessible space in between. The "Virtual desktop" can change. The viewport can change. Each affecting the coordinates that would be restored.

A special problem is to make sure nothing is moved out of the currently accessible part of the "screen".


On the side issue of opening windows at the top left: You can choose one of multiple algorithms to decide where to place a new window in the window handling settings (eg. in ccsm). For example, you could have them opened where the current mouse pointer is.


Just in case anyone lands here and really wants windows to be where you put them- install Enlightenment desktop. You can right click the icon top left of any page, select window, remember, and select size and position. I love that option and is one of the reasons I stay with e17.