diff options
Diffstat (limited to 'keyboards/orbekk_dactyl/keymaps/default/keymap.c')
-rw-r--r-- | keyboards/orbekk_dactyl/keymaps/default/keymap.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/keyboards/orbekk_dactyl/keymaps/default/keymap.c b/keyboards/orbekk_dactyl/keymaps/default/keymap.c index 7d81033352..d4cfdc5e42 100644 --- a/keyboards/orbekk_dactyl/keymaps/default/keymap.c +++ b/keyboards/orbekk_dactyl/keymaps/default/keymap.c @@ -1,6 +1,7 @@ #include QMK_KEYBOARD_H #include "layout.h" #include "features/custom_shift_keys.h" +#include "features/achordion.h" // Based on: // https://github.com/getreuer/qmk-keymap/blob/main/keymap.c @@ -26,9 +27,14 @@ enum layers { #define HR_3(kc) LCTL_T(kc) #define HR_4(kc) LSFT_T(kc) +const uint16_t PROGMEM combo_z[] = {KC_X, KC_M, COMBO_END}; +combo_t key_combos[] = { + COMBO(combo_z, KC_Z), +}; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [GR] = LAYOUT_LR( - KC_B, KC_L, KC_D, KC_W, KC_Z, + KC_B, KC_L, KC_D, KC_W, KC_COMMA, HL_1(KC_N), HL_2(KC_R), HL_3(KC_T), HL_4(KC_S), KC_G, KC_Q, KC_X, KC_M, KC_C, KC_V, TL_LOWR, LT(NAV, KC_SPC), @@ -142,11 +148,14 @@ const custom_shift_key_t custom_shift_keys[] = { {KC_SLASH, KC_LT}, {KC_MINS, KC_DOUBLE_QUOTE}, {KC_QUOTE, KC_UNDERSCORE}, + {KC_COMMA, KC_QUESTION}, }; uint8_t NUM_CUSTOM_SHIFT_KEYS = sizeof(custom_shift_keys) / sizeof(custom_shift_key_t); bool process_record_user(uint16_t keycode, keyrecord_t* record) { + if (!process_achordion(keycode, record)) { return false; } + if (layer_state_cmp(default_layer_state, GR) && !process_custom_shift_keys(keycode, record)) { return false; @@ -154,3 +163,37 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { return true; } + +void matrix_scan_user(void) { + achordion_task(); +} + +bool achordion_chord(uint16_t tap_hold_keycode, + keyrecord_t* tap_hold_record, + uint16_t other_keycode, + keyrecord_t* other_record) { + // Also allow same-hand holds when the other key is in the rows below the + // alphas. I need the `% (MATRIX_ROWS / 2)` because my keyboard is split. + if (other_record->event.key.row % (MATRIX_ROWS / 2) >= 2) { return true; } + if (tap_hold_record->event.key.row % (MATRIX_ROWS / 2) >= 2) { return true; } + + // Otherwise, follow the opposite hands rule. + return achordion_opposite_hands(tap_hold_record, other_record); +} + +bool achordion_eager_mod(uint8_t mod) { + switch (mod) { + case MOD_LSFT: + case MOD_RSFT: + case MOD_LCTL: + case MOD_RCTL: + case MOD_LALT: + case MOD_RALT: + case MOD_LGUI: + case MOD_RGUI: + return true; // Eagerly apply mods. + + default: + return false; + } +} |