Return to Contents

2.3: Binding Syntax

In addition to the file's syntax, defined above, binding actions to keystrokes or mouse clicks requires a string argument. This string argument describes which keys and buttons along with which modifier keys are to be bound.

The binding grammar has tokens from three groups:

  1. A KeySym which is one of the symbols from the file <X11/keysym.h>, with the "XK_" prefix removed, except for the following symbols which are not tokens:
    Shift_L
    Shift_R
    Control_L
    Control_R
    Meta_L
    Meta_R
    Alt_L
    Alt_R
    Super_L
    Super_R
    Hyper_L
    Hyper_R
    Caps_Lock
    Shift_Lock

    All of the symbols in this group are CASE-SENSITIVE.

  2. A Modifier, which is one of the following symbols:
    Shift, ShiftMask
    Control, ControlMask
    Mod1, Mod1Mask
    Mod2, Mod2Mask
    Mod3, Mod3Mask
    Mod4, Mod4Mask
    Mod5, Mod5Mask
    Alt, AltMask
    Meta, MetaMask
    Hyper, HyperMask
    Super, SuperMask

    All of the symbols in this group are case-insensitive.

  3. A Button, which is one of the following symbols:
    Button1
    Button2
    Button3
    Button4
    Button5

    All of the symbols in this group are case-insensitive.

You can see what keysyms your keystrokes generate by launching the X program xev(1) and typing into the window. See also xmodmap(1) for more information. The buttons are usually interpreted as follows:
Button1 is the left mouse button.
Button2 is the middle mouse button.
Button3 is the right mouse button.
Button4 is mouse wheel down.
Button5 is mouse wheel up.

The informal grammar for binding to keystrokes is:

string = modlist* keysym

modlist = modifier "|"

modifier = <one of the above symbols from group 2>

keysym = <one of the above symbols from group 1>

The grammar to binding to mouse events is equivalent to that for binding to keystrokes except that buttons are used instead of KeySyms.


Return to Contents