aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_advanced_keycodes.md
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2018-08-31 02:37:05 +1000
committerDrashna Jaelre <drashna@live.com>2018-08-30 09:37:05 -0700
commitce3ccd3f4a5e8ff8ac391887f3357dd8e985a452 (patch)
treed19b89cd7c0c31e6875bd47423bb8b699a9bd251 /docs/feature_advanced_keycodes.md
parent2fcfd5cff7089338385c40a630315939a7a9ebbc (diff)
downloadqmk_firmware-ce3ccd3f4a5e8ff8ac391887f3357dd8e985a452.tar.gz
qmk_firmware-ce3ccd3f4a5e8ff8ac391887f3357dd8e985a452.zip
Docs: Tabulate Modifier & Mod-Tap keycode listings in advanced keycodes docs (#3799)
Diffstat (limited to 'docs/feature_advanced_keycodes.md')
-rw-r--r--docs/feature_advanced_keycodes.md114
1 files changed, 67 insertions, 47 deletions
diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md
index 5713234be..5f30359e0 100644
--- a/docs/feature_advanced_keycodes.md
+++ b/docs/feature_advanced_keycodes.md
@@ -57,53 +57,73 @@ Sometimes, you might want to switch between layers in a macro or as part of a ta
57 57
58# Modifier Keys 58# Modifier Keys
59 59
60These functions allow you to combine a mod with a keycode. When pressed the keydown for the mod will be sent first, and then *kc* will be sent. When released the keyup for *kc* will be sent and then the mod will be sent. 60These allow you to combine a modifier with a keycode. When pressed, the keydown event for the modifier, then `kc` will be sent. On release, the keyup event for `kc`, then the modifier will be sent.
61 61
62* `LSFT(kc)` or `S(kc)` - applies left Shift to *kc* (keycode) 62|Key |Aliases |Description |
63* `RSFT(kc)` - applies right Shift to *kc* 63|----------|----------------------|----------------------------------------------------|
64* `LCTL(kc)` - applies left Control to *kc* 64|`LCTL(kc)`| |Hold Left Control and press `kc` |
65* `RCTL(kc)` - applies right Control to *kc* 65|`LSFT(kc)`|`S(kc)` |Hold Left Shift and press `kc` |
66* `LALT(kc)` - applies left Alt to *kc* 66|`LALT(kc)`| |Hold Left Alt and press `kc` |
67* `RALT(kc)` - applies right Alt to *kc* 67|`LGUI(kc)`|`LCMD(kc)`, `LWIN(kc)`|Hold Left GUI and press `kc` |
68* `LGUI(kc)` - applies left GUI (command/win) to *kc* 68|`RCTL(kc)`| |Hold Right Control and press `kc` |
69* `RGUI(kc)` - applies right GUI (command/win) to *kc* 69|`RSFT(kc)`| |Hold Right Shift and press `kc` |
70* `HYPR(kc)` - applies Hyper (all modifiers) to *kc* 70|`RALT(kc)`| |Hold Right Alt and press `kc` |
71* `MEH(kc)` - applies Meh (all modifiers except Win/Cmd) to *kc* 71|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)`|Hold Right GUI and press `kc` |
72* `LCAG(kc)` - applies CtrlAltGui to *kc* 72|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc`|
73 73|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` |
74You can also chain these, like this: 74|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` |
75 75|`ALTG(kc)`| |Hold Right Control and Alt and press `kc` |
76 LALT(LCTL(KC_DEL)) -- this makes a key that sends Alt, Control, and Delete in a single keypress. 76|`SGUI(kc)`|`SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
77 77|`LCA(kc)` | |Hold Left Control and Alt and press `kc` |
78# Mod Tap 78
79 79You can also chain them, for example `LCTL(LALT(KC_DEL))` makes a key that sends Control+Alt+Delete with a single keypress.
80`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down. 80
81 81# Mod-Tap
82These are the values you can use for the `mod` in `MT()` and `OSM()`: 82
83 83The Mod-Tap key `MT(mod, kc)` acts like a modifier when held, and a regular keycode when tapped. In other words, you can have a key that sends Escape when you tap it, but functions as a Control or Shift key when you hold it down.
84 * MOD_LCTL 84
85 * MOD_LSFT 85The modifiers this keycode and `OSM()` accept are prefixed with `MOD_`, not `KC_`:
86 * MOD_LALT 86
87 * MOD_LGUI 87|Modifier |Description |
88 * MOD_RCTL 88|----------|----------------------------------------|
89 * MOD_RSFT 89|`MOD_LCTL`|Left Control |
90 * MOD_RALT 90|`MOD_LSFT`|Left Shift |
91 * MOD_RGUI 91|`MOD_LALT`|Left Alt |
92 * MOD_HYPR 92|`MOD_LGUI`|Left GUI (Windows/Command/Meta key) |
93 * MOD_MEH 93|`MOD_RCTL`|Right Control |
94 94|`MOD_RSFT`|Right Shift |
95These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped. 95|`MOD_RALT`|Right Alt |
96 96|`MOD_RGUI`|Right GUI (Windows/Command/Meta key) |
97We've added shortcuts to make common modifier/tap (mod-tap) mappings more compact: 97|`MOD_HYPR`|Hyper (Left Control, Shift, Alt and GUI)|
98 98|`MOD_MEH` |Meh (Left Control, Shift, and Alt) |
99 * `CTL_T(kc)` - is LCTL when held and *kc* when tapped 99
100 * `SFT_T(kc)` - is LSFT when held and *kc* when tapped 100You can combine these by ORing them together like so:
101 * `ALT_T(kc)` - is LALT when held and *kc* when tapped 101
102 * `ALGR_T(kc)` - is AltGr when held and *kc* when tapped 102```c
103 * `GUI_T(kc)` - is LGUI when held and *kc* when tapped 103MT(MOD_LCTL | MOD_LSFT, KC_ESC)
104 * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) 104```
105 * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped 105
106 * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift. 106This key would activate Left Control and Left Shift when held, and send Escape when tapped.
107
108For convenience, QMK includes some Mod-Tap shortcuts to make common combinations more compact in your keymap:
109
110|Key |Aliases |Description |
111|------------|---------------------------------------|-------------------------------------------------------|
112|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
113|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
114|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
115|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
116|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
117|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
118|`LGUI_T(kc)`|`LCMD_T(kc)`, `RWIN_T(kc)`, `GUI_T(kc)`|Left GUI when held, `kc` when tapped |
119|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
120|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
121|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
122|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
123|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
124|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
125|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
126|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
107 127
108# One Shot Keys 128# One Shot Keys
109 129