Wulf's Webden

The Webden on WordPress

Taking Control

One of the features I like (and frequently use) in Windows 7 is hitting the Windows key and one of the cursor keys to make a window fill either the whole screen (up), half the screen (left or right) or to minimise (down). It would be nice if it was more fully featured (for example, what if I want to have two windows at the top and bottom of the screen?) but it is still handy.

There are plenty of Linux window managers which provide this kind of c0ntrol but not XFCE, the one I routinely use (and without all the fancy compositing options turned on as I’m running it as a virtual machine and don’t want to weigh it down with extra levels of processing). Therefore, I was delighted to find a blog post from Lorna Jane yesterday that drew my attention to wmctrl. This is a command line tool that can return information about open windows and send them instructions to resize.

Having experimented with direct control, I am now writing a small Python wrapper script to add a layer of interfacing that is simpler than writing the commands directly. For example, giving a list of window names for the current desktop and, given a couple of those names, resizing them to fit evenly across the width of the screen (without necessarily assuming that I want them at full height) or just doing the maths required to evenly distribute all open windows across the screen. It should also be possible to tie controls to keybindings so that I apply some geometry morphing to the currently selected window.

I must remember not to have too much fun with this, as there is plenty of work to get on with, but I will allow myself a little more time to day to explore this new tool because it has the potential to make easy (and more precise) all those things I’ve had to do by clicking and dragging on window borders in the past.