Skip to content

Commit cbabc8d

Browse files
filterpaperKarlK90
andauthored
[Core] Replace Tapping Force Hold feature with Quick Tap Term (qmk#17007)
* Replace Tapping Force Hold feature with Quick Tap Term * Replace keyboard level TAPPING_FORCE_HOLD with QUICK_TAP_TERM 0 * Deprecate force hold in info_config.json * Before and after quick tap term unit tests * Quick tap unit tests iteration * Keymap config.h correction * Remove TAPPING_FORCE_HOLD_PER_KEY macros that were missed * Add two more test cases for quick tap * Replace TAPPING_FORCE_HOLD with QUICK_TAP_TERM in configs #2 * Replace TAPPING_FORCE_HOLD_PER_KEY with QUICK_TAP_TERM_PER_KEY in configs #2 * Add function declaration for get_quick_tap_term Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
1 parent 8698d10 commit cbabc8d

File tree

226 files changed

+458
-376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+458
-376
lines changed

data/mappings/info_config.hjson

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@
111111
"SOFT_SERIAL_SPEED": {"info_key": "split.soft_serial_speed"},
112112
"TAP_CODE_DELAY": {"info_key": "qmk.tap_keycode_delay", "value_type": "int"},
113113
"TAP_HOLD_CAPS_DELAY": {"info_key": "qmk.tap_capslock_delay", "value_type": "int"},
114-
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "bool"},
115-
"TAPPING_FORCE_HOLD_PER_KEY": {"info_key": "tapping.force_hold_per_key", "value_type": "bool"},
116114
"TAPPING_TERM": {"info_key": "tapping.term", "value_type": "int"},
117115
"TAPPING_TERM_PER_KEY": {"info_key": "tapping.term_per_key", "value_type": "bool"},
118116
"TAPPING_TOGGLE": {"info_key": "tapping.toggle", "value_type": "int"},
@@ -129,6 +127,8 @@
129127
"UNUSED_PINS": {"info_key": "_invalid.unused_pins", "deprecated": true},
130128
"RGBLIGHT_ANIMATIONS": {"info_key": "_invalid.rgblight.animations.all", "value_type": "bool", "invalid": true},
131129
"QMK_KEYS_PER_SCAN": {"info_key": "qmk.keys_per_scan", "value_type": "int", "deprecated": true},
130+
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "bool", "deprecated": true},
131+
"TAPPING_FORCE_HOLD_PER_KEY": {"info_key": "tapping.force_hold_per_key", "value_type": "bool", "deprecated": true},
132132

133133
// USB params, need to mark as failure when specified in config.h, rather than deprecated
134134
"PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex", "deprecated": true, "replace_with": "`usb.pid` in info.json"},

