What's GNU

This month's column concludes the article on Plan 9 From Bell Labs, and those parts of it that have been re-implemented in freely available software.
The 9wm Window Manager

The tools we've seen so far, notably sam and 9term, are built on top of X Windows, and work with any window manager. For some time, I ran them using mwm.

In the fall of 1993, I obtained a version of gwm, the Generic Window Manager, with WOOL (Windows Object Oriented Lisp) code that implemented an interface very similar to that of the original Bell Labs Blit terminal. This provides a simple, clean interface, similar to that used on Plan 9 (8½ can be considered a further evolutionary step from the Blit). This code was written by John Mackin at the University of Sydney. The resources sidebar shows where you can get this code, if you're interested. This code works, but it is large and slow.

However, a new window manager recently became available, 9wm. 9wm implements the window management policies of 8½, under X windows. Written by David Hogan at the University of Sydney, it uses raw Xlib (not a pretty sight), and is completely ICCCM compliant. 9wm is also small, and very fast. To quote from the README file:

9wm is an X window manager which attempts to emulate the Plan 9 window manager 8½ as far as possible within the constraints imposed by X. It provides a simple yet comfortable user interface, without garish decorations or title-bars. Or icons. And it's click-to-type. This will not appeal to everybody, but if you're not put off yet then read on. (And don't knock it until you've tried it).

9wm is “click to type”. This means you have to move the mouse into a particular window and then click button one. That window becomes the current window, indicated by a thick black border. Other windows have a thin black border. This behavior is identical to sam's.

The 9wm menu (accessed through button 3 on the root window) consists of five items:

  • New - open a new window (9term or xterm if no 9term)

  • Reshape - change the shape of a window on the screen,

  • Move - move a window,

  • Delete - blow away a window,

  • Hide - “iconify” a window.

What is perhaps most noticable about 9wm (and 8½) is that there are no icons. Instead, to remove a window from the screen, you select Hide from the main menu. The cursor becomes a target. You move the target to the window to be hidden, and then click button 3. Clicking any other button cancels the operation.

When a window is hidden, it disappears from the screen completely, not even leaving an icon. Instead, a new item appears at the bottom of the button 3 9wm menu, with the name of the window. To open the window again, you simply select the window's name from the menu.

As with the other programs, the 9wm menu remembers what you did last time, so that the next time you pop up the menu, the previous selection is already highlighted

The 9menu Command Line Menu Program

And now, my own small contribution to the picture. The GWM Blit emulation, which I used for quite awhile, understood that it was built on top of X, and when you selected New, it gave you a menu of hosts (that you defined in a configuration file) on which to start remote xterms. This was nice, and I found it missing under 9wm.

(In Plan 9, this is not an issue; the multiple hosts in the network are very tightly integrated, but in X with Unix, it is a problem.)

What I wanted was a simple program to which you could give menu items and associated commands, and this program would pop up a window that was nothing but a menu. Selecting an item would run a command. The program would be long lived, leaving the menu up permanently. A program close to this exists, xmenu. Unfortunately, xmenu goes away after executing the command, and is not well behaved when interacting with 9wm.

Inspired by 9wm, starting with its menu code, and with help from David Hogan, I wrote 9menu. 9menu pops up a window containing the list of items, and executes the corresponding command when a button is pressed.

9menu allows you to write your own menus and customize the behavior to suit you, without the headaches of a .twmrc or .mwmrc file. It is real easy to have one item spawn another 9menu, giving a similar effect to pull-right menus.

Here are two I use it: one for remote systems, the other for programs I may want to run. Being lazy, I have xterm in both. I use a shell script named rxterm that knows about the remote hosts I will want to open windows on, and whether they can start a 9term or an xterm. (This is left over from the GWM Blit code, and is mostly for convenience.) These examples are from my .xinitrc. The -geometry strings are to get 9wm to place the windows even though they start out iconified.

9menu -geometry 67x136-4+477 -iconic -popdown -label Remotes \
        'solaria:rxterm solaria.cc.gatech.edu' \
        'burdell:rxterm burdell.cc.gatech.edu' \
        'chrome:rxterm chrome.cc.gatech.edu' \
        'xterm:rxterm xterm' \
        exit &
9menu -geometry 103x102-3+624 -iconic -popdown -label 'X programs' \
        'xterm:rxterm xterm' \
        xtetris xlock '9wm restart' '9wm exit' exit &

I start the programs using -iconic so that they'll be automatically hidden and part of the 9wm menu. The -popdown option causes the menu to automatically iconify itself after an item is selected, since I find this to be the most convenient way for me to work: pop up the menu, select an item, and then go on with what I want to do without the menu hanging around. Although not nearly as large scale a program as sam, 9term, or 9wm, I find that 9menu completes the package for me.