Revealed by sykora within linux, programming on October 12th, 2008
I’ve been an avid ratpoison user about 3-4 years, ever since I made the transition from full-blown eye-candly to painful minimalism. Ratpoison fit my needs perfectly, providing cheap, simple window management with non-overlapping windows and no frills. And damn was it fast.
There are, however, a number of drawbacks of ratpoison, where things are just too hard, much harder than they need to be. For example, one of my common gripes has been the ability (or lack thereof) to use the same key to run an application if it isn’t running, or raise it if it is. After hours of work, I gave up with that goal, and tried to get at least a combination of 2 keys, one to open, and one to raise. The open, of course, is trivial. I found raising unbelievably hard. Why? There just is no provision to do the kind of testing necessary inside ratpoison itself. The common idiom in these cases, is to run an external script, and have it call the ratpoison binary in command mode, like this :
and so on. This becomes really hard if you’re trying to do something complicated. I later found out that there was a python module that you could import directly, but it only made the mechanics of the situation simpler, it didn’t improve what you could do.
StumpWM is the successor to ratpoison. It has the same goals of keyboard driven window management, but with one huge addition : It’s written in Lisp. Now if you’ve had the same bad experiences with things as Scheme like I have, then you might not think this is such a good idea. But it probably is. That’s because you can now customize the wm in a high level language, and not restrictive scripting language like what ratpoison offered. So now you can write your own functions in lisp which use functions provided by stumpwm, and do whatever you like with them. Moreover, you can interact with the running lisp process, meaning you can load code right into the running wm. I’m not an Emacs fan either, but I can see why they like that way of doing things.
eg, Here’s the code I’ve been looking for, all this time :
That code will run opera if it isn’t running, or raise it if it is. The command can be bound to a key, and used as required.
My second example, is one my largest time-sinks in ratpoison : How do you get 2 escape/prefix keys?
This is in direct relation to using the Super L/R keys (both of them) as your escape keys. In ratpoison, there was no way, you’d have to mess around with xmodmap to bind them to the same keysym, and go from there. I never got it working satisfactorily.
In stumpwm, it’s all of 2 lines of code, as you’d expect it to be.
This code basically says that both the keys in the top level keymap are bound to the same thing, namely entering the prefix-map or root-map.
Now I’m by no means a Lisp ninja, but this isn’t exactly hard.
My gripes with StumpWM? Only one so far. Stump lacks Ratpoison’s undo/redo functionality, which was my saviour when I accidentally “only’d” a window. But this is on the dev’s TODO list, so hopefully it won’t be long before it’s there.
Obviously there’s a lot I haven’t rambled on about, like the modeline, and rule-based window placement. Give me a break, I only started yesterday.
Tags: linux, lisp, minimalism, ratpoison, stumpwm