Skip to content

Commit ba63bac

Browse files
authored
Add short aliases for OSM() (#25443)
1 parent 90b5c17 commit ba63bac

File tree

3 files changed

+113
-13
lines changed

3 files changed

+113
-13
lines changed

‎docs/keycodes.md‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ See also: [Layer Switching](feature_layers#switching-and-toggling-layers)
404404
|`DF(layer)` |Set the base (default) layer until the keyboard loses power |
405405
|`PDF(layer)` |Set the base (default) layer in EEPROM |
406406
|`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. |
408407
|`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)`|
409408
|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
410409
|`TG(layer)` |Toggle `layer` on or off |
@@ -817,13 +816,41 @@ See also: [US ANSI Shifted Symbols](keycodes_us_ansi_shifted)
817816

818817
See also: [One Shot Keys](one_shot_keys)
819818

820-
|Key |Aliases |Description |
821-
|--------------------|---------|----------------------------------|
822-
|`OSM(mod)` | |Hold `mod` for one keypress |
823-
|`OSL(layer)` | |Switch to `layer` for one keypress|
824-
|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
825-
|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
826-
|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
819+
|Key |Aliases |Description |
820+
|--------------------|---------|---------------------------------------------------------------------|
821+
|`QK_ONE_SHOT_TOGGLE`|`OS_TOGG`|Toggles One Shot keys status |
822+
|`QK_ONE_SHOT_ON` |`OS_ON` |Turns One Shot keys on |
823+
|`QK_ONE_SHOT_OFF` |`OS_OFF` |Turns One Shot keys off |
824+
|`OSL(layer)` | |Switch to `layer` for one keypress |
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|
827854

828855
## Programmable Button Support {#programmable-button}
829856

‎docs/one_shot_keys.md‎

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,49 @@ You can control the behavior of one shot keys by defining these in `config.h`:
1515
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
1616
```
1717
18-
* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap), not the `KC_*` codes.
19-
* `OSL(layer)` - momentary switch to *layer*.
20-
* `OS_ON` - Turns on One Shot keys.
21-
* `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`.
22-
* `OS_TOGG` - Toggles the one shot key status.
18+
## Keycodes {#keycodes}
19+
20+
|Key |Aliases |Description |
21+
|--------------------|---------|---------------------------------------------------------------------|
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+
56+
When One Shot keys are turned off, `OSM()` and `OSL()` will behave like normal modifier keys and `MO()`, respectively.
57+
58+
::: info
59+
The `mod` parameter to the `OSM()` keycode must use the `MOD_*` prefix, rather than `KC_*`, eg. `OSM(MOD_LCTL | MOD_LSFT)`.
60+
:::
2361
2462
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
2563

‎quantum/quantum_keycodes.h‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,41 @@
128128
#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0x1F))
129129
#define QK_ONE_SHOT_MOD_GET_MODS(kc) ((kc)&0x1F)
130130

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+
131166
// Layer tap-toggle - 32 layer max
132167
#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0x1F))
133168
#define QK_LAYER_TAP_TOGGLE_GET_LAYER(kc) ((kc)&0x1F)

0 commit comments

Comments
 (0)