wmctrl
, a very nice linux tool that can do all of this for me.
I’m aiming to have a series of windows all sized at 800×600, and the first step is to look at a list of windows in wmctrl:
wmctrl -lG
The -l
switch provides a list, and the -G
switch shows the geometry of the windows. This is especially useful if you want to place something on a second monitor, you can look where a correctly-placed window would go and then use those co-ordinates! Also beware that windows positioned at the origin of a desktop space rarely end up where you expect them to go.
To set a new geometry for a window, we use the -e
switch to specify what that should be. The format is:
"gravity, X, Y, width, height"
For gravity, try zero. X and Y are the co-ordinates of the top left hand corner of the window, and width and height hopefully you can guess. It’s also acceptable to pass -1 for any of these values for the window to retain its current setting.
To specify a window, we use the -r
switch to indicate to wmctrl
which window wants the resize. You can give the title of the window, or the identifier shown in the list output, but I found it most useful to use the special value ":SELECT:"
and then just click on the window I wanted to affect. Therefore the command I used the most became:
wmctrl -r ":SELECT:" -e "0, -1, -1, 800, 600"
As a final tip, make sure (by resizing the window to something definitely smaller than the desktop it is on) that the window is not maximised – if it is, it will stay that way and you will wonder what you are doing wrong.