From cbabc8dbe6a8476d3082e8bc649d330f87e7b904 Mon Sep 17 00:00:00 2001 From: Albert Y <76888457+filterpaper@users.noreply.github.com> Date: Mon, 12 Dec 2022 23:52:22 +0800 Subject: [Core] Replace Tapping Force Hold feature with Quick Tap Term (#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 --- docs/config_options.md | 13 +++++++------ docs/tap_hold.md | 31 ++++++++++++++++--------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'docs') diff --git a/docs/config_options.md b/docs/config_options.md index 6b1f83214c..edaa739201 100644 --- a/docs/config_options.md +++ b/docs/config_options.md @@ -171,12 +171,13 @@ If you define these options you will enable the associated feature, which may in * See [Ignore Mod Tap Interrupt](tap_hold.md#ignore-mod-tap-interrupt) for details * `#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY` * enables handling for per key `IGNORE_MOD_TAP_INTERRUPT` settings -* `#define TAPPING_FORCE_HOLD` - * makes it possible to use a dual role key as modifier shortly after having been tapped - * See [Tapping Force Hold](tap_hold.md#tapping-force-hold) - * Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle) -* `#define TAPPING_FORCE_HOLD_PER_KEY` - * enables handling for per key `TAPPING_FORCE_HOLD` settings +* `#define QUICK_TAP_TERM 100` + * tap-then-hold timing to use a dual role key to repeat keycode + * See [Quick Tap Term](tap_hold.md#quick-tap-term) + * Changes the timing of Tap Toggle functionality (`TT` or the One Shot Tap Toggle) + * Defaults to `TAPPING_TERM` if not defined +* `#define QUICK_TAP_TERM_PER_KEY` + * enables handling for per key `QUICK_TAP_TERM` settings * `#define LEADER_TIMEOUT 300` * how long before the leader key times out * 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. diff --git a/docs/tap_hold.md b/docs/tap_hold.md index 8914b730b3..fa6c6abc14 100644 --- a/docs/tap_hold.md +++ b/docs/tap_hold.md @@ -375,49 +375,50 @@ bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { } ``` -## Tapping Force Hold +## Quick Tap Term -To enable `tapping force hold`, add the following to your `config.h`: +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. + +`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`: ```c -#define TAPPING_FORCE_HOLD +#define QUICK_TAP_TERM 120 ``` -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. - Example: - `SFT_T(KC_A)` Down - `SFT_T(KC_A)` Up - `SFT_T(KC_A)` Down -- wait until the tapping term expires... -- `SFT_T(KC_A)` Up +- (wait until tapping term expires...) -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. +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. -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. +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. -!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tap Toggle). +!> `QUICK_TAP_TERM` timing will also impact anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tap Toggle). For more granular control of this feature, you can add the following to your `config.h`: ```c -#define TAPPING_FORCE_HOLD_PER_KEY +#define QUICK_TAP_TERM_PER_KEY ``` You can then add the following function to your keymap: ```c -bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { +uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case LT(1, KC_BSPC): - return true; + case SFT_T(KC_SPC): + return QUICK_TAP_TERM - 20; default: - return false; + return QUICK_TAP_TERM; } } ``` +?> If `QUICK_TAP_TERM` is set higher than `TAPPING_TERM`, it will default to `TAPPING_TERM`. + ## Retro Tapping To enable `retro tapping`, add the following to your `config.h`: -- cgit v1.2.3