Skip to content
Frsf Nrrg edited this page Jun 12, 2018 · 9 revisions

Format

bindsym [--release] [--locked] <Modifiers><Keysyms> <command>
bindcode [--release] [--locked] <Modifiers><Keycodes> <command>

How to identify keys

If you have xev available, run xev -event keyboard to find the translated keysyms and keycodes corresponding to a given key press or release.

A list of keysym names can be found in the xkbcommon-keysyms.h header file, usually located in /usr/include/xkbcommon/.

On Linux, scancode ids are often available in the linux/input-event-codes.h header; the xkb keycodes are typically scancode + 8.

Examples

# These two shortcuts are equivalent
bindsym Ctrl+Shift+1 restart
bindsym Ctrl+exclam restart

# As are these
bindsym Ctrl+q+p exit
bindsym Ctrl+p+q exit

# When the <ESC> key is pressed, switch to workspace "F"
bindcode 9 workspace F

# When the right shift key is released, run the program `false`
bindcode --release Shift_R exec false

# When all modifiers but Caps Lock are active, and keys A
# through G, 1 through 5 are pressed simultaneously, exit
bindsym Mod5+Mod4+Mod3+Mod2+Mod1+Shift+Ctrl+a+b+c+d+e+f+g+1+2+3+4+5 exit

Caveats

Pressing multiple keys which would result in the same modifier change if pressed alone (such as Shift_L and Shift_R on US keyboards) may trigger bindings like bindsym Shift+Shift_R, possibly contrary to expectation.