John Floren

Home | Blog | Tools | Links
Back to blog archive

Posted 2012/4/16

Back on a tiling window manager: StumpWM

After a hiatus of some time, I’m back to using StumpWM (a lisp-based tiling window manager), this time on my company-owned Macbook Air. I got sick of OS X really quick and installed Arch Linux, which took some time but has now allowed me significantly more freedom than with OS X–I can actually compile things!

The nice thing is that, unlike XMonad, it doesn’t have any pre-defined styles, and it doesn’t shuffle all your windows around every time a new window is opened. By default the prefix key used for every command is Ctrl-t, which means your Alt-key combinations don’t get eaten–and you can still easily send a Ctrl-t to Firefox by hitting Ctrl-t twice.

I have also been enjoying the ease with which you can change the settings. I just fire up Emacs and run SLIME to connect to the running Lisp instance. Then, I can simply evaluate Lisp expressions to modify the look of, e.g., my title bar. Then once it’s correct, you simply paste it into your .stumpwmrc file. The only disadvantage is that Emacs is so brain-damaged for writing anything except Lisp.

Here’s my .stumpwmrc:

(require 'swank)

(load "/home/john/stumpwm/contrib/cpu.lisp")
(load "/home/john/stumpwm/contrib/mem.lisp")
(load "/home/john/stumpwm/contrib/net.lisp")

(in-package :stumpwm)
(defparameter *foreground-color* "darkcyan")

(set-focus-color *foreground-color*)

;(run-shell-command "xsetroot -solid black")

;; Make a couple workspaces
(run-commands "gnewbg 2" "gnewbg 3" "gnewbg 4" "gnewbg 5" "gnewbg 6")

(if (not (head-mode-line (current-head)))
    (toggle-mode-line (current-screen) (current-head)))

;; HH:MM Timezone (UTC offset), Day Mon Year
(setf *screen-mode-line-format*
      (list '(:eval (run-shell-command "date '+%R %b %d' |tr -d [:cntrl:]" t)) " | %c | %l | [^B%n^b] %W"))

;; Click to focus
(setf *mouse-focus-policy* :click)

;; Shortcut to lock the screen
(defcommand lock-screen () ()
  "lock the screen"
  (run-or-raise "xscreensaver-command -lock" '(:instance "xscreensaver")))

(define-key *root-map* (kbd "L") "lock-screen")

Thoughts on tiling

I’m generally a mouse curmudgeon–I don’t belong to the cult of the keyboard, which claims that the only true input device is a keyboard. The mouse is great for selecting things; it’s a pointer, so use it to point! Works great with Acme, and because of the way Plan 9 and its software were designed, using the mouse under Rio in Plan 9 is pretty good too.

However, with Linux, especially on a laptop, I constantly find myself frustrated when using the mouse to manage windows. Evilwm is nearly what I want, it’s got great bindings and stays out of the way, but basically every window manager has some flaws. Worse, touchpads are just not very convenient, and laptop screens are small. When working on a laptop in particular, effective use of the screen is important. A tiling window manager means you don’t have empty spaces between windows.

Tiling window managers do have some big weaknesses. Running the GIMP, for example, typically sprays a bunch of windows around, which doesn’t work well when you have your screen split up into 2 sections. This can be helped a bit with floating layers, I also find that I don’t always make the best use of my screen space. It seems very easy to get your xterms shaped “wrong”, and it’s just a pain to manage more than about 4 panes in your desktop at once; thus, I end up like this:

|                     |     |
|                     |     |
|                     |-----|
|                     |     |
|                     |     |
|                     |-----|
|                     |     |
|                     |     |

Acme lives in a big space, then I have three xterms over to the side. Splitting up the right-hand column any more will make the xterms too short to see anything useful, even on a nice big 1920x1200 screen. Putting multiple xterms into a single “pane” means I’ll typically forget it’s even there. On the other hand, using a standard overlapping window manager, I’d have Acme sort of hanging out in approximately the middle of the screen, with a constellation of xterms to the sides or partially covered by the Acme window; I’m running EvilWM at work right now and have about 6 xterms open in the same desktop as my Firefox instance, its download window, “xclock”, and “xload”, and I feel like I can switch around at least as fast as with StumpWM (I’ve spent months using both window managers, I have put serious use into a lot of WMs)

It also remains to be seen if StumpWM will give me crazy Ctrl-t RSI; although I have remapped Caps Lock to act as Control, I’m still not sure what it’ll be like using long-term on this Mac keyboard.

I’d really love to see a tiling window manager on Plan 9, because I think it would be easy to do. It would be even better if, like StumpWM, it was written in a functional language which could be modified on the fly without the need to constantly compile and restart. Someone (Bakul Shah?) has a Scheme implementation with support for various Plan 9 functions, meaning it could very likely be used to write a window manager. By then attaching the REPL to a network port, we could allow on-the-fly hacking too.