A lot of the GNU/Linux community have been switching to alternative window managers of late. Gnome 3 seems rather resource intensive. And Ubuntu Unity is a terrible monstrosity. I have heard good things about Awesome window manager. But I decided to have a crack with the Haskell-based XMonad. I’ve been using it on my laptop for the last few months now, so I figure it is time for a bit of a writeup. This is not intended as a howto, John_Goerzen has written a great Xmonad getting started on the Haskell wiki.
Image is a link to a bigger version
Getting it installed
Installation wasn’t too much of a faff, I installed it from apt like any other package, restarted gdm and it was available in my list of windowmanagers like I’d expect. I didn't keep detailed notes of the setup but I did add a number of extra pieces and tweaks to get it working well enough to replace GNOME for most work. Configuration is in a single file in your home directory, and you will want to be a little comfortable with Haskell syntax (or cheat and copy-paste off the internet). I found this video of Simon Peyton-Jones who works on the GHCi compiler to be helpful in understanding some of the conceptual ideas behind how XMonad works, though it is really about Haskell rather than XMonad per se.
By default, XMonad doesn’t come with a bar or a tray. And though I don’t use them all the time, they are occasionally useful. I ended up opting for XMobar, and trayer for providing the tray. Trayer had to be started in my xmonad.start script, listed below. I also added an extra layout using XMonad.Layout.Spiral based on the Golden Ratio, which I borrowed from Octoploid’s xmonad.hs and which is in use in the screenshot below.
Image is a link to a bigger version
Playing with GNOME
So, now came the trickier bit, which was getting GNOME and xmonad playing with each other as I wanted. I’m using Gnome 2 on Debian Squeeze, so YMMV. I should also mention that there is a great howto which will probably contain all you need over on the Haskell Wiki. The first bit for me was to make an alternative launch script to do some other stuff that I wanted, before the real Xmonad was launched.
$ cat /usr/local/bin/xmonad.start
xrdb -merge .Xresources
trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 15 --height 12 --transparent true --tint 0x000000 &
transmission -m &
if [ -x /usr/bin/nm-applet ] ; then
nm-applet --sm-disable &
Now I tweaked the xsession filoe that Debian had created for me to use my custom Xmonad launcher.
$ cat /usr/share/xsessions/xmonad.desktop
Comment=Lightweight tiling window manager
Finally I copy pasted the Gnome config bits described on the Haskell wiki into my xmonad.hs, and launched. Now I have a tray, courtesy of trayer, the ability to lock my screen, to powerdown when my laptop closes and crucially to bittorrent the various operating systems I need to with transmission. Which along with a windowmanager is pretty much all I need.
How was it?
So far I am delighted with XMonad. It has encouraged me to make much more extensive use of workspaces, and I’ve found that partitioning classes of work into different spaces has helped me stay focussed on one task at a time. Rather than glancing over at the email window, or checking Hacker News, I’ve been able to keep working on the code in front of me. It has made me more productive and less distracted.
… reliable, robust and helped me use the mouse less and stay focussed more
I’ve also been using the mouse far less. I use vim for editing already, and vimperator with firefox for browsing, which can be largely mouse-free. Because you have to learn the keybindings to make XMonad work at all, I have got into using them all the time. Another nail in the coffin of my pointing device!
Being able to flip between layouts is cute, but I mostly use full screen and any other layout, apart from when I need to work with GIMP. I haven’t played with assigning workspaces to monitors yet, but it sounds like the sort of thing that could be handy. The config file is well documented and works as expected for the most part and playing round with the setup is a joy for a programmer like me.
GIMP really doesn’t seem to play nicely with XMonad, at least I need to do some more research to make it work nicley. The main problem I have is when I work on other WMs I keep finding myself pressing alt-2 to go to my code workspace or alt-1 to go to my web workspace and this makes odd things happen. That can be annoying.
Overall XMonad has been reliable, robust and has helped me use the mouse less and stay focussed more. Not bad.
You can have a look at my xmonad.hs. It is, perhaps inevitably, a bit of a mess. But it works for me ®