aboutsummaryrefslogtreecommitdiff
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)
|`DF(layer)` |Set the base (default) layer until the keyboard loses power |
|`PDF(layer)` |Set the base (default) layer in EEPROM |
|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)|
-|`OSL(layer)` |Momentarily activates `layer` until a key is pressed. See [One Shot Keys](one_shot_keys) for details. |
|`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)`|
|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
|`TG(layer)` |Toggle `layer` on or off |
@@ -817,13 +816,41 @@ See also: [US ANSI Shifted Symbols](keycodes_us_ansi_shifted)
See also: [One Shot Keys](one_shot_keys)
-|Key |Aliases |Description |
-|--------------------|---------|----------------------------------|
-|`OSM(mod)` | |Hold `mod` for one keypress |
-|`OSL(layer)` | |Switch to `layer` for one keypress|
-|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
-|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
-|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
+|Key |Aliases |Description |
+|--------------------|---------|---------------------------------------------------------------------|
+|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
+|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
+|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
+|`OSL(layer)` | |Switch to `layer` for one keypress |
+|`OSM(mod)` | |Hold `mod` for one keypress |
+|`OS_LCTL` | |Hold Left Control for one keypress |
+|`OS_LSFT` | |Hold Left Shift for one keypress |
+|`OS_LALT` | |Hold Left Alt for one keypress |
+|`OS_LGUI` | |Hold Left GUI for one keypress |
+|`OS_LCS` | |Hold Left Control and Left Shift for one keypress |
+|`OS_LCA` | |Hold Left Control and left Alt for one keypress |
+|`OS_LCG` | |Hold Left Control and Left GUI for one keypress |
+|`OS_LSA` | |Hold Left Shift and Left Alt for one keypress |
+|`OS_LSG` | |Hold Left Shift and Left GUI for one keypress |
+|`OS_LAG` | |Hold Left Alt and Left GUI for one keypress |
+|`OS_LCSG` | |Hold Left Control, Left Shift and Left GUI for one keypress |
+|`OS_LCAG` | |Hold Left Control, Left Alt and Left GUI for one keypress |
+|`OS_LSAG` | |Hold Left Shift, Left Alt and Left GUI for one keypress |
+|`OS_RCTL` | |Hold Right Control for one keypress |
+|`OS_RSFT` | |Hold Right Shift for one keypress |
+|`OS_RALT` | |Hold Right Alt for one keypress |
+|`OS_RGUI` | |Hold Right GUI for one keypress |
+|`OS_RCS` | |Hold Right Control and Right Shift for one keypress |
+|`OS_RCA` | |Hold Right Control and Right Alt for one keypress |
+|`OS_RCG` | |Hold Right Control and Right GUI for one keypress |
+|`OS_RSA` | |Hold Right Shift and Right Alt for one keypress |
+|`OS_RSG` | |Hold Right Shift and Right GUI for one keypress |
+|`OS_RAG` | |Hold Right Alt and Right GUI for one keypress |
+|`OS_RCSG` | |Hold Right Control, Right Shift and Right GUI for one keypress |
+|`OS_RCAG` | |Hold Right Control, Right Alt and Right GUI for one keypress |
+|`OS_RSAG` | |Hold Right Shift, Right Alt and Right GUI for one keypress |
+|`OS_MEH` | |Hold Left Control, Left Shift and Left Alt for one keypress |
+|`OS_HYPR` | |Hold Left Control, Left Shift, Left Alt and Left GUI for one keypress|
## Programmable Button Support {#programmable-button}
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`:
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
```
-* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap), not the `KC_*` codes.
-* `OSL(layer)` - momentary switch to *layer*.
-* `OS_ON` - Turns on One Shot keys.
-* `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`.
-* `OS_TOGG` - Toggles the one shot key status.
+## Keycodes {#keycodes}
+
+|Key |Aliases |Description |
+|--------------------|---------|---------------------------------------------------------------------|
+|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
+|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
+|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
+|`OSL(layer)` | |Switch to `layer` for one keypress |
+|`OSM(mod)` | |Hold `mod` for one keypress |
+|`OS_LCTL` | |Hold Left Control for one keypress |
+|`OS_LSFT` | |Hold Left Shift for one keypress |
+|`OS_LALT` | |Hold Left Alt for one keypress |
+|`OS_LGUI` | |Hold Left GUI for one keypress |
+|`OS_LCS` | |Hold Left Control and Left Shift for one keypress |
+|`OS_LCA` | |Hold Left Control and left Alt for one keypress |
+|`OS_LCG` | |Hold Left Control and Left GUI for one keypress |
+|`OS_LSA` | |Hold Left Shift and Left Alt for one keypress |
+|`OS_LSG` | |Hold Left Shift and Left GUI for one keypress |
+|`OS_LAG` | |Hold Left Alt and Left GUI for one keypress |
+|`OS_LCSG` | |Hold Left Control, Left Shift and Left GUI for one keypress |
+|`OS_LCAG` | |Hold Left Control, Left Alt and Left GUI for one keypress |
+|`OS_LSAG` | |Hold Left Shift, Left Alt and Left GUI for one keypress |
+|`OS_RCTL` | |Hold Right Control for one keypress |
+|`OS_RSFT` | |Hold Right Shift for one keypress |
+|`OS_RALT` | |Hold Right Alt for one keypress |
+|`OS_RGUI` | |Hold Right GUI for one keypress |
+|`OS_RCS` | |Hold Right Control and Right Shift for one keypress |
+|`OS_RCA` | |Hold Right Control and Right Alt for one keypress |
+|`OS_RCG` | |Hold Right Control and Right GUI for one keypress |
+|`OS_RSA` | |Hold Right Shift and Right Alt for one keypress |
+|`OS_RSG` | |Hold Right Shift and Right GUI for one keypress |
+|`OS_RAG` | |Hold Right Alt and Right GUI for one keypress |
+|`OS_RCSG` | |Hold Right Control, Right Shift and Right GUI for one keypress |
+|`OS_RCAG` | |Hold Right Control, Right Alt and Right GUI for one keypress |
+|`OS_RSAG` | |Hold Right Shift, Right Alt and Right GUI for one keypress |
+|`OS_MEH` | |Hold Left Control, Left Shift and Left Alt for one keypress |
+|`OS_HYPR` | |Hold Left Control, Left Shift, Left Alt and Left GUI for one keypress|
+
+When One Shot keys are turned off, `OSM()` and `OSL()` will behave like normal modifier keys and `MO()`, respectively.
+
+::: info
+The `mod` parameter to the `OSM()` keycode must use the `MOD_*` prefix, rather than `KC_*`, eg. `OSM(MOD_LCTL | MOD_LSFT)`.
+:::
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
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 @@
#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0x1F))
#define QK_ONE_SHOT_MOD_GET_MODS(kc) ((kc)&0x1F)
+#define OS_LCTL OSM(MOD_LCTL)
+#define OS_LSFT OSM(MOD_LSFT)
+#define OS_LALT OSM(MOD_LALT)
+#define OS_LGUI OSM(MOD_LGUI)
+
+#define OS_LCS OSM(MOD_LCTL | MOD_LSFT)
+#define OS_LCA OSM(MOD_LCTL | MOD_LALT)
+#define OS_LCG OSM(MOD_LCTL | MOD_LGUI)
+#define OS_LSA OSM(MOD_LSFT | MOD_LALT)
+#define OS_LSG OSM(MOD_LSFT | MOD_LGUI)
+#define OS_LAG OSM(MOD_LALT | MOD_LGUI)
+
+#define OS_LCSG OSM(MOD_LCTL | MOD_LSFT | MOD_LGUI)
+#define OS_LCAG OSM(MOD_LCTL | MOD_LALT | MOD_LGUI)
+#define OS_LSAG OSM(MOD_LSFT | MOD_LALT | MOD_LGUI)
+
+#define OS_RCTL OSM(MOD_RCTL)
+#define OS_RSFT OSM(MOD_RSFT)
+#define OS_RALT OSM(MOD_RALT)
+#define OS_RGUI OSM(MOD_RGUI)
+
+#define OS_RCS OSM(MOD_RCTL | MOD_RSFT)
+#define OS_RCA OSM(MOD_RCTL | MOD_RALT)
+#define OS_RCG OSM(MOD_RCTL | MOD_RGUI)
+#define OS_RSA OSM(MOD_RSFT | MOD_RALT)
+#define OS_RSG OSM(MOD_RSFT | MOD_RGUI)
+#define OS_RAG OSM(MOD_RALT | MOD_RGUI)
+
+#define OS_RCSG OSM(MOD_RCTL | MOD_RSFT | MOD_RGUI)
+#define OS_RCAG OSM(MOD_RCTL | MOD_RALT | MOD_RGUI)
+#define OS_RSAG OSM(MOD_RSFT | MOD_RALT | MOD_RGUI)
+
+#define OS_MEH OSM(MOD_LCTL | MOD_LSFT | MOD_LALT)
+#define OS_HYPR OSM(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI)
+
// Layer tap-toggle - 32 layer max
#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0x1F))
#define QK_LAYER_TAP_TOGGLE_GET_LAYER(kc) ((kc)&0x1F)