diff options
author | Ryan <fauxpark@gmail.com> | 2023-02-13 03:19:02 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 03:19:02 +1100 |
commit | bbf7a20b33de2d203518687cb5cd1aa85005ea27 (patch) | |
tree | ee1a5c412a02021d085c81a26321c3424eca7022 /users/jjerrell | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users/jjerrell')
-rw-r--r-- | users/jjerrell/jjerrell.c | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/users/jjerrell/jjerrell.c b/users/jjerrell/jjerrell.c index 95c2acba5e..47aa9bc042 100644 --- a/users/jjerrell/jjerrell.c +++ b/users/jjerrell/jjerrell.c @@ -23,41 +23,36 @@ __attribute__((weak)) void matrix_scan_keymap(void) {} __attribute__((weak)) void leader_scan_secrets(void) {} #ifdef LEADER_ENABLE - LEADER_EXTERNS(); - void matrix_scan_leader(void) { - static uint8_t mods = 0; - mods = get_mods(); - LEADER_DICTIONARY() { - leading = false; - leader_end(); - clear_mods(); - - // Website Refresh / XCode "Run" - SEQ_ONE_KEY(KC_R) { - SEND_STRING(SS_LGUI("r")); - } - - SEQ_TWO_KEYS(KC_B, KC_D) { - send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY); - } - - SEQ_TWO_KEYS(KC_L, KC_C) { - send_string_with_delay("/** */", TAP_CODE_DELAY); - wait_ms(TAPPING_TERM); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - tap_code(KC_LEFT); - if (!(mods & MOD_MASK_SHIFT)) { - tap_code(KC_ENT); - } - } - - set_mods(mods); - #ifndef NO_SECRETS - leader_scan_secrets(); - #endif // !NO_SECRETS +void leader_end_user(void) { + static uint8_t mods = 0; + mods = get_mods(); + clear_mods(); + + // Website Refresh / XCode "Run" + if (leader_sequence_one_key(KC_R)) { + SEND_STRING(SS_LGUI("r")); + } + + if (leader_sequence_two_keys(KC_B, KC_D)) { + send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE), TAP_CODE_DELAY); + } + + if (leader_sequence_two_keys(KC_L, KC_C)) { + send_string_with_delay("/** */", TAP_CODE_DELAY); + wait_ms(TAPPING_TERM); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + tap_code(KC_LEFT); + if (!(mods & MOD_MASK_SHIFT)) { + tap_code(KC_ENT); } } + + set_mods(mods); + #ifndef NO_SECRETS + leader_scan_secrets(); + #endif // !NO_SECRETS +} #endif static bool is_first_run = true; @@ -66,9 +61,7 @@ void matrix_scan_user(void) { is_first_run = false; startup_user(); } - #ifdef LEADER_ENABLE - matrix_scan_leader(); - #endif + matrix_scan_keymap(); } |