summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2022-10-18 00:12:56 +0200
committerChristoph Cullmann <cullmann@kde.org>2022-10-18 00:12:56 +0200
commitce0e0ac4cc956bc46cd4a6dd222bf13b9cab74df (patch)
tree4f9a627569a7993f5d05f9de80645651eeb8799f
parent3daf72408591e03d103ea4d74c64c34774201739 (diff)
fix for irregular planck matrix
-rw-r--r--keymap.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/keymap.c b/keymap.c
index 5e1b7b3..6df6fe8 100644
--- a/keymap.c
+++ b/keymap.c
@@ -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);
}
//