mirror of
https://github.com/swaywm/sway.git
synced 2024-11-28 19:01:29 +00:00
Shortcut handling page, as this can include more examples than the man pages should
parent
b1c985a437
commit
078df1f1a5
41
Shortcut-handling.md
Normal file
41
Shortcut-handling.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
### 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.
|
Loading…
Reference in a new issue