summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/keycodes.md43
-rw-r--r--docs/one_shot_keys.md48
-rw-r--r--quantum/quantum_keycodes.h35
3 files changed, 113 insertions, 13 deletions
diff --git a/docs/keycodes.md b/docs/keycodes.md
index 5d983e347e..33014a54a5 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -404,7 +404,6 @@ See also: [Layer Switching](feature_layers#switching-and-toggling-layers)
404|`DF(layer)` |Set the base (default) layer until the keyboard loses power | 404|`DF(layer)` |Set the base (default) layer until the keyboard loses power |
405|`PDF(layer)` |Set the base (default) layer in EEPROM | 405|`PDF(layer)` |Set the base (default) layer in EEPROM |
406|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)| 406|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)|
407|`OSL(layer)` |Momentarily activates `layer` until a key is pressed. See [One Shot Keys](one_shot_keys) for details. |
408|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. Where `mod` is a mods_bit. Mods can be viewed [here](mod_tap). Example Implementation: `LM(LAYER_1, MOD_LALT)`| 407|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. Where `mod` is a mods_bit. Mods can be viewed [here](mod_tap). Example Implementation: `LM(LAYER_1, MOD_LALT)`|
409|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped | 408|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
410|`TG(layer)` |Toggle `layer` on or off | 409|`TG(layer)` |Toggle `layer` on or off |
@@ -817,13 +816,41 @@ See also: [US ANSI Shifted Symbols](keycodes_us_ansi_shifted)
817 816
818See also: [One Shot Keys](one_shot_keys) 817See also: [One Shot Keys](one_shot_keys)
819 818
820|Key |Aliases |Description | 819|Key |Aliases |Description |
821|--------------------|---------|----------------------------------| 820|--------------------|---------|---------------------------------------------------------------------|
822|`OSM(mod)` | |Hold `mod` for one keypress | 821|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
823|`OSL(layer)` | |Switch to `layer` for one keypress| 822|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
824|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status | 823|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
825|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on | 824|`OSL(layer)` | |Switch to `layer` for one keypress |
826|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off | 825|`OSM(mod)` | |Hold `mod` for one keypress |
826|`OS_LCTL` | |Hold Left Control for one keypress |
827|`OS_LSFT` | |Hold Left Shift for one keypress |
828|`OS_LALT` | |Hold Left Alt for one keypress |
829|`OS_LGUI` | |Hold Left GUI for one keypress |
830|`OS_LCS` | |Hold Left Control and Left Shift for one keypress |
831|`OS_LCA` | |Hold Left Control and left Alt for one keypress |
832|`OS_LCG` | |Hold Left Control and Left GUI for one keypress |
833|`OS_LSA` | |Hold Left Shift and Left Alt for one keypress |
834|`OS_LSG` | |Hold Left Shift and Left GUI for one keypress |
835|`OS_LAG` | |Hold Left Alt and Left GUI for one keypress |
836|`OS_LCSG` | |Hold Left Control, Left Shift and Left GUI for one keypress |
837|`OS_LCAG` | |Hold Left Control, Left Alt and Left GUI for one keypress |
838|`OS_LSAG` | |Hold Left Shift, Left Alt and Left GUI for one keypress |
839|`OS_RCTL` | |Hold Right Control for one keypress |
840|`OS_RSFT` | |Hold Right Shift for one keypress |
841|`OS_RALT` | |Hold Right Alt for one keypress |
842|`OS_RGUI` | |Hold Right GUI for one keypress |
843|`OS_RCS` | |Hold Right Control and Right Shift for one keypress |
844|`OS_RCA` | |Hold Right Control and Right Alt for one keypress |
845|`OS_RCG` | |Hold Right Control and Right GUI for one keypress |
846|`OS_RSA` | |Hold Right Shift and Right Alt for one keypress |
847|`OS_RSG` | |Hold Right Shift and Right GUI for one keypress |
848|`OS_RAG` | |Hold Right Alt and Right GUI for one keypress |
849|`OS_RCSG` | |Hold Right Control, Right Shift and Right GUI for one keypress |
850|`OS_RCAG` | |Hold Right Control, Right Alt and Right GUI for one keypress |
851|`OS_RSAG` | |Hold Right Shift, Right Alt and Right GUI for one keypress |
852|`OS_MEH` | |Hold Left Control, Left Shift and Left Alt for one keypress |
853|`OS_HYPR` | |Hold Left Control, Left Shift, Left Alt and Left GUI for one keypress|
827 854
828## Programmable Button Support {#programmable-button} 855## Programmable Button Support {#programmable-button}
829 856
diff --git a/docs/one_shot_keys.md b/docs/one_shot_keys.md
index 140c8de475..c4d8e3a4bc 100644
--- a/docs/one_shot_keys.md
+++ b/docs/one_shot_keys.md
@@ -15,11 +15,49 @@ You can control the behavior of one shot keys by defining these in `config.h`:
15#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */ 15#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
16``` 16```
17 17
18* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap), not the `KC_*` codes. 18## Keycodes {#keycodes}
19* `OSL(layer)` - momentary switch to *layer*. 19
20* `OS_ON` - Turns on One Shot keys. 20|Key |Aliases |Description |
21* `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`. 21|--------------------|---------|---------------------------------------------------------------------|
22* `OS_TOGG` - Toggles the one shot key status. 22|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
23|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
24|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
25|`OSL(layer)` | |Switch to `layer` for one keypress |
26|`OSM(mod)` | |Hold `mod` for one keypress |
27|`OS_LCTL` | |Hold Left Control for one keypress |
28|`OS_LSFT` | |Hold Left Shift for one keypress |
29|`OS_LALT` | |Hold Left Alt for one keypress |
30|`OS_LGUI` | |Hold Left GUI for one keypress |
31|`OS_LCS` | |Hold Left Control and Left Shift for one keypress |
32|`OS_LCA` | |Hold Left Control and left Alt for one keypress |
33|`OS_LCG` | |Hold Left Control and Left GUI for one keypress |
34|`OS_LSA` | |Hold Left Shift and Left Alt for one keypress |
35|`OS_LSG` | |Hold Left Shift and Left GUI for one keypress |
36|`OS_LAG` | |Hold Left Alt and Left GUI for one keypress |
37|`OS_LCSG` | |Hold Left Control, Left Shift and Left GUI for one keypress |
38|`OS_LCAG` | |Hold Left Control, Left Alt and Left GUI for one keypress |
39|`OS_LSAG` | |Hold Left Shift, Left Alt and Left GUI for one keypress |
40|`OS_RCTL` | |Hold Right Control for one keypress |
41|`OS_RSFT` | |Hold Right Shift for one keypress |
42|`OS_RALT` | |Hold Right Alt for one keypress |
43|`OS_RGUI` | |Hold Right GUI for one keypress |
44|`OS_RCS` | |Hold Right Control and Right Shift for one keypress |
45|`OS_RCA` | |Hold Right Control and Right Alt for one keypress |
46|`OS_RCG` | |Hold Right Control and Right GUI for one keypress |
47|`OS_RSA` | |Hold Right Shift and Right Alt for one keypress |
48|`OS_RSG` | |Hold Right Shift and Right GUI for one keypress |
49|`OS_RAG` | |Hold Right Alt and Right GUI for one keypress |
50|`OS_RCSG` | |Hold Right Control, Right Shift and Right GUI for one keypress |
51|`OS_RCAG` | |Hold Right Control, Right Alt and Right GUI for one keypress |
52|`OS_RSAG` | |Hold Right Shift, Right Alt and Right GUI for one keypress |
53|`OS_MEH` | |Hold Left Control, Left Shift and Left Alt for one keypress |
54|`OS_HYPR` | |Hold Left Control, Left Shift, Left Alt and Left GUI for one keypress|
55
56When One Shot keys are turned off, `OSM()` and `OSL()` will behave like normal modifier keys and `MO()`, respectively.
57
58::: info
59The `mod` parameter to the `OSM()` keycode must use the `MOD_*` prefix, rather than `KC_*`, eg. `OSM(MOD_LCTL | MOD_LSFT)`.
60:::
23 61
24Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine. 62Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
25 63
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index a2a86e175c..515386756d 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -128,6 +128,41 @@
128#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0x1F)) 128#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0x1F))
129#define QK_ONE_SHOT_MOD_GET_MODS(kc) ((kc)&0x1F) 129#define QK_ONE_SHOT_MOD_GET_MODS(kc) ((kc)&0x1F)
130 130
131#define OS_LCTL OSM(MOD_LCTL)
132#define OS_LSFT OSM(MOD_LSFT)
133#define OS_LALT OSM(MOD_LALT)
134#define OS_LGUI OSM(MOD_LGUI)
135
136#define OS_LCS OSM(MOD_LCTL | MOD_LSFT)
137#define OS_LCA OSM(MOD_LCTL | MOD_LALT)
138#define OS_LCG OSM(MOD_LCTL | MOD_LGUI)
139#define OS_LSA OSM(MOD_LSFT | MOD_LALT)
140#define OS_LSG OSM(MOD_LSFT | MOD_LGUI)
141#define OS_LAG OSM(MOD_LALT | MOD_LGUI)
142
143#define OS_LCSG OSM(MOD_LCTL | MOD_LSFT | MOD_LGUI)
144#define OS_LCAG OSM(MOD_LCTL | MOD_LALT | MOD_LGUI)
145#define OS_LSAG OSM(MOD_LSFT | MOD_LALT | MOD_LGUI)
146
147#define OS_RCTL OSM(MOD_RCTL)
148#define OS_RSFT OSM(MOD_RSFT)
149#define OS_RALT OSM(MOD_RALT)
150#define OS_RGUI OSM(MOD_RGUI)
151
152#define OS_RCS OSM(MOD_RCTL | MOD_RSFT)
153#define OS_RCA OSM(MOD_RCTL | MOD_RALT)
154#define OS_RCG OSM(MOD_RCTL | MOD_RGUI)
155#define OS_RSA OSM(MOD_RSFT | MOD_RALT)
156#define OS_RSG OSM(MOD_RSFT | MOD_RGUI)
157#define OS_RAG OSM(MOD_RALT | MOD_RGUI)
158
159#define OS_RCSG OSM(MOD_RCTL | MOD_RSFT | MOD_RGUI)
160#define OS_RCAG OSM(MOD_RCTL | MOD_RALT | MOD_RGUI)
161#define OS_RSAG OSM(MOD_RSFT | MOD_RALT | MOD_RGUI)
162
163#define OS_MEH OSM(MOD_LCTL | MOD_LSFT | MOD_LALT)
164#define OS_HYPR OSM(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI)
165
131// Layer tap-toggle - 32 layer max 166// Layer tap-toggle - 32 layer max
132#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0x1F)) 167#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0x1F))
133#define QK_LAYER_TAP_TOGGLE_GET_LAYER(kc) ((kc)&0x1F) 168#define QK_LAYER_TAP_TOGGLE_GET_LAYER(kc) ((kc)&0x1F)