qmk_firmware/lib/python/qmk/cli
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
..
chibios Ensure that safe_commands always run (#13199) 2021-06-14 16:51:58 -07:00
ci CLI parallel search updates (#22525) 2023-11-22 11:14:34 +11:00
doctor Resolve cli.log.warn warnings (#24551) 2024-12-15 15:00:18 +11:00
format Userspace: add support for adding environment variables during build (#22887) 2024-08-12 22:34:22 +10:00
generate [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
git Fix git-submodule running in wrong location (#23059) 2024-02-12 10:02:44 +00:00
import Resolve cli.log.warn warnings (#24551) 2024-12-15 15:00:18 +11:00
list Replace list_keyboards.sh with CLI calls (#19485) 2023-01-03 14:15:29 +11:00
new Change new-keymap keymap name prompt (#24701) 2024-12-11 12:28:30 -08:00
painter [CLI] Refactor painter arguments to table instead of commandline (#24456) 2024-11-21 17:16:46 +11:00
test Initial 'qmk test-c' functionality (#23038) 2024-03-05 16:59:30 +00:00
userspace Resolve cli.log.warn warnings (#24551) 2024-12-15 15:00:18 +11:00
__init__.py Bump minimum required Python version (#24554) 2024-10-31 23:21:20 +00:00
bux.py [Enhancement] Prepare for SyntaxWarning (#22562) 2024-02-16 14:34:43 +00:00
c2json.py Improve argument handling of c2json (#22170) 2023-11-01 22:37:05 +00:00
cd.py CLI: Fix 'cd' subcommand on Windows (#16610) 2022-03-10 21:33:41 +00:00
clean.py CLI refactoring for common build target APIs (#22221) 2023-11-15 16:24:54 +11:00
compile.py Fix 'qmk compile' mass_compile execution (#23296) 2024-03-31 12:23:40 +01:00
docs.py Vitepress conversion of docs. (#23795) 2024-05-30 12:00:41 +10:00
find.py Speed improvements to qmk find. (#24385) 2024-11-08 04:57:22 +00:00
flash.py [Bugfix] qmk {compile, flash} return code (#22639) 2023-12-14 09:19:49 +11:00
hello.py CLI: Add development mode support 2020-04-08 09:31:14 -07:00
info.py Add *_MATRIX_LED_COUNT generation (#21110) 2023-08-27 04:00:14 +01:00
json2c.py Update json2c to use dump_lines (#21013) 2023-05-22 07:03:59 +01:00
kle2json.py Remove references to info.json width and height in CLI (#13728) 2021-07-29 22:37:18 -07:00
license_check.py Fix up license check path. (#23571) 2024-04-23 19:38:47 +10:00
lint.py Reject via keymaps in lint (#24325) 2024-08-26 03:56:03 +01:00
mass_compile.py Speed improvements to qmk find. (#24385) 2024-11-08 04:57:22 +00:00
migrate.py Prevent qmk migrate processing unparsed info.json values (#22374) 2024-01-09 20:59:36 +11:00
pytest.py Add support for encoder mapping. (#13286) 2022-03-09 19:29:00 +11:00
via2json.py Update via2json layout macro searching (#24640) 2025-01-20 03:45:47 +00:00