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/ergodox_ez/keymaps | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/ergodox_ez/keymaps')
4 files changed, 36 insertions, 47 deletions
diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c deleted file mode 100644 index 8d5fa00a7d..0000000000 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_dictionary.c +++ /dev/null @@ -1,14 +0,0 @@ -LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(TD(APMR_PIPE)) { - register_code(KC_LCTL); - register_code(KC_LSFT); - register_code(KC_U); - - unregister_code(KC_U); - unregister_code(KC_LSFT); - unregister_code(KC_LCTL); - } -} diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c deleted file mode 100644 index c22670a05a..0000000000 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/leader/leader_setup.c +++ /dev/null @@ -1 +0,0 @@ -LEADER_EXTERNS(); diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c index 277821afac..fc6c99cb85 100644 --- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c +++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/matrix_scan_user.c @@ -1,5 +1,3 @@ -#include "../leader/leader_setup.c" - bool MATRIX_SCANNED = false; void matrix_scan_user(void) { @@ -7,6 +5,16 @@ void matrix_scan_user(void) { rgblight_sethsv_noeeprom(HSV_GREEN); MATRIX_SCANNED = true; } - - #include "../leader/leader_dictionary.c" }; + +void leader_end_user(void) { + if (leader_sequence_one_key(TD(APMR_PIPE))) { + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_U); + + unregister_code(KC_U); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + } +} diff --git a/keyboards/ergodox_ez/keymaps/stamm/keymap.c b/keyboards/ergodox_ez/keymaps/stamm/keymap.c index 8a3e30f5f6..21f58b298c 100644 --- a/keyboards/ergodox_ez/keymaps/stamm/keymap.c +++ b/keyboards/ergodox_ez/keymaps/stamm/keymap.c @@ -244,7 +244,30 @@ uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) { } } -LEADER_EXTERNS(); +void leader_end_user(void) { + if (leader_sequence_one_key(KC_F)) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + if (leader_sequence_one_key(KC_S)) { + SEND_STRING ("sudo -i\n"); + } + if (leader_sequence_one_key(KC_H)) { + SEND_STRING ("--help\n"); + } + if (leader_sequence_two_keys(KC_D, KC_D)) { + SEND_STRING(SS_LGUI("ac")); + /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */ + } + if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) { + SEND_STRING("https://start.duckduckgo.com\n"); + } + if (leader_sequence_two_keys(KC_A, KC_S)) { + register_code(KC_LGUI); + register_code(KC_S); + unregister_code(KC_S); + unregister_code(KC_LGUI); + } +} void matrix_scan_user(void) { if (is_alt_tab_active) { @@ -253,31 +276,4 @@ void matrix_scan_user(void) { is_alt_tab_active = false; } } - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - SEQ_ONE_KEY(KC_F) { - SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); - } - SEQ_ONE_KEY(KC_S) { - SEND_STRING ("sudo -i\n"); - } - SEQ_ONE_KEY(KC_H) { - SEND_STRING ("--help\n"); - } - SEQ_TWO_KEYS(KC_D, KC_D) { - SEND_STRING(SS_LGUI("ac")); - /* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */ - } - SEQ_THREE_KEYS(KC_D, KC_D, KC_S) { - SEND_STRING("https://start.duckduckgo.com\n"); - } - SEQ_TWO_KEYS(KC_A, KC_S) { - register_code(KC_LGUI); - register_code(KC_S); - unregister_code(KC_S); - unregister_code(KC_LGUI); - } - } } |