Here is the set of goals for this window manager:
- Common Lisp;
- Simple and easy to maintain code;
- No more than 1000 SLOC;
- Just functionality: don’t do anything fancy (text, icon, color or decoration) to avoid code clutter;
- No EWMH as implementing this would bloat the code for little (if any) improvements for such a simple window manager.
- Install SBCL or CLISP on your system (should be available via your system’s packages);
- Be sure to have quicklisp or ASDF setup.
Append sbcl --script <your path to>/launcher.lisp [height
[width]] to your .xinitrc or .xsession.
Append xhost local:local and clisp <your path to>/launcher.lisp
[height [width]] to your .xinitrc or .xsession.
Note: The optional height and width are used to determine the center and the fullscreen region
You can adapt this window manager to suits your need with the
$HOME/.wm.lisp configuration file. As this file is loaded at
startup almost anything can be done: you could rewrite your own
common lisp window manager from it.
Here’s an example:
;; Change the prefix key and the quit shortcut
(setf *prefix* (compile-shortcut :control #\a))
(setf *quit* (compile-shortcut :control :shift #\q))
;; Use Chrome as web browser
(define-prefix-shortcut (#\w) (raise-or-launch "chrome"))
;; Define a new shortcut for a local application and group all the
;; windows of this app by X Window class.
(define-prefix-shortcut (:mod-1 #\e) (raise-or-launch "envi"))
(push #'(lambda (w) (string= (xclass w) "Idl")) *families*)Control-t is the default prefix key. Every prefix shortcut starts
with it. Hitting the prefix twice takes you to the last used
window. Hitting the prefix plus the character used by the prefix
(e.g. Control-t t) sends the prefix chord to the current window.
Default prefix keyboard shortcuts:
norControl-nis next managed window;porControl-pis previous managed window;craises or runs a xterm;Control-cruns a new xterm;eraises or run an emacs;wraises or runs a web browser (defaults to firefox);Control-llocks the screen withpkill -USR1 xidle;ais the app launcher: keys hit afterwards will look for the correct app;'is the class finder: works like the app launcher but fetch the first window of the given class;ftoggles the current window to fullscreen;Ftoggles to fullscreen and pins the current window;.centers the current window;bbanish mouse pointer;Ppin/unpin the current window (it won’t be movable/resizable);Rreloads the configuration file;Qquits the window manager.
You can also create direct shortcuts with
define-direct-shortcut. Beware that those shortcuts are grabbed
by the root window so choose them wisely.
Meta (or Alt) is the prefix for the mouse.
- left button moves the window;
- right button resize the window;
- middle button resize the window maintaining its center position;
- Shift-right button close the window.
With SBCL, wm.lisp creates a swank server on port 4005. You can
then connect Emacs/SLIME to it (M-x slime-connect) and hack the
window manager live.