Sunday, February 13, 2011

Xmonad - Surprisingly Intuitive

At first glance you wouldn't think that an entirely haskell based window manager as even remotely easy to use. When first configuring Xmonad you get just the opposite impression, it's a nightmare. The config files are the window managers source code itself, or parts which are hooked into the code, anyway. When Xmonad is launched, it recompiles the config file if it's been touched and runs the successfully compiled binary.

One of the neatest features not unique to Xmonad but certainly best demonstrated with it is the ability to restart the window manager and all of its components without killing the X server session. A simple (using the default key configuration) meta+q kills the window manager, recompiles it, and restarts it in place.

Xmonad has a surprising amount of customizability. You can customize everything from shortcut key instances, status messages, default window tags, positions, modes, among other things. While the initial configuration is very intimidating, looking at somebody else's source file for Xmonad gives you a pretty good sense of how it works. An intimate look at a well configured xmonad.hs will allow you to reconfigure the window manager with 0% haskell knowledge (with maybe a little bit of aid from google).

One praise that I unfortunately cannot sing of Xmonad is the surprising Linux bias the xmobar status bar utility has. As a FreeBSD and Linux user, the FreeBSD desktops cannot easily utilize the already configured plugins for xmobar as it is heavily dependent on Linux's special /proc filesystem. While /proc is convenient, applications which aren't specifically linux drivers or hook into the linux kernel should not utilize it as it's completely unportable. I was very disappointed to see all the cool network transfer and speed plugins managed to produce big error messages which complained that /proc/net does not exist.

While there may be some hackery and duct tape solution to this by creating symlinks with FreeBSD's linux emulation layer and emulated procfs, the FreeBSD implementation of linproc is purposefully incomplete and only there to tie bare essential functionality to linux specific applications. Sadly I simply just replaced this with some custom ones which queried mpd using `mpc current` some volume scripts with mixer, and a cpu script which just polls the cpu freq sysctl.