XCHAINKEYS(1)

๐Ÿ“ฆ
version 0.11 ยท 2 versions
, in nixos 26.05

๐ŸŽ€ XCHAINKEYS(1) ๐ŸŽ€

okay bestie, so this is the manual page for xchainkeys โ€” yes it's section 1, we love that for it ๐Ÿ’… โ€” and honestly? it's giving main character energy for your keyboard. let's get into it.


โœจ NAME โœจ

xchainkeys โ€” chained keybindings for X11. that's it. that's the vibe. ๐Ÿฆ‹

โœจ SYNOPSIS โœจ

xchainkeys [options]

โœจ DESCRIPTION โœจ

so xchainkeys is a standalone X11 program that lets you create chained key bindings โ€” like the ones you already simp for in the ratpoison(1) window manager or the screen(1) terminal multiplexer. no cap, it just does that. ๐Ÿ”ฅ

โœจ OPTIONS โœจ

  • -f, --file <filename> โ€” load an alternative configuration file. (yes, you can have more than one. we stan options ๐Ÿ’–)
  • -k, --keys โ€” interactively show valid keyspecs for key combinations. basically a little keyspec oracle, use it, fr fr.
  • -d, --debug โ€” show debug messages on stdout. for when you're in your detective era ๐Ÿ•ต๏ธ
  • -h, --help โ€” show usage information. classic. iconic. never misses.
  • -v, --version โ€” show version information. ๐Ÿ’ซ

๐ŸŒธ CONFIGURATION ๐ŸŒธ

your config file lives at

~/.config/xchainkeys/xchainkeys.conf

