January 24, 2005

Innovations in window management

Author: Ryan Paul

When you have 20 or more windows open across nine virtual desktops, the complexity of window management can become overwhelming. A number of new tools are now available to facilitate effective window management.

When Metacity became the default window manager of the GNOME desktop environment, I was befuddled. I couldn't understand why anyone would want to replace something as versatile and flexible as Sawfish with a virtually featureless window manager that isn't even extensible by scripting. But after studying the architecture of Metacity, the rationale became more apparent. Metacity was designed to be light and simple. The functionality can be extended via C plug-ins that utilize Metacity's extensive window management library, and the configuration settings are accessible to all GNOME programs via the gconf utility. While Metacity does not provide the same degree of flexibility as a fully scriptable window manager, it is much less intimidating and much less resource-intensive, and consequently it is much more appealing to the majority of GNOME users. Metacity can be incrementally enhanced in a modular and maintainable fashion to efficiently support the needs of users with varying skill levels.

One feature that many Metacity users have clamored for is window matching, which allows users to establish a set of rules that automatically alter properties of windows that match the rules as the windows are being created. With a window matching tool you can make a certain program always start maximized on a particular virtual desktop, or automatically make all your chat conversation windows sticky. Some window managers, such as Sawfish, have built-in window matching systems. For other window mangers, you can utilize a stand-alone window matching utility like Devil's Pie.

The latest version of Mac OS X introduced a powerful window management mechanism called Exposé that increases the efficiency of window switching by providing a scaled overview of all available windows. Since its release, several applications have managed to bring similar functionality to Linux. Expocity is a Metacity patch that adds a scaled window overview. There are several window overview utilities that do not rely on any particular window manager. I was particularly impressed with the performance of Skippy, a window overview utility that is compatible with NetWM- and gnome-wm-compliant window managers. Skippy comes in regular and XD flavors. Regular Skippy cannot display thumbnails of obscured or minimized windows. SkippyXD utilizes the XDamage and XComposite features of XOrg (FreeDesktop.org's X server) to present the scaled window thumbnails of all windows, including those that are obscured or minimized, in real-time. Komposé is a KDE-native window overview utility that can optionally organize your windows by virtual desktop, and act as a virtual desktop switcher. The latest version of Komposé also uses the XComposite and XDamage extensions of XOrg to do on-the-fly rendering. Both Komposé and Skippy have excellent keyboard support. You can use the arrow keys to navigate between windows within the scaled overview mode.

In the past year, a number of small window managers have appeared that emphasize scriptable extensibility. My favorite is Kahakai, a Waimea derivative with support for Python scripting. Unfortunately, Kahakai is no longer under active development. Many of the former Kahakai developers have contributed to the Aegis project, which is still not mature enough to adequately assess. I have also looked at PyEvilWM, a Python-enhanced derivative of the lightweight keyboard-oriented window manager EvilWM. Fluxbox users may be interested in FluxSpace, a Fluxbox derivative with support for Python scripting. Recently I happened across PyFVWM, a Python interface for extending Fvwm. Also of note is PLWM, which is more or less a window manager construction framework written in Python. Most of these systems allow users to associate Python functions with keyboard bindings, or "hooked" window manager actions. With Python scripting, users can quickly add new features, and developers can rapidly prototype code for features they may eventually add to the main code base of the window manager.

Have you ever wanted to perform window management operations from the command line? I do it all the time. Wmctrl is a command-line utility that allows you to perform almost every window management operation in the EWMH specification. It works with all EWMH/NetWM-compliant window managers. You can acquire window information, move and resize windows, change window properties and states, move windows to specific virtual desktops, and move to specific windows with relative ease using wmctrl. Occasionally, I decide that I want to move all the windows on one virtual desktop to another -- quite a chore to do by hand if there are a lot of windows. With wmctrl and bash, it's relatively easy. The following example will move all windows on virtual desktop 3 to virtual desktop 5:

for item in `wmctrl -l | awk '/0x.* 3 .*/ {print $1}'`; do wmctrl -i -r $item -t 5; done

Want another example? This code closes all Gaim windows except for the buddy list:

for item in `wmctrl -xl | grep -v "Buddy List" | awk '/0x.* gaim.Gaim .*/ {print $1}'` ; do wmctrl -ic $item; done

If your desktop environment allows you to associate keyboard shortcuts with commands or shell scripts, you can use wmctrl to add all sorts of window management automation functionality to your desktop environment without having to use a complex memory-intensive scripting language.

No discussion of innovation in window management would be complete without a glance at the the latest features of the Ion window manager. Ion is a keyboard-friendly window manager that uses non-overlapping frames to display windows. Ion's highly experimental window management idiom is, in most cases, highly effective.

Unfortunately, Linux applications are generally not made with paned window management in mind, so there are a number of issues that make Ion less than optimal. Its developers have recently added some powerful new features to Ion that attempt to address many of the problems that Ion users face. As an Ion user, I was extremely pleased with the introduction of floating panes. Floating panes partially obscure normal frames when they are active, but become obscured by normal frames when they are inactive. Floating panes are useful for a lot of things. I use one for my Gaim buddy list; it is completely obscured by other windows, but jumps into view when I move my cursor over its frame. At the bottom of my screen, I have a totally obscured terminal window that fills the screen when it is active. I also use floating panes for program dialogs and IRC channel windows that I'm not actively using.

Another useful recent addition to Ion is the auto-pane workspace, which is a little difficult to get used to. An auto-pane workspace consists of two special floating panes, one on the bottom and one on the right side. The rest of the screen is occupied by a normal Ion workspace. The special floating panes are designed to automatically section themselves off to facilitate the natural size of the windows dropped into them. With an auto-pane workspace, applications with lots of little dialogs (like Glade or the GIMP) are much easier to work with.

For an interesting glance into the future of Metacity, I would suggest taking a look at Luminocity, a Metacity derivative that utilizes OpenGL and the features of XOrg to implement support for full window translucency, and an extraordinarily impressive live pager that contains live, scaled views of your virtual desktops.

As development continues, I hope to see a greater number of utilities for window management customization as well as better scripting support for existing window managers. Some of the powerful features in XOrg facilitate innovations that were
not previously possible, and FreeDesktop.org's Window Manager Specification Project has helped to promote interoperability through standardization of ICCCM extensions. There are now a number of utilities and alternatives available for those who are unsatisfied with the limited feature set of their current window manager. Window management is yet another field where Linux and its community excel at providing users with a broad number of unique and creative options.

Ryan Paul is a systems administrator, a free-lance writer, and an ardent
proponent of open source technology.

Click Here!