From 4f4e8fcadc0c5b8c4e533675267b6405afa70108 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Wed, 20 Nov 2024 23:50:22 +0100 Subject: [PATCH] fix shift-control-t deduplicate the chordal functions --- common/keymap.h | 18 ++++++++++++++++++ .../crkbd/keymaps/christoph-cullmann/keymap.c | 7 ------- .../ferris/keymaps/christoph-cullmann/keymap.c | 7 ------- .../planck/keymaps/christoph-cullmann/keymap.c | 7 ------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/common/keymap.h b/common/keymap.h index c9f11e3..42e5380 100644 --- a/common/keymap.h +++ b/common/keymap.h @@ -89,6 +89,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; +char chordal_hold_handedness(keypos_t key) +{ + // special handle thumb keys + if (key.row == 3 || key.row == 7) return '*'; + return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; +} + +bool get_chordal_hold(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, + uint16_t other_keycode, keyrecord_t* other_record) { + // Allow hold between any pair of mod-tap keys. + if (IS_QK_MOD_TAP(tap_hold_keycode) && IS_QK_MOD_TAP(other_keycode)) { + return true; + } + + // Otherwise defer to the opposite hands rule. + return get_chordal_hold_default(tap_hold_record, other_record); +} + #ifndef NO_LED void keyboard_post_init_user(void) { diff --git a/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c b/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c index 1f19ccc..20a6ec8 100644 --- a/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c @@ -5,13 +5,6 @@ #include QMK_KEYBOARD_H -char chordal_hold_handedness(keypos_t key) -{ - // special handle thumb keys - if (key.row == 3 || key.row == 7) return '*'; - return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; -} - // layout helper macro, we just use 42 keys #undef LAYOUT #define LAYOUT(\ diff --git a/keyboards/ferris/keymaps/christoph-cullmann/keymap.c b/keyboards/ferris/keymaps/christoph-cullmann/keymap.c index d4b8c75..daa693b 100644 --- a/keyboards/ferris/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/ferris/keymaps/christoph-cullmann/keymap.c @@ -5,13 +5,6 @@ #include QMK_KEYBOARD_H -char chordal_hold_handedness(keypos_t key) -{ - // special handle thumb keys - if (key.row == 3 || key.row == 7) return '*'; - return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; -} - // layout helper macro, we just use 42 keys #undef LAYOUT #define LAYOUT(\ diff --git a/keyboards/planck/keymaps/christoph-cullmann/keymap.c b/keyboards/planck/keymaps/christoph-cullmann/keymap.c index d64381e..0121714 100644 --- a/keyboards/planck/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/planck/keymaps/christoph-cullmann/keymap.c @@ -5,13 +5,6 @@ #include QMK_KEYBOARD_H -char chordal_hold_handedness(keypos_t key) -{ - // special handle thumb keys - if (key.row == 3 || key.row == 7) return '*'; - return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; -} - // layout helper macro, we just use 42 keys #undef LAYOUT #define LAYOUT(\