Emacs Lisp wmii controller

wmii-el (GitHub repository) allows complete control of the wmii window manager through Emacs Lisp.


Wmii is a tiling window manager for X11, strongly inspired by Plan 9. For me, it was always the tiling window manager whose behaviour I found easier, and the extensibility of it through the Plan 9 filesystem made it scriptable from the start – the default installation used a shell script, so that was very much a part of the design. Some of the reasons I preferred it to alternatives:

I don’t currently use it, mostly because of multi-monitor support issues that made it difficult for me to connect to external projectors for presenting, but it was likely the best experience in terms of being in control of the desktop (and yes, I know about i3, which I also used, and then sway, but they lack a 9P interface and the tilling model is not the same).

One of the reasons this worked so well was because it created primitives, in Emacs Lisp, for the wmii functions, which made it a joy to use Emacs to automate everything else. This example from my config file shows how rcirc notifications are sent to the notification bar, and how every action received by wmii (which could be from any source) calls a hook.

(defun wmii-rcirc-notification (proc sender response target text)
  (wmii-write-to-button-with-timer "rbar" "!notice" (format "%s: %s" sender text) 10))

(add-hook 'rcirc-print-hooks 'wmii-rcirc-notification)

;; Adding event hooks Every event received by wmii is passed to the
;; functions in wmii-event-hook; we can take advantage of that to add
;; all sorts of additional functions.
;; Here we turn on transparency for every created client; this could
;; be changed to limit it to only certain clients, etc.

(add-hook 'wmii-event-hook (lambda (ev)
			     (let ((event-type (car (split-string ev)))
				   (client (cadr (split-string ev))))
			       (when (equal (downcase event-type) "createclient")
				 (wmii-transparency-toggle client)))))

This document was generated on December 29, 2023 using texi2any.