wmii Oct 13, 2011

wmii is another tiling window manager for X, written in C. It lives at http://wmii.suckless.org/.

Another? (Who cares?)

If dwm (which I've been using for a year and a half) even remotely appeals to you, open your mind to the idea that wmii is a thousand times more awesome.

Benefits over dwm

You do not need to know C. This differs from dwm twofold. First, the major distros have packages for the latest version of wmii, so you don't need to compile it from source. Second, configuration is completely separate from the main program, extremely powerful, and can be done in any language. So you don't need to compile it from source. I'll detail configuration below.

The tiling is better. dwm has simple tiling mechanisms which, although they can be improved and extended through patches, do not approach the power of wmii. wmii organizes workspaces into a number of columns which can be created, destroyed, individually sized (with the mouse or keyboard), and changed between three modes (default, stack, and maximum). Default mode allocates vertical space equally among all windows in the column (after which they are fully sizable, of course). Stack shows only one window, with the others' title bars above or below it (depending on their order in the column). Maximum is the same as stack, but it hides the other windows' title bars.

Workspace tagging is more powerful, without sacrificing simplicity. dwm has nine workspaces named with the numbers 1 through 9. They are selected with Meta-1 through Meta-9. There is a patch which allows you to add a bit of text after the number, which is very useful, but otherwise there isn't support for more than nine tags. wmii starts with this, but also allows tags with any name via Meta-t tagname.

Configuration / Control / Customization

So far I make it sound like wmii is at most ten times as awesome as dwm. Get ready to go the extra two orders of magnitude; the wmii binary is controlled through a virtual filesystem borrowed from Plan 9 from Bell Labs, and the loop which handles keyboard commands and other events is a bash script called wmiirc. It also ships with rc, python, and ruby versions of the script. wmii will use ~/.wmii/wmiirc, if it exists, instead of its default1. To truly customize your wmii, copy and modify the script of your choice, or inspect the examples and write one in your favorite language.

Did you say virtual filesystem?

wmiir is a command-line utility which interacts with the virtual filesystem. The default wmiirc uses it to control wmii and react to events; it reads /event in a loop, and writes to the various control files (/ctl, /client/*/ctl, and /tag/*/ctl) and bar files (in /lbar and /rbar).

$ wmiir ls /

$ wmiir cat /event
ClientFocus 0x38334d3
AreaFocus 1
ColumnFocus 1
Key Mod1-2
UnfocusTag 1web
FocusTag 2wmii
AreaFocus 1
ClientFocus 0x38000c9
Key Mod1-1
UnfocusTag 2wmii
FocusTag 1web
AreaFocus 1
ClientFocus 0x38334d3
ClientFocus 0x4a1aada
AreaFocus 2
ColumnFocus 2

$ wmiir cat /ctl
bar on top
border 2
colmode stack
focuscolors #002b36 #268bd2 #657b83
font -*-courier-medium-r-*-*-17-*-*-*-*-*-iso10646-*
fontpad 0 0 0 0
grabmod Mod1
incmode squeeze
normcolors #93a1a1 #002b36 #657b83
view 1web

$ echo 'bar on bottom' | wmiir write /ctl

Yeah, that last one does exactly what you think it should.

Behind the scenes, wmiir communicates with wmii through a unix socket at /tmp/ns.${USER}.${DISPLAY}/wmii. The python version of wmiirc (my preference) comes with modules called pyxp and pygmi which expose a pythonic interface to the Plan 9 socket:

import pyxp
c = pyxp.client.Client(namespace='wmii')
c.write('/ctl', 'bar on top')

Everything Else

The man page for wmii is quite good. It also comes with a pretty helpful document called wmii.pdf2, but don't take my word for it.

1. /etc/X11/wmii/wmiirc on my machine. The rc, python, and ruby versions are also in /etc/X11/wmii.
2. /usr/share/doc/wmii/wmii.pdf.gz on my machine, doc/wmii.pdf in the source distribution.


links to: dwm

category: factuals
next: winterhaiku
previous: Tuna Sandwich

all writing, chronological
next: I'll tell you something
previous: Tuna Sandwich