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/massdrop | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/massdrop')
-rw-r--r-- | keyboards/massdrop/alt/keymaps/jdelkins/keymap.c | 100 |
1 files changed, 48 insertions, 52 deletions
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c index 4c9a8860f4..64a9f6f598 100644 --- a/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c +++ b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c @@ -256,6 +256,54 @@ static void set_rgb_layer(int layer) { } } +void leader_end_user(void) { + if (leader_sequence_one_key(KC_K)) { + layer_invert(_KP); + } + if (leader_sequence_one_key(KC_G)) { + layer_invert(_GAME); + } + if (leader_sequence_one_key(KC_KP_5)) { + layer_invert(_KP); + } + if (leader_sequence_two_keys(KC_SCLN, KC_1)) { + send_secret_string(0); + } + if (leader_sequence_two_keys(KC_SCLN, KC_2)) { + send_secret_string(1); + } + if (leader_sequence_two_keys(KC_SCLN, KC_3)) { + send_secret_string(2); + } + if (leader_sequence_two_keys(KC_SCLN, KC_4)) { + send_secret_string(3); + } + if (leader_sequence_two_keys(KC_SCLN, KC_5)) { + send_secret_string(4); + } + if (leader_sequence_two_keys(KC_SCLN, KC_6)) { + send_secret_string(5); + } + if (leader_sequence_two_keys(KC_SCLN, KC_M)) { + send_secret_string(0); + } + if (leader_sequence_two_keys(KC_SCLN, KC_COMM)) { + send_secret_string(1); + } + if (leader_sequence_two_keys(KC_SCLN, KC_DOT)) { + send_secret_string(2); + } + if (leader_sequence_two_keys(KC_SCLN, KC_J)) { + send_secret_string(3); + } + if (leader_sequence_two_keys(KC_SCLN, KC_K)) { + send_secret_string(4); + } + if (leader_sequence_two_keys(KC_SCLN, KC_L)) { + send_secret_string(5); + } +} + // Runs just one time when the keyboard initializes. void matrix_init_keymap(void) { // force numlock on upon startup @@ -264,8 +312,6 @@ void matrix_init_keymap(void) { } }; -LEADER_EXTERNS(); - // Runs constantly in the background, in a loop. void matrix_scan_keymap(void) { if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) { @@ -282,56 +328,6 @@ void matrix_scan_keymap(void) { else rgb_matrix_set_color(15, 0, 0, 0); } - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_K) { - layer_invert(_KP); - } - SEQ_ONE_KEY(KC_G) { - layer_invert(_GAME); - } - SEQ_ONE_KEY(KC_KP_5) { - layer_invert(_KP); - } - SEQ_TWO_KEYS(KC_SCLN, KC_1) { - send_secret_string(0); - } - SEQ_TWO_KEYS(KC_SCLN, KC_2) { - send_secret_string(1); - } - SEQ_TWO_KEYS(KC_SCLN, KC_3) { - send_secret_string(2); - } - SEQ_TWO_KEYS(KC_SCLN, KC_4) { - send_secret_string(3); - } - SEQ_TWO_KEYS(KC_SCLN, KC_5) { - send_secret_string(4); - } - SEQ_TWO_KEYS(KC_SCLN, KC_6) { - send_secret_string(5); - } - SEQ_TWO_KEYS(KC_SCLN, KC_M) { - send_secret_string(0); - } - SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { - send_secret_string(1); - } - SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { - send_secret_string(2); - } - SEQ_TWO_KEYS(KC_SCLN, KC_J) { - send_secret_string(3); - } - SEQ_TWO_KEYS(KC_SCLN, KC_K) { - send_secret_string(4); - } - SEQ_TWO_KEYS(KC_SCLN, KC_L) { - send_secret_string(5); - } - } }; layer_state_t layer_state_set_keymap(layer_state_t state) { |