Skip to content

Commit

Permalink
[Core] Replace Tapping Force Hold feature with Quick Tap Term (qmk#17007
Browse files Browse the repository at this point in the history
)

* 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 <[email protected]>
  • Loading branch information
filterpaper and KarlK90 authored Dec 12, 2022
1 parent 8698d10 commit cbabc8d
Show file tree
Hide file tree
Showing 226 changed files with 458 additions and 376 deletions.
4 changes: 2 additions & 2 deletions data/mappings/info_config.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@
"SOFT_SERIAL_SPEED": {"info_key": "split.soft_serial_speed"},
"TAP_CODE_DELAY": {"info_key": "qmk.tap_keycode_delay", "value_type": "int"},
"TAP_HOLD_CAPS_DELAY": {"info_key": "qmk.tap_capslock_delay", "value_type": "int"},
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "bool"},
"TAPPING_FORCE_HOLD_PER_KEY": {"info_key": "tapping.force_hold_per_key", "value_type": "bool"},
"TAPPING_TERM": {"info_key": "tapping.term", "value_type": "int"},
"TAPPING_TERM_PER_KEY": {"info_key": "tapping.term_per_key", "value_type": "bool"},
"TAPPING_TOGGLE": {"info_key": "tapping.toggle", "value_type": "int"},
Expand All @@ -129,6 +127,8 @@
"UNUSED_PINS": {"info_key": "_invalid.unused_pins", "deprecated": true},
"RGBLIGHT_ANIMATIONS": {"info_key": "_invalid.rgblight.animations.all", "value_type": "bool", "invalid": true},
"QMK_KEYS_PER_SCAN": {"info_key": "qmk.keys_per_scan", "value_type": "int", "deprecated": true},
"TAPPING_FORCE_HOLD": {"info_key": "tapping.force_hold", "value_type": "bool", "deprecated": true},
"TAPPING_FORCE_HOLD_PER_KEY": {"info_key": "tapping.force_hold_per_key", "value_type": "bool", "deprecated": true},

// USB params, need to mark as failure when specified in config.h, rather than deprecated
"PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex", "deprecated": true, "replace_with": "`usb.pid` in info.json"},
Expand Down
13 changes: 7 additions & 6 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 16 additions & 15 deletions docs/tap_hold.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
2 changes: 1 addition & 1 deletion keyboards/25keys/zinc/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 100

/* Use I2C or Serial */
Expand Down
2 changes: 1 addition & 1 deletion keyboards/25keys/zinc/reva/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 100

/* Use I2C or Serial */
Expand Down
2 changes: 1 addition & 1 deletion keyboards/40percentclub/gherkin/keymaps/pierrec83/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
#define TAPPING_TERM 200
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
2 changes: 1 addition & 1 deletion keyboards/40percentclub/gherkin/keymaps/stevexyz/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define IGNORE_MOD_TAP_INTERRUPT
// 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.

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

Expand Down
2 changes: 1 addition & 1 deletion keyboards/adm42/rev4/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define HOLD_ON_OTHER_KEY_PRESS_PER_KEY
#define TAPPING_FORCE_HOLD_PER_KEY
#define QUICK_TAP_TERM_PER_KEY
#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
6 changes: 3 additions & 3 deletions keyboards/adm42/rev4/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
}
}

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 LLS_ESC:
case LLS_RALT:
return true;
return 0;
default:
return false;
return QUICK_TAP_TERM;
}
}

Expand Down
2 changes: 1 addition & 1 deletion keyboards/arabica37/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 170

#undef RGBLED_NUM
Expand Down
2 changes: 1 addition & 1 deletion keyboards/atreus/keymaps/kejadlen/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
#define DIODE_DIRECTION COL2ROW

#define IGNORE_MOD_TAP_INTERRUPT
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

#define USB_MAX_POWER_CONSUMPTION 50
2 changes: 1 addition & 1 deletion keyboards/b_sides/rev41lp/keymaps/namnlos/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE, UNICODE_MODE_WINDOWS, UNICODE_MODE_MACOS, UNICODE_MODE_LINUX

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY

