ruby-wmii for wmii 3.6

Posted November 27, 2007

One of the coolest things about wmii is how customizable it is. A significant amount of the fundamental logic isn’t handled by the core code. Tagging, keybindings, even manipulating windows - none of that is set in C (so to speak).

This logic isn’t written in a specialized extension language, like Lisp for Emacs or Javascript for Firefox, though. Instead, wmii exposes a virtual filesystem and is controlled by writing to magic files there.

I went into some depth on this last time, so I won’t ramble about it here. The upshot is that scripting isn’t bound to any particular programming language. The default config script is written in a maximally portable subset of sh; you could use whitespace if you really wanted.

Naturally, I’d like to configure and script wmii in the language I’m most comfortable with: Ruby. Handily, there were others who shared my sentiment. In particular, Mauricio Fernandez created ruby-wmii, a Ruby library for configuring/scripting wmii.

Mauricio’s library has lots of cool stuff. In addition to wrapping all the event handling and key binding and so forth in lovely object-oriented block-based code, he crafted a full-fledged plugin system and a toolbar system. He and others contributed all sorts of cool plugins, making ruby-wmii significantly nicer to use and more powerful than the default shell script.

Of course, when I found this, I was of course joyous. However, a cloud soon fell over my joy: ruby-wmii only works for wmii 3. The current version is wmmii 3.6.

I tried downgrading to version 3, despite the wmii site’s admonishments to the contrary. In addition to whatever bugs weren’t fixed, there were several features I didn’t want to do without. So I hung my head and trudged back to the sh script.

But I kept ruby-wmii in mind. I wanted to use it. So every now and then when I had some spare time1 I ran ruby-wmii with wmii-3.6, saw what broke, and tried to fix it.

As of today, I think I’ve gotten it to the point where it’s at least minimally usable. All the basic functions are there. Both the left tag bar and the right status bar show up. Interaction with the left bar seems to work (the right one is doubtful).

It’s definitely not great, but it’s in a condition that I’m willing to use it instead of the default sh script. So I figure others might be as well.

I’m using darcs as the revision control system because that’s what Mauricio uses and this way it’s easier to integrate my patches. All you’ve got to do to install my version is make a local branch of my repository and run the install script:

darcs get http://darcs.nex-3.com/ruby-wmii
cd ruby-wmii
ruby install.rb

Chances are any bugs are my fault and not Mauricio’s, so feel free to post reports as comments. darcs send any patches to nex342@gmail.com. And enjoy your ruby-wmiiness.

Update: Mauricio has applied my patches, as well as some new ones of his own, to the central repository. Check it out from there instead:

darcs get http://eigenclass.org/repos/ruby-wmii/head ruby-wmii

He’s also merged the patches with the ruby-ixp version, which is supposed to be snappier (after a minimal amount of trying, I wasn’t able to get it to work, but you may have more luck). That’s located at http://eigenclass.org/repos/ruby-wmii/branch-ruby-ixp/.

1 This is a joke. I don’t really have spare time. I just pretend I do and make up for it by not sleeping.

Will Farrington said November 27, 2007:

This is a really big accomplishment Nathan. I love wmii all the more now that the configuration is pretty. ;)

Make your comments snazzy with Textile!