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/splitkb/kyria/keymaps | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/splitkb/kyria/keymaps')
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c | 13 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c | 31 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/corodiak/keymap.c | 65 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/mattir/keymap.c | 23 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/mattir2/keymap.c | 19 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/plattfot/keymap.c | 142 | ||||
-rw-r--r-- | keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c | 94 |
7 files changed, 171 insertions, 216 deletions
diff --git a/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c b/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c index c98219a755..cb8eb1e1e7 100644 --- a/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/asapjockey/keymap.c @@ -171,16 +171,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_F) { // Shift + Ctrl + F - tap_code16(S(C(KC_F))); - } +void leader_end_user(void) { + if (leader_sequence_one_key(KC_F)) { // Shift + Ctrl + F + tap_code16(S(C(KC_F))); } } diff --git a/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c b/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c index a375c5cc4d..4a4bf91177 100644 --- a/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/cjuniet/keymap.c @@ -31,8 +31,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) }; -LEADER_EXTERNS(); - void keyboard_post_init_user(void) { led_t led_state = host_keyboard_led_state(); if (!led_state.num_lock) { @@ -44,25 +42,20 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _SYMBOLS, _NUMBERS, _SPECIALS); } -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - // Lock screen (macOS) - SEQ_ONE_KEY(KC_ESC) { - tap_code16(LCTL(LGUI(KC_Q))); - } +void leader_end_user(void) { + // Lock screen (macOS) + if (leader_sequence_one_key(KC_ESC)) { + tap_code16(LCTL(LGUI(KC_Q))); + } - // Escape-Shift-Z-Z (VIM) - SEQ_ONE_KEY(KC_Z) { - SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz")); - } + // Escape-Shift-Z-Z (VIM) + if (leader_sequence_one_key(KC_Z)) { + SEND_STRING(SS_TAP(X_ESC) SS_LSFT("zz")); + } - // Dead grave accent (macOS) - SEQ_ONE_KEY(KC_E) { - tap_code16(LALT(KC_GRAVE)); - } + // Dead grave accent (macOS) + if (leader_sequence_one_key(KC_E)) { + tap_code16(LALT(KC_GRAVE)); } } diff --git a/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c b/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c index 2a28d49752..c0ed9f133c 100644 --- a/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/corodiak/keymap.c @@ -274,48 +274,41 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; }; -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); +void leader_end_user(void) { + // Set current OS indicator to macOs + if (leader_sequence_one_key(KC_M)) { + user_config.osIsWindows = false; + eeconfig_update_user(user_config.raw); + } - // Set current OS indicator to macOs - SEQ_ONE_KEY(KC_M) { - user_config.osIsWindows = false; - eeconfig_update_user(user_config.raw); - } + // Set current OS indicator to Windows + if (leader_sequence_one_key(KC_W)) { + user_config.osIsWindows = true; + eeconfig_update_user(user_config.raw); + } - // Set current OS indicator to Windows - SEQ_ONE_KEY(KC_W) { - user_config.osIsWindows = true; - eeconfig_update_user(user_config.raw); - } - - // Screenshot - SEQ_ONE_KEY(KC_S) { - if (user_config.osIsWindows == 1) { - tap_code16(S(G(KC_S))); - } else if (user_config.osIsWindows == 0) { - tap_code16(S(G(KC_4))); - } + // Screenshot + if (leader_sequence_one_key(KC_S)) { + if (user_config.osIsWindows == 1) { + tap_code16(S(G(KC_S))); + } else if (user_config.osIsWindows == 0) { + tap_code16(S(G(KC_4))); } + } - // Video - SEQ_ONE_KEY(KC_V) { - if (user_config.osIsWindows == 0) { - tap_code16(S(G(KC_5))); - } + // Video + if (leader_sequence_one_key(KC_V)) { + if (user_config.osIsWindows == 0) { + tap_code16(S(G(KC_5))); } + } - // Sleep - SEQ_ONE_KEY(KC_P) { - if (user_config.osIsWindows == 1) { - SEND_STRING(SS_LGUI("x") "u" "h"); - } else if (user_config.osIsWindows == 0) { - tap_code16(A(G(KC_PWR))); - } + // Sleep + if (leader_sequence_one_key(KC_P)) { + if (user_config.osIsWindows == 1) { + SEND_STRING(SS_LGUI("x") "u" "h"); + } else if (user_config.osIsWindows == 0) { + tap_code16(A(G(KC_PWR))); } } } diff --git a/keyboards/splitkb/kyria/keymaps/mattir/keymap.c b/keyboards/splitkb/kyria/keymaps/mattir/keymap.c index 5f97c40765..5bc0b8215e 100644 --- a/keyboards/splitkb/kyria/keymaps/mattir/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/mattir/keymap.c @@ -56,11 +56,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; +void leader_end_user(void) { + if (leader_sequence_one_key(KC_A)) { + tap_code16(SGUI(KC_L)); + } + if (leader_sequence_two_keys(KC_S, KC_S)) { + tap_code16(SGUI(KC_5)); + } +} + bool is_cmd_tab_active = false; uint16_t cmd_tab_timer = 0; -LEADER_EXTERNS(); - void matrix_scan_user(void) { if (is_cmd_tab_active) { if (timer_elapsed(cmd_tab_timer) > 1000) { @@ -68,18 +75,6 @@ void matrix_scan_user(void) { is_cmd_tab_active = false; } } - - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_A) { - tap_code16(SGUI(KC_L)); - } - SEQ_TWO_KEYS(KC_S, KC_S) { - tap_code16(SGUI(KC_5)); - } - } } #ifdef OLED_ENABLE diff --git a/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c b/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c index 0d09bcce74..f42889da90 100644 --- a/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/mattir2/keymap.c @@ -49,18 +49,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_A) { - tap_code16(SGUI(KC_L)); - } - SEQ_TWO_KEYS(KC_S, KC_S) { - tap_code16(SGUI(KC_5)); - } +void leader_end_user(void) { + if (leader_sequence_one_key(KC_A)) { + tap_code16(SGUI(KC_L)); + } + if (leader_sequence_two_keys(KC_S, KC_S)) { + tap_code16(SGUI(KC_5)); } } diff --git a/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c b/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c index 1a351803a2..2233e9b01b 100644 --- a/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/plattfot/keymap.c @@ -400,82 +400,76 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } #endif -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - LEADER_DICTIONARY() { - leading = false; - leader_end(); - // Sway navigation - SEQ_ONE_KEY(KC_Q) { // Jump to workspace 1 - SEND_STRING(SS_LGUI("1")); - } - SEQ_ONE_KEY(KC_W) { // Jump to workspace 2 - SEND_STRING(SS_LGUI("2")); - } - SEQ_ONE_KEY(KC_E) { // Jump to workspace 3 - SEND_STRING(SS_LGUI("3")); - } - SEQ_ONE_KEY(KC_R) { // Jump to workspace 4 - SEND_STRING(SS_LGUI("4")); - } - SEQ_ONE_KEY(KC_T) { // Jump to workspace 5 - SEND_STRING(SS_LGUI("5")); - } +void leader_end_user(void) { + // Sway navigation + if (leader_sequence_one_key(KC_Q)) { // Jump to workspace 1 + SEND_STRING(SS_LGUI("1")); + } + if (leader_sequence_one_key(KC_W)) { // Jump to workspace 2 + SEND_STRING(SS_LGUI("2")); + } + if (leader_sequence_one_key(KC_E)) { // Jump to workspace 3 + SEND_STRING(SS_LGUI("3")); + } + if (leader_sequence_one_key(KC_R)) { // Jump to workspace 4 + SEND_STRING(SS_LGUI("4")); + } + if (leader_sequence_one_key(KC_T)) { // Jump to workspace 5 + SEND_STRING(SS_LGUI("5")); + } - SEQ_ONE_KEY(KC_Y) { // Jump to workspace 6 - SEND_STRING(SS_LGUI("6")); - } - SEQ_ONE_KEY(KC_U) { // Jump to workspace 7 - SEND_STRING(SS_LGUI("7")); - } - SEQ_ONE_KEY(KC_I) { // Jump to workspace 8 - SEND_STRING(SS_LGUI("8")); - } - SEQ_ONE_KEY(KC_O) { // Jump to workspace 9 - SEND_STRING(SS_LGUI("9")); - } - SEQ_ONE_KEY(KC_P) { // Jump to workspace 0 - SEND_STRING(SS_LGUI("0")); - } - SEQ_ONE_KEY(KC_G) { // View scratch pad - SEND_STRING(SS_LGUI("-")); - } + if (leader_sequence_one_key(KC_Y)) { // Jump to workspace 6 + SEND_STRING(SS_LGUI("6")); + } + if (leader_sequence_one_key(KC_U)) { // Jump to workspace 7 + SEND_STRING(SS_LGUI("7")); + } + if (leader_sequence_one_key(KC_I)) { // Jump to workspace 8 + SEND_STRING(SS_LGUI("8")); + } + if (leader_sequence_one_key(KC_O)) { // Jump to workspace 9 + SEND_STRING(SS_LGUI("9")); + } + if (leader_sequence_one_key(KC_P)) { // Jump to workspace 0 + SEND_STRING(SS_LGUI("0")); + } + if (leader_sequence_one_key(KC_G)) { // View scratch pad + SEND_STRING(SS_LGUI("-")); + } - // Sway move window - SEQ_TWO_KEYS(KC_M, KC_Q) { // Move to workspace 1 - SEND_STRING(SS_LSFT(SS_LGUI("1"))); - } - SEQ_TWO_KEYS(KC_M, KC_W) { // Move to workspace 2 - SEND_STRING(SS_LSFT(SS_LGUI("2"))); - } - SEQ_TWO_KEYS(KC_M, KC_E) { // Move to workspace 3 - SEND_STRING(SS_LSFT(SS_LGUI("3"))); - } - SEQ_TWO_KEYS(KC_M, KC_R) { // Move to workspace 4 - SEND_STRING(SS_LSFT(SS_LGUI("4"))); - } - SEQ_TWO_KEYS(KC_M, KC_T) { // Move to workspace 5 - SEND_STRING(SS_LSFT(SS_LGUI("5"))); - } + // Sway move window + if (leader_sequence_two_keys(KC_M, KC_Q)) { // Move to workspace 1 + SEND_STRING(SS_LSFT(SS_LGUI("1"))); + } + if (leader_sequence_two_keys(KC_M, KC_W)) { // Move to workspace 2 + SEND_STRING(SS_LSFT(SS_LGUI("2"))); + } + if (leader_sequence_two_keys(KC_M, KC_E)) { // Move to workspace 3 + SEND_STRING(SS_LSFT(SS_LGUI("3"))); + } + if (leader_sequence_two_keys(KC_M, KC_R)) { // Move to workspace 4 + SEND_STRING(SS_LSFT(SS_LGUI("4"))); + } + if (leader_sequence_two_keys(KC_M, KC_T)) { // Move to workspace 5 + SEND_STRING(SS_LSFT(SS_LGUI("5"))); + } - SEQ_TWO_KEYS(KC_M, KC_Y) { // Move to workspace 6 - SEND_STRING(SS_LSFT(SS_LGUI("6"))); - } - SEQ_TWO_KEYS(KC_M, KC_U) { // Move to workspace 7 - SEND_STRING(SS_LSFT(SS_LGUI("7"))); - } - SEQ_TWO_KEYS(KC_M, KC_I) { // Move to workspace 8 - SEND_STRING(SS_LSFT(SS_LGUI("8"))); - } - SEQ_TWO_KEYS(KC_M, KC_O) { // Move to workspace 9 - SEND_STRING(SS_LSFT(SS_LGUI("9"))); - } - SEQ_TWO_KEYS(KC_M, KC_P) { // Move to workspace 0 - SEND_STRING(SS_LSFT(SS_LGUI("0"))); - } - SEQ_TWO_KEYS(KC_M, KC_G) { // Move to scratch pad - SEND_STRING(SS_LSFT(SS_LGUI("-"))); - } + if (leader_sequence_two_keys(KC_M, KC_Y)) { // Move to workspace 6 + SEND_STRING(SS_LSFT(SS_LGUI("6"))); + } + if (leader_sequence_two_keys(KC_M, KC_U)) { // Move to workspace 7 + SEND_STRING(SS_LSFT(SS_LGUI("7"))); + } + if (leader_sequence_two_keys(KC_M, KC_I)) { // Move to workspace 8 + SEND_STRING(SS_LSFT(SS_LGUI("8"))); + } + if (leader_sequence_two_keys(KC_M, KC_O)) { // Move to workspace 9 + SEND_STRING(SS_LSFT(SS_LGUI("9"))); + } + if (leader_sequence_two_keys(KC_M, KC_P)) { // Move to workspace 0 + SEND_STRING(SS_LSFT(SS_LGUI("0"))); + } + if (leader_sequence_two_keys(KC_M, KC_G)) { // Move to scratch pad + SEND_STRING(SS_LSFT(SS_LGUI("-"))); } } diff --git a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c index 420d9a89af..3ed7dbee6e 100644 --- a/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c +++ b/keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c @@ -173,12 +173,54 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } +void leader_end_user(void) { + if (leader_sequence_one_key(KC_C)) { // Inline Code + SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); + } + if (leader_sequence_one_key(KC_P)) { // Invoke Password Manager + SEND_STRING(SS_LCTL(SS_LALT("\\"))); + } + if (leader_sequence_one_key(KC_S)) { // Windows screenshot + SEND_STRING(SS_LGUI("\nS")); + } + if (leader_sequence_two_keys(KC_F, KC_P)) { // Fusion Projection prefix + SEND_STRING("[Projection] "); + } + if (leader_sequence_two_keys(KC_B, KC_B)) { // Basecone invoice description + SEND_STRING("[Leveranciersnaam] [Factuurnummer]"); + } + if (leader_sequence_two_keys(KC_E, KC_S)) { // Support email splitkb + SEND_STRING("support@splitkb.com"); + } + if (leader_sequence_two_keys(KC_E, KC_T)) { // Email splitkb + SEND_STRING("thomas@splitkb.com"); + } + if (leader_sequence_two_keys(KC_E, KC_P)) { // Email personal + SEND_STRING("mail@thomasbaart.nl"); + } + if (leader_sequence_two_keys(KC_S, KC_D)) { // Splitkb documentation + SEND_STRING("https://docs.splitkb.com/"); + } + if (leader_sequence_two_keys(KC_S, KC_V)) { // Splitkb VAT number + SEND_STRING("NL210593349B01"); + } + if (leader_sequence_two_keys(KC_B, KC_C)) { // Discord bongocat + SEND_STRING(":bongocat:\n"); + } + if (leader_sequence_two_keys(KC_C, KC_B)) { // Discord code block + SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP)); + } + if (leader_sequence_two_keys(KC_Y, KC_S)) { // Greeting + SEND_STRING("Yours sincerely,\n\nThomas Baart"); + } + if (leader_sequence_three_keys(KC_M, KC_V, KC_G)) { // Greeting + SEND_STRING("Met vriendelijke groet,\n\nThomas Baart"); + } +} bool is_alt_tab_active = false; uint16_t alt_tab_timer = 0; -LEADER_EXTERNS(); - void matrix_scan_user(void) { if (is_alt_tab_active) { if (timer_elapsed(alt_tab_timer) > 1000) { @@ -186,54 +228,6 @@ void matrix_scan_user(void) { is_alt_tab_active = false; } } - - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_C) { // Inline Code - SEND_STRING("`` " SS_TAP(X_LEFT) SS_TAP(X_LEFT)); - } - SEQ_ONE_KEY(KC_P) { // Invoke Password Manager - SEND_STRING(SS_LCTL(SS_LALT("\\"))); - } - SEQ_ONE_KEY(KC_S) { // Windows screenshot - SEND_STRING(SS_LGUI("\nS")); - } - SEQ_TWO_KEYS(KC_F, KC_P) { // Fusion Projection prefix - SEND_STRING("[Projection] "); - } - SEQ_TWO_KEYS(KC_B, KC_B) { // Basecone invoice description - SEND_STRING("[Leveranciersnaam] [Factuurnummer]"); - } - SEQ_TWO_KEYS(KC_E, KC_S) { // Support email splitkb - SEND_STRING("support@splitkb.com"); - } - SEQ_TWO_KEYS(KC_E, KC_T) { // Email splitkb - SEND_STRING("thomas@splitkb.com"); - } - SEQ_TWO_KEYS(KC_E, KC_P) { // Email personal - SEND_STRING("mail@thomasbaart.nl"); - } - SEQ_TWO_KEYS(KC_S, KC_D) { // Splitkb documentation - SEND_STRING("https://docs.splitkb.com/"); - } - SEQ_TWO_KEYS(KC_S, KC_V) { // Splitkb VAT number - SEND_STRING("NL210593349B01"); - } - SEQ_TWO_KEYS(KC_B, KC_C) { // Discord bongocat - SEND_STRING(":bongocat:\n"); - } - SEQ_TWO_KEYS(KC_C, KC_B) { // Discord code block - SEND_STRING("```c" SS_LSFT("\n\n") "``` " SS_TAP(X_UP)); - } - SEQ_TWO_KEYS(KC_Y, KC_S) { // Greeting - SEND_STRING("Yours sincerely,\n\nThomas Baart"); - } - SEQ_THREE_KEYS(KC_M, KC_V, KC_G) { // Greeting - SEND_STRING("Met vriendelijke groet,\n\nThomas Baart"); - } - } } #ifdef OLED_ENABLE |