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

14.04settingswindowwindows

I've just installed Ubuntu 14.04 alongside Windows and I am finding one thing to be very irritating. That is, when I open any application, it opens at the top-left of the screen.

The first thing I have to do for every application opened is to move it to the center of the screen (or wherever I want it to be). Then later on I'll close the app. But next time around, it's back at the top-left of the screen again!

I have read related questions on AskUbuntu and across the web. However I was wondering, since those questions were asked with regards to Ubuntu 12.04, if there was a better solution to this problem for 14.04 users? Shouldn't something like this be in Settings? I mean, that's just common sense really. Isn't it? I really don't know anymore.

Best Answer

(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.

Related Question