1
0
Fork 0
qmk_firmware/lib/python/qmk
Pascal Getreuer 544ddde113
[Core] Add Chordal Hold, an "opposite hands rule" tap-hold option similar to Achordion, Bilateral Combinations. (#24560)
* Chordal Hold: restrict what chords settle as hold

* Chordal Hold: docs and further improvements

* Fix formatting.

* Doc rewording and minor edit.

* Support Chordal Hold of multiple tap-hold keys.

* Fix formatting.

* Simplification and additional test.

* Fix formatting.

* Tighten tests.

* Add test two_mod_taps_same_hand_hold_til_timeout.

* Revise handing of pairs of tap-hold keys.

* Generate a default chordal_hold_layout.

* Document chordal_hold_handedness().

* Add license notice to new and branched files in PR.

* Add `tapping.chordal_hold` property for info.json.

* Update docs/reference_info_json.md

* Revise "hand" jsonschema.

* Chordal Hold: Improved layout handedness heuristic.

This commit improves the heuristic used in generate-keyboard-c for
inferring key handedness from keyboard.json geometry data.

Heuristic summary:

1. If the layout is symmetric (e.g. most split keyboards), guess the
   handedness based on the sign of (x - layout_x_midpoint).

2. Otherwise, if the layout has a key of >=6u width, it is probably the
   spacebar. Form a dividing line through the spacebar, nearly vertical
   but with a slight angle to follow typical row stagger.

3. Otherwise, assume handedness based on the widest horizontal
   separation.

I have tested this strategy on a couple dozen keyboards and found it to
work reliably.

* Use Optional instead of `| None`.

* Refactor to avoid lambdas.

* Remove trailing comma in chordal_hold_layout.

* Minor docs edits.

* Revise to allow combining multiple same-hand mods.

This commit revises Chordal Hold as described in discussion in
https://github.com/qmk/qmk_firmware/pull/24560#discussion_r1894655238

1. In "RCTL_T(KC_A)↓, RSFT_T(KC_C)↓, RCTL_T(KC_A)↑" before the tapping
   term, RCTL_T(KC_A) is settled as tapped.
2. In "RCTL_T(KC_A)↓, RSFT_T(KC_C)↓, RSFT_T(KC_C)↑", both RCTL_T(KC_A)
   and RSFT_T(KC_C) are settled as tapped.
3. In "RCTL_T(KC_A)↓, RSFT_T(KC_C)↓, KC_U↓" (all keys on the same side),
   both RCTL_T(KC_A) and RSFT_T(KC_C) are settled as tapped.
4. In "RCTL_T(KC_A)↓, RSFT_T(KC_C)↓, LSFT_T(KC_T)↓", with the third key
   on the other side, we allow Permissive Hold or Hold On Other Keypress
   to decide how/when to settle the keys.
5. In "RCTL_T(KC_A)↓, RSFT_T(KC_C)↓" held until the tapping term, the
   keys are settled as held.

1–3 provide same-hand roll protection. 4–5 are for combining multiple
same-hand modifiers.

I've updated the unit tests and have been running it on my keyboard, for
a few hours so far, and all seems good. I really like this scheme. It
allows combining same-side mods, yet it also has roll protection on
streaks. For me, this feels like Achordion, but clearly better streak
handling and improved responsiveness.

* Fix formatting.

* Add a couple tests with LT keys.

* Remove stale use of CHORDAL_HOLD_LAYOUT.

* Fix misspelling lastest -> latest

* Handling tweak for LTs and tests.

* Fix formatting.

* More tests with LT keys.

* Fix formatting.
2025-01-27 12:32:23 +01:00
..
cli [Core] Add Chordal Hold, an "opposite hands rule" tap-hold option similar to Achordion, Bilateral Combinations. (#24560) 2025-01-27 12:32:23 +01:00
tests Allow codegen of keymap.json => keymap.c without requiring layers/layout etc. (#23451) 2024-11-24 20:32:30 +11:00
__init__.py QMK CLI and JSON keymap support (#6176) 2019-07-15 12:14:27 -07:00
build_targets.py Userspace: add support for adding environment variables during build (#22887) 2024-08-12 22:34:22 +10:00
c_parse.py Slightly refine g_led_config parsing (#21170) 2023-06-08 21:08:02 +01:00
commands.py Allow codegen of keymap.json => keymap.c without requiring layers/layout etc. (#23451) 2024-11-24 20:32:30 +11:00
comment_remover.py [CLI] Add a subcommand for getting information about a keyboard (#8666) 2020-05-26 13:05:41 -07:00
constants.py Added MCU support for ArteryTek AT32F415 (#23445) 2024-11-21 17:28:28 +11:00
converter.py Add cli convert subcommand, from raw KLE to JSON (#6898) 2019-11-12 20:55:41 -08:00
datetime.py Generate api data on each push (#10609) 2020-10-25 14:48:44 -07:00
decorators.py Handle cli._subcommand.__name__ deprecation warning (#24533) 2024-10-30 05:16:59 +00:00
docs.py Vitepress conversion of docs. (#23795) 2024-05-30 12:00:41 +10:00
errors.py CLI/c2json: Print 'cpp' error when executed in verbose mode (#12869) 2021-05-27 17:42:38 +01:00
flashers.py Ensure qmk flash rejects invalid files for uf2 compatible bootloaders (#24802) 2025-01-10 16:21:07 +00:00
git.py Resolve cli.log.warn warnings (#24551) 2024-12-15 15:00:18 +11:00
importers.py Fix 'qmk import-kbfirmware' WS2812 config (#23976) 2024-06-22 04:27:57 +01:00
info.py Fix g_led_config parse warning (#24769) 2025-01-01 01:58:41 +00:00
json_encoders.py QMK Userspace (#22222) 2023-11-28 07:53:43 +11:00
json_schema.py [CLI] Don't exit() when certain exceptions occur. (#23442) 2024-06-15 10:37:47 +01:00
keyboard.py Align 'qmk lint' argument handling (#23297) 2024-05-01 11:52:34 +10:00
keycodes.py Reallocate user/kb keycode ranges (#19907) 2023-02-23 09:50:09 +11:00
keymap.py Allow codegen of keymap.json => keymap.c without requiring layers/layout etc. (#23451) 2024-11-24 20:32:30 +11:00
makefile.py qmk find: usability improvements (#20440) 2023-05-20 22:14:43 +10:00
math.py [CLI] Add a subcommand for getting information about a keyboard (#8666) 2020-05-26 13:05:41 -07:00
painter.py [CLI] Refactor painter arguments to table instead of commandline (#24456) 2024-11-21 17:16:46 +11:00
painter_qff.py Quantum Painter (#10174) 2022-04-13 18:00:18 +10:00
painter_qgf.py [Feature] Some metadata on QGF/QFF files (#20101) 2024-03-10 00:29:09 +00:00
path.py Merge remote-tracking branch 'origin/master' into develop 2024-03-13 00:30:09 +00:00
search.py qmk find: expand operator support (#24468) 2024-11-21 22:57:36 +11:00
submodules.py Report submodule status when not valid work-tree (#19474) 2023-01-03 09:00:29 +11:00
userspace.py Userspace: add support for adding environment variables during build (#22887) 2024-08-12 22:34:22 +10:00
util.py Speed improvements to qmk find. (#24385) 2024-11-08 04:57:22 +00:00