diff options
author | Christoph Cullmann <cullmann@kde.org> | 2022-10-18 00:12:56 +0200 |
---|---|---|
committer | Christoph Cullmann <cullmann@kde.org> | 2022-10-18 00:12:56 +0200 |
commit | ce0e0ac4cc956bc46cd4a6dd222bf13b9cab74df (patch) | |
tree | 4f9a627569a7993f5d05f9de80645651eeb8799f /keymap.c | |
parent | 3daf72408591e03d103ea4d74c64c34774201739 (diff) |
fix for irregular planck matrix
Diffstat (limited to 'keymap.c')
-rw-r--r-- | keymap.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -83,18 +83,33 @@ void matrix_scan_user(void) achordion_task(); } +static bool planck_bottom_row(keypos_t pos) +{ + return pos.row % (MATRIX_ROWS / 2) == 3; +} + +// works only for rows 0-2 or 4-6 +static bool planck_on_left_hand(keypos_t pos) +{ + // planck is like a split keyboard, beside for the last row + return pos.row < MATRIX_ROWS / 2; +} + bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, uint16_t other_keycode, keyrecord_t* other_record) { - // allow thumb key row to always work - if (other_record->event.key.row >= 3) { + // last row is special for the planck, just allow there everything + if (planck_bottom_row(tap_hold_record->event.key)) { + return true; + } + if (planck_bottom_row(other_record->event.key)) { return true; } - // Otherwise, follow the opposite hands rule. - return achordion_opposite_hands(tap_hold_record, other_record); + // now both keys are in rows 0-2 or 4-6, there we can check the left hand with the simple helper + return planck_on_left_hand(tap_hold_record->event.key) != planck_on_left_hand(other_record->event.key); } // |