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 /keyboards/preonic/keymaps/pcurt854 | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/preonic/keymaps/pcurt854')
-rw-r--r-- | keyboards/preonic/keymaps/pcurt854/keymap.c | 193 |
1 files changed, 93 insertions, 100 deletions
diff --git a/keyboards/preonic/keymaps/pcurt854/keymap.c b/keyboards/preonic/keymaps/pcurt854/keymap.c index 15e31df0a6..af88b10f3b 100644 --- a/keyboards/preonic/keymaps/pcurt854/keymap.c +++ b/keyboards/preonic/keymaps/pcurt854/keymap.c @@ -362,120 +362,113 @@ float leader_succeed_song[][2] = SONG(STARTUP_SOUND); //float leader_fail_song[][2] = SONG(GOODBYE_SOUND); float leader_fail_song[][2] = SONG(NO_SOUND); #endif -LEADER_EXTERNS(); -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - did_leader_succeed = leading = false; - - // tap dance - // sort by first key +void leader_start_user(void) { +#ifdef AUDIO_ENABLE + PLAY_SONG(leader_start_song); +#endif +} - SEQ_ONE_KEY(KC_C) { - SEND_STRING(SS_TAP(X_CAPS)); - did_leader_succeed = true; - } +void leader_end_user(void) { + did_leader_succeed = false; - SEQ_ONE_KEY(KC_BSPC) { - SEND_STRING(SS_TAP(X_DEL)); - did_leader_succeed = true; - } + // tap dance + // sort by first key - SEQ_ONE_KEY(KC_D) { - SEND_STRING("{}"SS_TAP(X_LEFT)); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_D, KC_B) { - SEND_STRING("Dear Brother"); - did_leader_succeed = true; - } - SEQ_THREE_KEYS(KC_D, KC_B, KC_S) { - SEND_STRING("Dear Brothers and Sister"); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_D, KC_D) { - SEND_STRING("{"); - did_leader_succeed = true; - } - SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { - SEND_STRING("}"); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_D, KC_S) { - SEND_STRING("Dear Sister"); - did_leader_succeed = true; - } + if (leader_sequence_one_key(KC_C)) { + SEND_STRING(SS_TAP(X_CAPS)); + did_leader_succeed = true; + } - // Html Tags - SEQ_TWO_KEYS(KC_H, KC_T) { - SEND_STRING("<></>"SS_TAP(X_LEFT)); - did_leader_succeed = true; - } + if (leader_sequence_one_key(KC_BSPC)) { + SEND_STRING(SS_TAP(X_DEL)); + did_leader_succeed = true; + } - SEQ_TWO_KEYS(KC_I, KC_C) { - SEND_STRING("In Christ,"); - did_leader_succeed = true; - } + if (leader_sequence_one_key(KC_D)) { + SEND_STRING("{}"SS_TAP(X_LEFT)); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_D, KC_B)) { + SEND_STRING("Dear Brother"); + did_leader_succeed = true; + } + if (leader_sequence_three_keys(KC_D, KC_B, KC_S)) { + SEND_STRING("Dear Brothers and Sister"); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_D, KC_D)) { + SEND_STRING("{"); + did_leader_succeed = true; + } + if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) { + SEND_STRING("}"); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_D, KC_S)) { + SEND_STRING("Dear Sister"); + did_leader_succeed = true; + } - SEQ_ONE_KEY(KC_J) { - SEND_STRING("<>"SS_TAP(X_LEFT)); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_J, KC_J) { - SEND_STRING("<"); - did_leader_succeed = true; - } - SEQ_THREE_KEYS(KC_J, KC_J, KC_J) { - SEND_STRING(">"); - did_leader_succeed = true; - } + // Html Tags + if (leader_sequence_two_keys(KC_H, KC_T)) { + SEND_STRING("<></>"SS_TAP(X_LEFT)); + did_leader_succeed = true; + } - SEQ_TWO_KEYS(KC_T, KC_S) { - SEND_STRING("Thanks!"); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_T, KC_Y) { - SEND_STRING("Thank you!"); - did_leader_succeed = true; - } + if (leader_sequence_two_keys(KC_I, KC_C)) { + SEND_STRING("In Christ,"); + did_leader_succeed = true; + } - SEQ_ONE_KEY(KC_X) { - SEND_STRING("()"SS_TAP(X_LEFT)); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_X, KC_X) { - SEND_STRING("("); - did_leader_succeed = true; - } - SEQ_THREE_KEYS(KC_X, KC_X, KC_X) { - SEND_STRING(")"); - did_leader_succeed = true; - } + if (leader_sequence_one_key(KC_J)) { + SEND_STRING("<>"SS_TAP(X_LEFT)); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_J, KC_J)) { + SEND_STRING("<"); + did_leader_succeed = true; + } + if (leader_sequence_three_keys(KC_J, KC_J, KC_J)) { + SEND_STRING(">"); + did_leader_succeed = true; + } - SEQ_ONE_KEY(KC_Z) { - SEND_STRING("[]"SS_TAP(X_LEFT)); - did_leader_succeed = true; - } - SEQ_TWO_KEYS(KC_Z, KC_Z) { - SEND_STRING("["); - did_leader_succeed = true; - } - SEQ_THREE_KEYS(KC_Z, KC_Z, KC_Z) { - SEND_STRING("]"); - did_leader_succeed = true; - } + if (leader_sequence_two_keys(KC_T, KC_S)) { + SEND_STRING("Thanks!"); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_T, KC_Y)) { + SEND_STRING("Thank you!"); + did_leader_succeed = true; + } - leader_end(); + if (leader_sequence_one_key(KC_X)) { + SEND_STRING("()"SS_TAP(X_LEFT)); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_X, KC_X)) { + SEND_STRING("("); + did_leader_succeed = true; + } + if (leader_sequence_three_keys(KC_X, KC_X, KC_X)) { + SEND_STRING(")"); + did_leader_succeed = true; } -} -void leader_start_user(void) { -#ifdef AUDIO_ENABLE - PLAY_SONG(leader_start_song); -#endif -} + if (leader_sequence_one_key(KC_Z)) { + SEND_STRING("[]"SS_TAP(X_LEFT)); + did_leader_succeed = true; + } + if (leader_sequence_two_keys(KC_Z, KC_Z)) { + SEND_STRING("["); + did_leader_succeed = true; + } + if (leader_sequence_three_keys(KC_Z, KC_Z, KC_Z)) { + SEND_STRING("]"); + did_leader_succeed = true; + } -void leader_end_user(void) { if (did_leader_succeed) { #ifdef AUDIO_ENABLE PLAY_SONG(leader_succeed_song); |