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/yhaliaw | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/preonic/keymaps/yhaliaw')
-rw-r--r-- | keyboards/preonic/keymaps/yhaliaw/keymap.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/keyboards/preonic/keymaps/yhaliaw/keymap.c b/keyboards/preonic/keymaps/yhaliaw/keymap.c index b64aa7d745..7771199e9c 100644 --- a/keyboards/preonic/keymaps/yhaliaw/keymap.c +++ b/keyboards/preonic/keymaps/yhaliaw/keymap.c @@ -168,36 +168,24 @@ void keyboard_post_init_user(void) { } bool leader_found; -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_found = false; - SEQ_ONE_KEY(L_RESET) { - leader_found = true; - reset_keyboard(); - } - else - SEQ_ONE_KEY(KC_DEL) { - leader_found = true; - layer_clear(); - } - else - SEQ_ONE_KEY(LOWER) { - leader_found = true; - layer_on(_LOWER); - } - else - SEQ_ONE_KEY(RAISE) { - leader_found = true; - layer_on(_RAISE); - } - leader_end(); - } -} void leader_end_user(void) { + leader_found = false; + + if (leader_sequence_one_key(L_RESET)) { + leader_found = true; + reset_keyboard(); + } else if (leader_sequence_one_key(KC_DEL)) { + leader_found = true; + layer_clear(); + } else if (leader_sequence_one_key(LOWER)) { + leader_found = true; + layer_on(_LOWER); + } else if (leader_sequence_one_key(RAISE)) { + leader_found = true; + layer_on(_RAISE); + } + // Plays sound on if leader sequence found. if (leader_found) { #ifdef AUDIO_ENABLE |