Lately I’ve been playing around with a few non-traditional window managers; particularly wmii and dwm, both of which are minimalist dynamic window managers from suckless.org. With both of them, you primarily use the keyboard to open programs and manage your running windows. The two have slightly different ways of doing things, but are quite similar (as you would expect coming from the same project). Being ‘dynamic’, they both automatically handle window placement when you open a new window, although they allow you to change this placement if you want.
So, why did I decide to use them? Well, a lot of it has been motivated by my recent foray into Arch Linux combined with a desire to use my mouse less (and maybe delay arthritis in my wrist for a few years at least). They’re also much more lightweight than Gnome or KDE – I don’t use most of the niceties in either one of those two very much, so there’s no sense in paying the performance cost if there are no other benefits. Also, and this may be a bigger reason than any of the others, I love tinkering.
At any rate, I installed them both on Arch Linux (which was fairly straightforward due to Arch’s simplicity), and then decided I wanted to see if I could get dwm working in Ubuntu on my desktop machine. This turned out to be a little more difficult, mostly because the “user-friendliness” of Ubuntu means that it has many non-standard customizations and more complex configurations to make everything as smooth and brainless as possible. Unfortunately, this means that for those of us with a technological-minded brain, it’s harder to get it to actually do what you want. Ironic, no?
First, I installed dwm itself. This is done by checking out the dwm source from their website, and building it with the ‘make’ command. Its fairly straightforward and well-documented on their website.
However, then came the problems: I didn’t want to boot into gdm, which Ubuntu does by default. I tried things like removing it from /etc/inittab
(doesn’t exist on Ubuntu), editing /etc/init/gdm.conf
to stop gdm on runlevel 2, which is the default in Ubuntu (this didn’t seem to do the trick), and looked everywhere in /etc
for something promising. I didn’t find anything until I stumbled across this blog post. It describes how to change the command-line options for booting your kernel into a login terminal, and how to fix the audio problem which then arises (I had the same issue it describes).
Unfortunately, I had one more issue with Ubuntu. dwm makes use of a mod-key quite heavily. Most all of the commands you need to use to interact with the window manager via keyboard are prefixed with this key. I decided I wanted to bind it to the capslock key (who uses that key anyway?). Mostly because I had done this on my laptop, which runs Arch. I tried to do it using xmodmap
, which is how I did it under Arch. I got some really quirky behavior if I ran xmodmap
as part of my .xinitrc
, as I do under Arch. The changes wouldn’t stick… unless I made the process running xmodmap
sleep for 6 or 7 seconds first. I eventually figured out that this was because when X.org
starts on Ubuntu, it runs the xkbcomp
program, which overwrites what was set with xmodmap
.
“If you can’t beat ’em, join ’em”.
I decided that in order to play nice with Ubuntu, I had to play by its rules, and use xkbcomp
. After a bit of searching, I found an article which dove deeper into how it worked than I really wanted to go. It is not nearly as simple and easy to use as xmodmap
. Happily, they’d already figured everything out for me. So, I used their methods to set the caps lock key to be Mod3, recompiled dwm to use that as the mod-key for all the window actions, and I was on my way!