mgi / wm

my common lisp window manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Goals

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.

Help

Install

  • Install SBCL or CLISP on your system (should be available via your system’s packages);
  • Be sure to have quicklisp or ASDF setup.

with SBCL

Append sbcl --script <your path to>/launcher.lisp [height [width]] to your .xinitrc or .xsession.

with CLISP

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

Configuration

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*)

Shortcuts

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:

  • n or Control-n is next managed window;
  • p or Control-p is previous managed window;
  • c raises or runs a xterm;
  • Control-c runs a new xterm;
  • e raises or run an emacs;
  • w raises or runs a web browser (defaults to firefox);
  • Control-l locks the screen with pkill -USR1 xidle;
  • a is 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;
  • f toggles the current window to fullscreen;
  • F toggles to fullscreen and pins the current window;
  • . centers the current window;
  • b banish mouse pointer;
  • P pin/unpin the current window (it won’t be movable/resizable);
  • R reloads the configuration file;
  • Q quits 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.

Mouse

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.

Emacs

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.

About

my common lisp window manager

License:ISC License


Languages

Language:Common Lisp 100.0%