You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
2.6 KiB

  1. `IGNORE_MOD_TAP_INTERRUPT_PER_KEY` has been removed and `IGNORE_MOD_TAP_INTERRUPT` deprecated as a stepping stone towards making `IGNORE_MOD_TAP_INTERRUPT` the new default behavior for mod-taps in the future.
  2. In place of the now removed `IGNORE_MOD_TAP_INTERRUPT_PER_KEY`, one must use the pre-existing `HOLD_ON_OTHER_KEY_PRESS` option.
  3. In most cases, updating `get_ignore_mod_tap_interrupt` to `get_hold_on_other_key_press` is simply a matter of renaming the function and swapping every `true` by `false` and vice versa. The one subtlety you may need to look out for is that the `get_ignore_mod_tap_interrupt` was only ever called with mod-taps passed in as the `keycode` argument, while the `keycode` argument of `get_hold_on_other_key_press` can be any dual-role key. This includes not only mod-taps, but also layer-taps, one shot keys, `TT(layer)` and more. This has an impact on the effect of the `default` case in a typical per-key configuration making use of a `switch(keycode)` statement.
  4. To illustrate, let's take the example of a configuration where we'd want all mod-taps to activate the modifier if another key is pressed while held with the exception of `LCTL_T(KC_A)`, which should ignore keys pressed while it is held and activate the modifier only if it has been held for longer than the tapping term. In addition, we would like to keep the default "ignore-interrupt" behavior of layer taps.
  5. An old way to do this would be via the following code:
  6. ```c
  7. bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
  8. switch(keycode) {
  9. case LCTL_T(KC_A):
  10. return true;
  11. default:
  12. return false;
  13. }
  14. }
  15. ```
  16. The correct way to update this code without accidentally changing how the layer-taps work would be the following:
  17. ```c
  18. bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
  19. switch(keycode) {
  20. // Capture all mod-tap keycodes.
  21. case QK_MOD_TAP ... QK_MOD_TAP_MAX:
  22. if (keycode == LCTL_T(KC_A)) {
  23. // Disable HOLD_ON_OTHER_KEY_PRESS for LCTL_T(KC_A)
  24. // aka enable IGNORE_MOD_TAP_INTERRUPT for LCTL_T(KC_A).
  25. return false;
  26. } else {
  27. // Enable HOLD_ON_OTHER_KEY_PRESS for every other mod-tap keycode.
  28. return true;
  29. }
  30. default:
  31. return false;
  32. }
  33. }
  34. ```
  35. For more information, you are invited to read the sections on [IGNORE_MOD_TAP_INTERRUPT](tap_hold.md#ignore-mod-tap-interrupt) and [HOLD_ON_OTHER_KEY_PRESS](tap_hold.md#hold-on-other-key-press) in the page on [Tap-Hold configuration options](tap_hold.md).