docs/config_options.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,13 @@ If you define these options you will enable the associated feature, which may in
171171
* See [Ignore Mod Tap Interrupt](tap_hold.md#ignore-mod-tap-interrupt) for details
172172
* `#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY`
173173
* enables handling for per key `IGNORE_MOD_TAP_INTERRUPT` settings
174-
* `#define TAPPING_FORCE_HOLD`
175-
* makes it possible to use a dual role key as modifier shortly after having been tapped
176-
* See [Tapping Force Hold](tap_hold.md#tapping-force-hold)
177-
* Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle)
178-
* `#define TAPPING_FORCE_HOLD_PER_KEY`
179-
* enables handling for per key `TAPPING_FORCE_HOLD` settings
174+
* `#define QUICK_TAP_TERM 100`
175+
* tap-then-hold timing to use a dual role key to repeat keycode
176+
* See [Quick Tap Term](tap_hold.md#quick-tap-term)
177+
* Changes the timing of Tap Toggle functionality (`TT` or the One Shot Tap Toggle)
178+
* Defaults to `TAPPING_TERM` if not defined
179+
* `#define QUICK_TAP_TERM_PER_KEY`
180+
* enables handling for per key `QUICK_TAP_TERM` settings
180181
* `#define LEADER_TIMEOUT 300`
181182
* how long before the leader key times out
182183
* If you're having issues finishing the sequence before it times out, you may need to increase the timeout setting. Or you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped.

docs/tap_hold.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,49 +375,50 @@ bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
375375
}
376376
```
377377
378-
## Tapping Force Hold
378+
## Quick Tap Term
379379
380-
To enable `tapping force hold`, add the following to your `config.h`:
380+
When the user holds a key after tapping it, the tapping function is repeated by default, rather than activating the hold function. This allows keeping the ability to auto-repeat the tapping function of a dual-role key. `QUICK_TAP_TERM` enables fine tuning of that ability. If set to `0`, it will remove the auto-repeat ability and activate the hold function instead.
381+
382+
`QUICK_TAP_TERM` is set to `TAPPING_TERM` by default, which is the maximum allowed value for `QUICK_TAP_TERM`. To override its value (in milliseconds) add the following to your `config.h`:
381383
382384
```c
383-
#define TAPPING_FORCE_HOLD
385+
#define QUICK_TAP_TERM 120
384386
```
385387

386-
When the user holds a key after tapping it, the tapping function is repeated by default, rather than activating the hold function. This allows keeping the ability to auto-repeat the tapping function of a dual-role key. `TAPPING_FORCE_HOLD` removes that ability to let the user activate the hold function instead, in the case of holding the dual-role key after having tapped it.
387-
388388
Example:
389389

390390
- `SFT_T(KC_A)` Down
391391
- `SFT_T(KC_A)` Up
392392
- `SFT_T(KC_A)` Down
393-
- wait until the tapping term expires...
394-
- `SFT_T(KC_A)` Up
393+
- (wait until tapping term expires...)
395394

396-
With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto-repeat function.
395+
With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto repeat function until the key is released.
397396

398-
With `TAPPING_FORCE_HOLD`, the second press will be interpreted as a Shift, allowing to use it as a modifier shortly after having used it as a tap.
397+
With `QUICK_TAP_TERM` configured, the timing between `SFT_T(KC_A)` up and `SFT_T(KC_A)` down must be within `QUICK_TAP_TERM` to trigger auto repeat. Otherwise the second press will be sent as a Shift. If `QUICK_TAP_TERM` is set to `0`, the second press will always be sent as a Shift, effectively disabling auto-repeat.
399398

400-
!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tap Toggle).
399+
!> `QUICK_TAP_TERM` timing will also impact anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tap Toggle).
401400

402401
For more granular control of this feature, you can add the following to your `config.h`:
403402

404403
```c
405-
#define TAPPING_FORCE_HOLD_PER_KEY
404+
#define QUICK_TAP_TERM_PER_KEY
406405
```
407406

408407
You can then add the following function to your keymap:
409408

410409
```c
411-
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
410+
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
412411
switch (keycode) {
413-
case LT(1, KC_BSPC):
414-
return true;
412+
case SFT_T(KC_SPC):
413+
return QUICK_TAP_TERM - 20;
415414
default:
416-
return false;
415+
return QUICK_TAP_TERM;
417416
}
418417
}
419418
```
420419
420+
?> If `QUICK_TAP_TERM` is set higher than `TAPPING_TERM`, it will default to `TAPPING_TERM`.
421+
421422
## Retro Tapping
422423
423424
To enable `retro tapping`, add the following to your `config.h`:

keyboards/25keys/zinc/rev1/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
#pragma once
1919

20-
#define TAPPING_FORCE_HOLD
20+
#define QUICK_TAP_TERM 0
2121
#define TAPPING_TERM 100
2222

2323
/* Use I2C or Serial */

keyboards/25keys/zinc/reva/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
#pragma once
1919

20-
#define TAPPING_FORCE_HOLD
20+
#define QUICK_TAP_TERM 0
2121
#define TAPPING_TERM 100
2222

2323
/* Use I2C or Serial */

keyboards/40percentclub/gherkin/keymaps/pierrec83/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
#define TAPPING_TERM 200
2929
#define PERMISSIVE_HOLD
3030
#define IGNORE_MOD_TAP_INTERRUPT
31-
#define TAPPING_FORCE_HOLD
31+
#define QUICK_TAP_TERM 0

keyboards/40percentclub/gherkin/keymaps/stevexyz/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define IGNORE_MOD_TAP_INTERRUPT
1717
// makes it possible to do rolling combos (zx) with keys that convert to other keys on hold, by enforcing the TAPPING_TERM for both keys.
1818

19-
#define TAPPING_FORCE_HOLD
19+
#define QUICK_TAP_TERM 0
2020
// makes it possible to use a dual role key as modifier shortly after having been tapped (see Hold after tap)
2121
// Breaks any Tap Toggle functionality (TT or the One Shot Tap Toggle)
2222

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#define HOLD_ON_OTHER_KEY_PRESS_PER_KEY
2-
#define TAPPING_FORCE_HOLD_PER_KEY
2+
#define QUICK_TAP_TERM_PER_KEY
33
#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY

keyboards/adm42/rev4/keymaps/default/keymap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
114114
}
115115
}
116116

117-
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
117+
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
118118
switch (keycode) {
119119
case LLS_ESC:
120120
case LLS_RALT:
121-
return true;
121+
return 0;
122122
default:
123-
return false;
123+
return QUICK_TAP_TERM;
124124
}
125125
}
126126

keyboards/arabica37/keymaps/default/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
// #define MASTER_RIGHT
2929
// #define EE_HANDS
3030

31-
#define TAPPING_FORCE_HOLD
31+
#define QUICK_TAP_TERM 0
3232
#define TAPPING_TERM 170
3333

3434
#undef RGBLED_NUM

0 commit comments

Comments
 (0)