manna-harbour / qmk_firmware

See the "forkreadme" branch or the following link for a description of branches maintained in this fork.
https://github.com/manna-harbour/qmk_firmware/blob/forkreadme/readme.org
GNU General Public License v2.0
281 stars 64 forks source link

Crossover bilateral combinations for dual-hand chords and rolls #54

Closed sunaku closed 1 year ago

sunaku commented 2 years ago

Thanks to the increased typing speed made possible by PR #48, I discovered a blind spot in the bilateral combinations concept and patched it in a new optional feature called "crossover" bilateral combinations (implemented in this PR) to catch fast "rolls" that cross the left/right keyboard boundary. For example, imagine that you had Miryoku-style home row mods on the standard QWERTY layout so that typing the word "jam" involves the RSFT_T(KC_J) and LGUI_T(KC_A) keys. :point_right: Regular bilateral combinations would ignore this combination since the keys are located on different sides of the keyboard, thereby sending RSFT(KC_A) to the computer. :point_up: In contrast, crossover bilateral combinations catch this combination (if you're quick enough, according to a configurable timeout) and send KC_J and KC_A to the computer, thus avoiding accidental mods.

To enable crossover bilateral combinations (which start on one side of the keyboard and cross over to the other side, such as RSFT_T(KC_J) and LGUI_T(KC_A) in the word "jam"), add the following line to your config.h and define a value: hold times greater than that value will permit crossover bilateral combinations. For example, if you typed RSFT_T(KC_J) and LGUI_T(KC_A) faster than the defined value, the keys KC_J and KC_A would be sent to the computer. In contrast, if you typed slower than the defined value, the keys RSFT(KC_A) would be sent to the computer.

#define BILATERAL_COMBINATIONS_CROSSOVER 75

Here is the relevant portion of my config.h file which activates both patches to provide the best typing experience I've felt since switching to Miryoku's home row mods ~2 years ago, as detailed in Taming home row mods with Bilateral Combinations:

/* QMK */
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT

/* Miryoku */
#define BILATERAL_COMBINATIONS
#define BILATERAL_COMBINATIONS_CROSSOVER 75
#define BILATERAL_COMBINATIONS_DEFERMODS 100

You also need to add the following line to your rules.mk file to enable QMK's deferred execution facility, used by DeferMods:

DEFERRED_EXEC_ENABLE = yes

Note: QMK's deferred execution feature was introduced 1 year later (on 16 November 2021 in commit 36d123e9c5a9ce0e29b9bc22ef87661bf479e299) after the latest in Miryoku's bilateral-combinations branch! So in order to try out my latest changes, you'll need to update this branch to a more recent version of mainline QMK. I've already done this (resolving merge conflicts) in a separate branch based on 0.18.6, so simply check out that branch and configure your config.h and rules.mk files (as I've documented previously) to try it out.

sunaku commented 2 years ago

I've replaced the BILATERAL_COMBINATIONS_FLASHMODS mask with a BILATERAL_COMBINATIONS_DEFERMODS timeout for PR #48:

-#define BILATERAL_COMBINATIONS_FLASHMODS MOD_MASK_GUI
+#define BILATERAL_COMBINATIONS_DEFERMODS 100
sunaku commented 2 years ago

For your testing convenience, I've created a modernized version of this PR that is updated to a recent QMK mainline (0.18.6).

sunaku commented 1 year ago

Superseded by PR #56.