and the XDG_CONFIG_HOME environment variable will be respected, in compliance with the XDG Base Directory Specification (see REFERENCES below, bestie, it's all linked up ๐Ÿซถ).

an example configuration file has been installed to

/nix/store/bx08n3ddbz4b40z7ymwhrvdxymmqaal7-xchainkeys-0.11/share/doc/xchainkeys/example.conf

yes that whole path. copy it exactly. it's not a typo, it's just Nix being Nix ๐Ÿ˜ญ

Syntax

every line may contain either a global setting or a keybinding definition. empty lines and lines starting with a numbersign (#) are ignored. so go ahead and comment your heart out, queen ๐Ÿ’…

Global Settings

global settings are defined as key-value pairs, separated by whitespace. simple, clean, slay.

  • timeout <n> (default: 3000) โ€” wait n milliseconds for another key to be pressed before aborting an active keychain. a value of 0 will prevent automatic timeout. this value may be overridden by a timeout argument supplied to an :enter action โ€” see Actions below, iykyk โณ
  • feedback <on|off> (default: on) โ€” show feedback in a small popup window. a literal little popup, adorable.
  • delay <n> (default: 1000) โ€” show current chain status after n milliseconds of inactivity in an active chain.
  • hold <n> (default: <delay>) โ€” show error messages for n milliseconds after a chain has been aborted. if not set, the value of delay will be used. (yes, it inherits. nepotism but make it config ๐Ÿ’€)
  • position <x|offset|mouse|center> [<y>] (default: center) โ€” the position of the feedback window. an absolute position can be specified with the x and y arguments. a relative position can be specified using the offset portion of a standard X geometry string. the value mouse will cause the window to appear centered around the current mouse pointer position. the value center will center the window on the default screen. go ahead, place it anywhere, be free ๐ŸŒˆ
  • font <fontstring> (default: fixed) โ€” the X11 font to use for text in the feedback window. make it cute if you want idc.
  • foreground <name|#rrggbb> (default: black) โ€” the foreground color of the text and the border of the feedback window.
  • background <name|#rrggbb> (default: white) โ€” the background color of the feedback window. aesthetic is customizable, thank god ๐ŸŽจ

Keybindings

keybindings are defined using the following syntax:

<keyspec> [<keyspec>...] :<action> ["<name>"] [<arguments>...]

a keyspec consists of one or more optional modifier names, followed by either a symbolic key name or a numeric keycode, each separated by a hyphen (-):

<mod>-[<mod>-...]<keyname|keycode>

modifier names, bestie, here's the cheat sheet ๐Ÿ“‹:

  • S, Shift = Shift key
  • C, Ctrl = Control key
  • A, M, Alt, Meta = Alt key
  • W, H, Super, Hyper, Windows = Super key

the generic modifier names Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4 and Mod5 are recognized in addition to the above. so many names, all valid, we love a flexible icon โœจ

key names correspond to the symbolic key names defined in /usr/include/X11/keysymdef.h (with their XK_ prefix removed).

numeric keycodes may be supplied in decimal, hexadecimal or octal format, e.g. 16 (decimal) = 0x10 (hexadecimal) = 020 octal. math girlies rise ๐Ÿงฎ

you can use xchainkeys -k to find the proper keyspec for key combinations. genuinely such a lifesaver, ngl.

Actions

  • :enter [timeout=<n>] [abort=<auto|manual>] โ€” enters a keychain. the keyboard will be grabbed exclusively until another keystroke has been processed, or until the chain times out after n milliseconds. if the key is bound within this chain, the associated action will be invoked, otherwise the user will be notified that an unbound key has been pressed. (rude of them but okay ๐Ÿ™ˆ)

if the abort argument is set to manual, the chain prefix will remain activated and further keystrokes will be processed until the chain is manually aborted with the :abort action. if set to auto (the default), the chain will abort immediately after the first keystroke has been processed.

if the timeout argument is omitted, the global timeout setting will apply. a value of 0 disables the timeout for this chain.

  • :abort โ€” abort the current keychain, releasing any previous grab on the keyboard. if not explicitly bound, :abort will be bound to prefix C-g by default. the panic button, but make it chic ๐Ÿ’…
  • :escape โ€” send the prefix key key of this chain to the currently focused window and abort the chain. if not explicitly bound, :escape will be bound to prefix prefix, e.g. for a chain prefixed with C-t the :escape action will be bound to C-t C-t by default.

this feature is implemented using XSendEvent(3). note that applications may refuse to accept synthetic events generated with XSendEvent. yeah. that's a real caveat, don't come for me, it's in the source ๐Ÿซ 

  • :exec [abort=auto] <command> โ€” asynchronously execute command as a shell command. if abort=auto is given, this binding will always abort the current chain after executing the command, even if the chain was entered with abort=manual. (overachiever behavior, honestly ๐Ÿ˜Œ)
  • :wait <command> โ€” ungrabs the keyboard, executes command as a shell command, waits until the command has completed and grabs the keyboard again if necessary. use this action to run commands that also grab the keyboard (e.g. scrot --select). sharing is caring ๐Ÿซถ
  • :group ["<name>"] [abort=auto] <command> โ€” associate a binding with a named group and asynchronously execute command as a shell command.

when a :group action is activated, timeout and automatic abort are disabled for the current chain prefix, and only bindings in the same group will be recognized for subsequent key presses. any other keys will abort the chain and revert the above changes.

if abort=auto is given for particular binding within a group, this binding will always abort the current chain after executing the command, effectively overriding the implied abort=manual option.

in addition, if the key used to abort the chain key is a toplevel chain prefix key, the corresponding chain will be entered immediately after this chain aborts. see EXAMPLES below for possible uses.

if no explicit name is given, the group name "default" is used.

  • :repeat <command> โ€” deprecated. equivalent to :group "default". it's giving legacy code, we still love her though ๐Ÿ•ฏ๏ธ
  • :load [<filename>]
  • :reload [<filename>] โ€” clear the current bindings and (re)load the configuration file specified by filename. if no file is specified, the current configuration file is reloaded. refresh, restart, rebrand โœจ

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

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". typing out a whole word as a shortcut, we love an extra queen ๐Ÿ‘‘

the following example creates a named :group of bindings to implement a dedicated frame resize mode for the musca(1) 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. it's giving seamless transitions, we're obsessed ๐Ÿฆ‹

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. efficiency slay ๐Ÿ’…


๐Ÿ’€ KNOWN ISSUES ๐Ÿ’€

some window managers assume that no other program has grabbed any global key combinations before them, and may fail with a fatal error when trying to grab a key that has already been grabbed as a prefix key by xchainkeys. this situation is likely to occur when xchainkeys is started before the window manager in ~/.xinitrc. the audacity, honestly ๐Ÿ˜ญ

in general, binding the same key combinations in xchainkeys and other programs should be avoided. just don't do it bestie, it's not worth the drama.

๐Ÿ’€ BUGS ๐Ÿ’€

this software is currently in beta state. please file bugs on the googlecode issue tracker.

http://code.google.com/p/xchainkeys/issues

use the email address below for questions, feature requests and comments. we're listening ๐Ÿซถ

Copyright (C) 2010-2012 Henning Bekel <h.bekel@googlemail.com>

๐Ÿ“œ LICENSE ๐Ÿ“œ

xchainkeys is licensed under the GNU General Public License v3, see http://www.gnu.org/licenses/gpl.html. legal queen behavior, we respect it โš–๏ธ

๐Ÿ”— REFERENCES ๐Ÿ”—

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

Xorg(1) screen(1) ratpoison(1) musca(1)


okay that's the whole thing bestie, go forth and chain your keys ๐ŸŒˆโœจ

lowkey this page is from the Linux manual set, dated 2010-09-16 โ€” vintage but still iconic, like a good pair of jeans. mwah ๐Ÿ’‹ ๐Ÿฆ‹ ๐ŸŽ€
๐Ÿ“ฆ where this page comes from