Skip to content

Commit

Permalink
Adds a way to separate tab from AUTO_SHIFT_SPECIAL. (qmk#20996)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlaneenalra authored and akeep committed Oct 2, 2023
1 parent 4cc3b39 commit be92235
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
47 changes: 43 additions & 4 deletions docs/feature_auto_shift.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,17 @@ groups in the below fallback switch.
### NO_AUTO_SHIFT_SPECIAL (simple define)
Do not Auto Shift special keys, which include -\_, =+, [{, ]}, ;:, '", ,<, .>,
and /?
/?, and the KC_TAB.
### NO_AUTO_SHIFT_TAB (simple define)
Do not Auto Shift KC_TAB but leave Auto Shift enabled for the other special
characters.
### NO_AUTO_SHIFT_SYMBOLS (simple define)
Do not Auto Shift symbol keys, which include -\_, =+, [{, ]}, ;:, '", ,<, .>,
and /?.
### NO_AUTO_SHIFT_NUMERIC (simple define)
Expand All @@ -143,9 +153,13 @@ Do not Auto Shift numeric keys, zero through nine.
Do not Auto Shift alpha characters, which include A through Z.
### AUTO_SHIFT_ENTER (simple define)
Auto Shift the enter key.
### Auto Shift Per Key
There are functions that allows you to determine which keys shold be autoshifted, much like the tap-hold keys.
There are functions that allows you to determine which keys should be autoshifted, much like the tap-hold keys.
The first of these, used to simply add a key to Auto Shift, is `get_custom_auto_shifted_key`:
Expand All @@ -172,9 +186,15 @@ bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
case KC_1 ... KC_0:
# endif
# ifndef NO_AUTO_SHIFT_SPECIAL
# ifndef NO_AUTO_SHIFT_TAB
case KC_TAB:
case KC_MINUS ... KC_SLASH:
case KC_NONUS_BACKSLASH:
# endif
# ifndef NO_AUTO_SHIFT_SYMBOLS
case AUTO_SHIFT_SYMBOLS:
# endif
# endif
# ifdef AUTO_SHIFT_ENTER
case KC_ENT:
# endif
return true;
}
Expand All @@ -192,6 +212,25 @@ Enables keyrepeat.
Disables automatically keyrepeating when `AUTO_SHIFT_TIMEOUT` is exceeded.
### AUTO_SHIFT_ALPHA (predefined key group)
A predefined group of keys representing A through Z.
### AUTO_SHIFT_NUMERIC (predefined key group)
A predefined group of keys representing 0 through 9. Note, these are defined as
1 through 0 since that is the order they normally appear in.
### AUTO_SHIFT_SYMBOLS (predefined key group)
A predefined group of keys representing symbolic characters which include -\_, =+, [{, ]}, ;:, '", ,<, .>,
and /?.
### AUTO_SHIFT_SPECIAL (predefined key group)
A predefined group of keys that combines AUTO_SHIFT_SYMBOLS and KC_TAB.
## Custom Shifted Values
Especially on small keyboards, the default shifted value for many keys is not
Expand Down
10 changes: 9 additions & 1 deletion quantum/process_keycode/process_auto_shift.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r
case AUTO_SHIFT_NUMERIC:
# endif
# ifndef NO_AUTO_SHIFT_SPECIAL
case AUTO_SHIFT_SPECIAL:
# ifndef NO_AUTO_SHIFT_TAB
case KC_TAB:
# endif
# ifndef NO_AUTO_SHIFT_SYMBOLS
case AUTO_SHIFT_SYMBOLS:
# endif
# endif
# ifdef AUTO_SHIFT_ENTER
case KC_ENT:
# endif
return true;
}
Expand Down
8 changes: 6 additions & 2 deletions quantum/process_keycode/process_auto_shift.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@
// clang-format off
#define AUTO_SHIFT_ALPHA KC_A ... KC_Z
#define AUTO_SHIFT_NUMERIC KC_1 ... KC_0
#define AUTO_SHIFT_SYMBOLS \
KC_MINUS ... KC_SLASH: \
case KC_NONUS_BACKSLASH

// Kept to avoid breaking existing keymaps.
#define AUTO_SHIFT_SPECIAL \
KC_TAB: \
case KC_MINUS ... KC_SLASH: \
case KC_NONUS_BACKSLASH
case AUTO_SHIFT_SYMBOLS
// clang-format on

bool process_auto_shift(uint16_t keycode, keyrecord_t *record);
Expand Down

0 comments on commit be92235

Please sign in to comment.