chained keybindings for X11

xchainkeys is a standalone X11 program to create chained key bindings similar to those found in the ratpoison window manager or the screen terminal multiplexer.


Latest stable is xchainkeys-0.11.tar.gz.

All releases can be found under /download/xchainkeys

Latest developments are available via github:

git clone https://github.com/hbekel/xchainkeys


GNU autotools are used for building and installing xchainkeys:

$ ./configure --prefix=/usr
$ make
$ sudo make install

This README file and an example configuration file will be installed to $PREFIX/share/doc/xchainkeys/.

The standard DESTDIR variable can be used for a staged install.


xchainkeys [options]
  -f, --file    : Alternative config file
  -k, --keys    : Show valid keyspecs
  -d, --debug   : Enable debug messages
  -h, --help    : Print this help text
  -v, --version : Print version information

To autostart xchainkeys on X startup, add the following command to your ~/.xinitrc:

xchainkeys &

Alternatively use your WM/DE’s autostart mechanism to start xchainkeys as a background process.


Create the file ~/.config/xchainkeys/xchainkeys.conf or copy the example config file $PREFIX/share/doc/xchainkeys/example.conf to the above location.

See the included manual page for all the details on configuration.


Bind the key sequence “Control-t Return” to run xterm:

C-t Return :exec xterm

This implies creating a default chain with the prefix key C-t, containing default bindings for the :abort and :escape actions, and is thus equivalent to

C-t :enter timeout=3000 abort=auto
C-t C-t :escape
C-t C-g :abort
C-t Return :exec xterm

Note that the number of keys in a keychain is not limited, e.g

C-t x c h a i n k e y s :exec xmessage "xchainkeys!"

can be invoked by pressing C-t and then typing “xchainkeys”.

Musca resize mode

The following example creates a named :group of bindings to implement a dedicated frame resize mode for the musca window manager:

C-w i :group "resize" musca -c 'resize up'
C-w k :group "resize" musca -c 'resize down'
C-w j :group "resize" musca -c 'resize left'
C-w l :group "resize" musca -c 'resize right'

C-w ... (other bindings for window management)

Invoke any of the above bindings (e.g. press C-w i) and then continue to press i, k, j or l to resize the current musca frame. Since timeout and automatic abort are disabled, you can continue resizing until you are satisfied with the result. Then simply press any other key to quit resize mode. If you want to invoke another window management command right away, you can use C-w to quit resize mode and immediately enter the C-w chain (or any other toplevel chain) again.

The benefit of using a named :group over a dedicated chain with timeout=0 and abort=manual is that you don’t have to waste another prefix key. Instead you can temporarily redefine an existing chain to contain only a specific subset of keys, behaving in the desired manner.