Expand Down
2 changes: 1 addition & 1 deletion keyboards/basekeys/slice/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
2 changes: 1 addition & 1 deletion keyboards/basekeys/slice/rev1/keymaps/2moons/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
//#define MASTER_RIGHT
2 changes: 1 addition & 1 deletion keyboards/basekeys/slice/rev1/keymaps/default_all/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
2 changes: 1 addition & 1 deletion keyboards/basekeys/slice/rev1/keymaps/via/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 180
//#define MASTER_RIGHT
2 changes: 1 addition & 1 deletion keyboards/bastardkb/charybdis/3x5/keymaps/bstiq/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*
* See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-force-hold
*/
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

/*
* Tap-or-Hold decision modes.
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bastardkb/dilemma/3x5_2/keymaps/bstiq/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* See docs.qmk.fm/using-qmk/software-features/tap_hold#tapping-force-hold
*/
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

/*
* Tap-or-Hold decision modes.
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bastardkb/dilemma/3x5_3/keymaps/bstiq/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Enable rapid switch from tap to hold. Disable auto-repeat when pressing key
* twice, except for one-shot keys.
*/
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

/*
* Tap-or-Hold decision modes.
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bastardkb/scylla/keymaps/cykedev/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// #define IGNORE_MOD_TAP_INTERRUPT

// Enable rapid switch from tap to hold, disables double tap hold auto-repeat.
// #define TAPPING_FORCE_HOLD
// #define QUICK_TAP_TERM 0

// Apply the modifier on keys that are tapped during a short hold of a modtap
// #define PERMISSIVE_HOLD
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bastardkb/scylla/keymaps/xyverz/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
#define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 300
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/bastardkb/tbk/keymaps/xyverz/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
#define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 300
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/buzzard/keymaps/crehmann/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define IGNORE_MOD_TAP_INTERRUPT

// Enable rapid switch from tap to hold, disables double tap hold auto-repeat.
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

// Apply the modifier on keys that are tapped during a short hold of a modtap
#define PERMISSIVE_HOLD
Expand Down
2 changes: 1 addition & 1 deletion keyboards/buzzard/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define IGNORE_MOD_TAP_INTERRUPT

// Enable rapid switch from tap to hold, disables double tap hold auto-repeat.
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

// Apply the modifier on keys that are tapped during a short hold of a modtap
#define PERMISSIVE_HOLD
Expand Down
2 changes: 1 addition & 1 deletion keyboards/clickety_split/leeloo/keymaps/default/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#undef TAPPING_TERM

#define IGNORE_MOD_TAP_INTERRUPT
#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 150
#endif

Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/ajarov/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

//#define TAPPING_FORCE_HOLD
//#define QUICK_TAP_TERM 0
//#define TAPPING_TERM 100

#ifdef RGBLIGHT_ENABLE
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/antosha417/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define EE_HANDS


#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0

#ifdef RGBLIGHT_ENABLE
#undef RGBLED_NUM
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/ardakilic/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define EE_HANDS


#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 200
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/armand1m/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

// #define TAPPING_FORCE_HOLD
// #define QUICK_TAP_TERM 0
// #define PERMISSIVE_HOLD
#define TAPPING_TERM 300
#define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/benrestech/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
#define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 175
#define PERMISSIVE_HOLD
#define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/bermeo/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

// #define TAPPING_FORCE_HOLD
// #define QUICK_TAP_TERM 0
#define TAPPING_TERM 150
// #define RETRO_TAPPING
// #define IGNORE_MOD_TAP_INTERRUPT
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/blipson/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 100

#ifdef RGBLIGHT_ENABLE
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/colemad/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 200

#ifdef RGB_MATRIX_ENABLE
Expand Down
2 changes: 1 addition & 1 deletion keyboards/crkbd/keymaps/crkdves/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS

#define TAPPING_FORCE_HOLD
#define QUICK_TAP_TERM 0
#define TAPPING_TERM 200
// #define RETRO_TAPPING
// #define IGNORE_MOD_TAP_INTERRUPT
Expand Down
Loading

0 comments on commit cbabc8d

Please sign in to comment.