Tuesday, November 11, 2008

[Computer] StumpWM: A Minimalist Window Manager

StumpWM is a window manager implemented entirely in Common Lisp. After using GNOME and then KDE for a very long time, I decided to try StumpWM.

Besides being affectionate to a window manager written in Common Lisp as I'm familiar with the language, there is one thing special about it. StumpWM depends on Emacs-like key combinations for what mainstream window managers use mouse and keys (and most Common Lisp programmers favor GNU Emacs as their editor of choice). That will be cryptic to the general computer users, but helps to prevent my baby from wreaking havoc when he plays on my laptop: It'll be very unlikely for him to get the correct key combinations by accident to move beyond the Tuxpaint window.

In Debian, it is easy to install, just

# apt-get install stump

and create a file ~/.stumpwmrc. My .stumpwmrc contains the following content to use sbcl:

;debian=sbcl

(asdf:oos 'asdf:load-op 'swank)
(swank:create-server :dont-close t)

(load "/usr/share/common-lisp/source/stumpwm/contrib/battery.lisp")
(load "/usr/share/common-lisp/source/stumpwm/contrib/cpu.lisp")

If you are running X server, log out and log in to choose StumpWM as the window manager.

Below are some commands I find useful. 'C-x' means pressing both Control key and x key, as in GNU Emacs. Words after ';;' are my comments, and may be not accurate.

C-t c ;; run an X terminal
C-t e ;; run emacs or raise it if already running
C-t w ;; list windows
C-t ; ;; open a command prompt
C-t a ;; show time
C-t C-t ;; switch to other window
C-t s ;; side by side
C-t TAB
C-t o ;; shift focus to the next frame
C-t [0-9] ;; switch to a numbered window
C-t ! ;; run a shell command
C-t Q ;; remove all frames but the current one and resize it to fit the screen
C-t " ;; show the window list and select one by moving up or down
C-t C-g ;; abort the current command
C-t t ;; sends a to the frame, e.g. for iceweasel to open a new tab
C-t C-h
C-t ? ;; help

The Stumpwm Experience showcases what you can do with StumpWM.

As a Emacs user, I also use "display-time" to display time on the mode line. For a laptop user you can use "display-battery-mode" if the contributed "battery.lisp" file is loaded.

StumpWM is highly configurable and it comes with an example configuration file. It has good documentation in man and Texinfo format. You can also view the Common Lisp source code as well.

The drawbacks of using StumpWM include:

It is not as robust as the mainstream window managers. Sometimes failures of applications may render it unusable. I have to manually kill X server via ssh from another computer and restart twice in the last 8 days.

There is a problem with copying and pasting across Emacs, KDE applications, GNOME applications and other X applications. In KDE there is klipper. In StumpWM I don't know what to do when such problem arises.