Better poly than sorry!

Replacing KDE with a lightweight WM in Common Lisp ΒΆ

Many exciting things have been happening recently; I have another post on Racket web server and of course Walkfiles Challenge. But I feel that this is the most unexpected thing that happened.

It was like this. In my Emacs I have C-M-k keys bound to kill-sexpr, which is rather important. A default configuration of KDE on my Fedora 22, however, decided that it wants this particular key for itself. Pressing the keys would pop up a keyboard layout switcher. I tried unmapping and remapping this binding in KDE, but without much success. The best I could do was to disable it for one session and then again after every restart.

I decided that it's enough and started looking for an alternative for KDE. On an Arch Wiki, I stumbled upon a "StumpWM" project, which apparently was written in Common Lisp. I was contemplating learning some Common Lisp recently, too, so I thought I may as well try to use it.

First five hours were excruciating. The damned thing comes without anything resembling "normal" configuration. When you start it - I had to add a file to /usr/share/xsessions/ - it offers you an empty screen. Nothing more. Nothing at all. If you don't know that you must press "C-t h" to start learning the commands you're screwed.

But, after some initial struggle I managed to connect SLIME to a running StumpWM instance. Nice! Now I have an REPL and can hack directly on my running WM! I can also search for docs, inspect values and more.

Being able to search doesn't help if you don't know what you're looking for, so it took me a couple of hours to find all the fundamental commands. A working "Go to definition" was a huge help.

So, after the initial struggle I started to think how to replicate the functionality I wanted in StumpWM. I need a working "Alt+Tab" (window switcher) and some virtual desktops for grouping windows. Turns out StumpWM doesn't have a fixed set of virtual desktops; you create them as needed. They are called "groups" and you give them a name, and then you add windows to it. The only problem is that they are not ordered in any particular way - I liked a grid-like metaphor of vdesktops in KDE before.

Binding "Alt+Tab" was rather easy, too. What is not obvious to me right now is how to make StumpWM cycle though possible frame configurations. But I'm sure I'll get there eventually...

UPDATE: A few days later...

I'm mostly satisfied with the experience. It does deliver on its promise of a live, Lisp-based environment. It's completely hackable during runtime. The ability to connect SLIME to a running instance of your Window Manager is somewhat magical, especially if you know of slime-connect.

StumpWM did die on me a couple of times, but it was a direct result of me evaluating something stupid in an REPL. The lack of documentation is somewhat remedied by fabulous introspection tools and a nice amount of docstrings. The codebase is not tiny, but not yet big: don't expect to read it in one sitting, but you can do this over the weekend.

Other than that, it does what it's supposed to do: it manages windows. After writing some 200 sloc, I've got it do be mostly compatible with how I use a split-screen functionality in both Emacs and tmux.