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/handwired/co60 | |
parent | d10350cd2ceb2b9d80522cdec3ea908118f7fd35 (diff) |
Refactor Leader key feature (#19632)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/handwired/co60')
-rw-r--r-- | keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c | 148 |
1 files changed, 64 insertions, 84 deletions
diff --git a/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c b/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c index 885c31e8c6..1d49d91346 100644 --- a/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c +++ b/keyboards/handwired/co60/keymaps/jmdaly_hhkb_split_space/keymap.c @@ -49,89 +49,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -void matrix_init_user(void) { - -} - -LEADER_EXTERNS(); - -void matrix_scan_user(void) { - - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - // Close a program in i3wm - SEQ_ONE_KEY(KC_Q) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_Q); - unregister_code(KC_Q); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); - } - // Exit i3wm - SEQ_ONE_KEY(KC_E) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_E); - unregister_code(KC_E); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); - } - // Copy selected text in suckless terminal - SEQ_ONE_KEY(KC_C) { - register_code(KC_LCTL); - register_code(KC_LSFT); - register_code(KC_C); - unregister_code(KC_C); - unregister_code(KC_LSFT); - unregister_code(KC_LCTL); - } - // Paste text in suckless terminal - SEQ_ONE_KEY(KC_V) { - register_code(KC_LCTL); - register_code(KC_LSFT); - register_code(KC_V); - unregister_code(KC_V); - unregister_code(KC_LSFT); - unregister_code(KC_LCTL); - } - // FZF shortcut to fuzzy switch directories - SEQ_ONE_KEY(KC_D) { - register_code(KC_LALT); - register_code(KC_C); - unregister_code(KC_C); - unregister_code(KC_LALT); - } - // Send keys to bring up fuzzy process kill - SEQ_ONE_KEY(KC_K) { - SEND_STRING("kill " SS_TAP(X_TAB)); - } - // Send keys to start neovim and fuzzy search for filename - SEQ_ONE_KEY(KC_T) { - SEND_STRING("nvim "); - register_code(KC_LCTL); - register_code(KC_T); - unregister_code(KC_T); - unregister_code(KC_LCTL); - } - // Switch between windows in tmux - SEQ_ONE_KEY(KC_L) { - register_code(KC_LCTL); - register_code(KC_B); - unregister_code(KC_B); - unregister_code(KC_LCTL); - register_code(KC_L); - unregister_code(KC_L); - } +void leader_end_user() { + // Close a program in i3wm + if (leader_sequence_one_key(KC_Q)) { + register_code(KC_LGUI); + register_code(KC_LSFT); + register_code(KC_Q); + unregister_code(KC_Q); + unregister_code(KC_LSFT); + unregister_code(KC_LGUI); + } + // Exit i3wm + if (leader_sequence_one_key(KC_E)) { + register_code(KC_LGUI); + register_code(KC_LSFT); + register_code(KC_E); + unregister_code(KC_E); + unregister_code(KC_LSFT); + unregister_code(KC_LGUI); + } + // Copy selected text in suckless terminal + if (leader_sequence_one_key(KC_C)) { + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_C); + unregister_code(KC_C); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + } + // Paste text in suckless terminal + if (leader_sequence_one_key(KC_V)) { + register_code(KC_LCTL); + register_code(KC_LSFT); + register_code(KC_V); + unregister_code(KC_V); + unregister_code(KC_LSFT); + unregister_code(KC_LCTL); + } + // FZF shortcut to fuzzy switch directories + if (leader_sequence_one_key(KC_D)) { + register_code(KC_LALT); + register_code(KC_C); + unregister_code(KC_C); + unregister_code(KC_LALT); + } + // Send keys to bring up fuzzy process kill + if (leader_sequence_one_key(KC_K)) { + SEND_STRING("kill " SS_TAP(X_TAB)); + } + // Send keys to start neovim and fuzzy search for filename + if (leader_sequence_one_key(KC_T)) { + SEND_STRING("nvim "); + register_code(KC_LCTL); + register_code(KC_T); + unregister_code(KC_T); + unregister_code(KC_LCTL); + } + // Switch between windows in tmux + if (leader_sequence_one_key(KC_L)) { + register_code(KC_LCTL); + register_code(KC_B); + unregister_code(KC_B); + unregister_code(KC_LCTL); + register_code(KC_L); + unregister_code(KC_L); } -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - } |