diff --git a/Shortcut-handling.md b/Shortcut-handling.md new file mode 100644 index 0000000..8044328 --- /dev/null +++ b/Shortcut-handling.md @@ -0,0 +1,41 @@ +### Format + + bindsym [--release] [--locked] + bindcode [--release] [--locked] + +### 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 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.