Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

sunaku
Copy link

@sunaku sunaku commented Oct 16, 2022

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. 👉 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. ☝️ 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 36d123e) 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.

This fixes a glitch in Miryoku's bilateral-combinations implementation
where the GUI modifiers in a mod-tap key combination are always sent to
the computer alongside the combination, interrupting the user's typing.

For example, suppose you held LGUI_T(KC_A) and then pressed KC_R with
the same hand (assuming your left hand on the standard QWERTY layout).

Before this patch, the combination sends KC_LGUI to the computer when
LGUI_T(KC_A) is held, followed by KC_A and KC_R when finally released.
This inadvertently triggers whatever action is associated with KC_LGUI
on the computer, such as opening the "Start Menu" in Microsoft Windows.

With this patch applied, the combination doesn't send KC_LGUI to the
computer when LGUI_T(KC_A) is held.  Instead, it applies the KC_LGUI
modifier *internally* for bilateral_combinations_hold() and therefore
only sends out KC_A and KC_R to the computer as the user would expect.

However, note that non-GUI modifiers such as Shift/Ctrl/Alt are still
sent to the computer for unilateral mod-tap combinations to allow for
modified mouse clicks such as Shift-click, Ctrl-click, Alt-click, etc.
@sunaku sunaku changed the title Crossover bilateral combinations for dual-handed chords and rolls Crossover bilateral combinations for dual-hand chords and rolls Oct 16, 2022
@sunaku sunaku force-pushed the bilateral-combinations-crossover branch 2 times, most recently from e07f3bc to 7f7204b Compare October 17, 2022 22:43
Super+Period was triggering Start Menu afterwards, like a "flash mod".
@sunaku
Copy link
Author

sunaku commented Oct 28, 2022

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 sunaku force-pushed the bilateral-combinations-crossover branch from f2ee6b1 to ab8d095 Compare October 28, 2022 19:09
@sunaku
Copy link
Author

sunaku commented Oct 30, 2022

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
Copy link
Author

sunaku commented Nov 19, 2022

Superseded by PR #56.

@sunaku sunaku closed this Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant