From bbf7a20b33de2d203518687cb5cd1aa85005ea27 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 13 Feb 2023 03:19:02 +1100 Subject: Refactor Leader key feature (#19632) Co-authored-by: Drashna Jaelre --- users/arkag/arkag.c | 257 ++++++++++++++++++++++++++-------------------------- 1 file changed, 126 insertions(+), 131 deletions(-) (limited to 'users/arkag/arkag.c') diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c index 7074da18eb..4e80b318a7 100644 --- a/users/arkag/arkag.c +++ b/users/arkag/arkag.c @@ -303,146 +303,141 @@ void pri_mod_keystroke(uint16_t key) { pri_mod(false); } +void leader_end_user(void) { + // begin OS functions + if (leader_sequence_two_keys(KC_P, KC_B)) { + if (current_os == OS_WIN) { + long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE}); + } else { + return; + } + } + if (leader_sequence_two_keys(KC_S, KC_S)) { + if (current_os == OS_MAC) { + long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); + } else if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); + } else { + return; + } + } + if (leader_sequence_three_keys(KC_C, KC_A, KC_D)) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL}); + } else { + } + } + if (leader_sequence_three_keys(KC_C, KC_A, KC_E)) { + if (current_os == OS_WIN) { + long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); + } else { + } + } + // end OS functions + + // begin format functions + if (leader_sequence_one_key(KC_B)) { + surround_type(2, KC_8, true); + } + if (leader_sequence_one_key(KC_I)) { + surround_type(2, KC_MINS, true); + } + if (leader_sequence_one_key(KC_U)) { + surround_type(4, KC_MINS, true); + } + if (leader_sequence_one_key(KC_S)) { + surround_type(4, KC_GRAVE, true); + } + if (leader_sequence_one_key(KC_C)) { + register_unicode(0x00E7); // ç + } + if (leader_sequence_two_keys(KC_A, KC_V)) { + surround_type(2, KC_QUOT, true); + pair_surround_type(2, KC_LCBR, true); + surround_type(2, KC_SPC, false); + } + if (leader_sequence_two_keys(KC_M, KC_L)) { + pair_surround_type(1, KC_LBRC, false); + SEND_STRING("LINK_NAME"); + tap_code(KC_RGHT); + pair_surround_type(1, KC_LPRN, true); + pri_mod_keystroke(KC_V); + } + if (leader_sequence_two_keys(KC_C, KC_C)) { + surround_type(2, KC_GRAVE, false); + } + if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) { + surround_type(6, KC_GRAVE, false); + } + if (leader_sequence_one_key(KC_E)) { + register_unicode(0x00E8); // è + } + if (leader_sequence_two_keys(KC_E, KC_E)) { + register_unicode(0x00E9); // é + } + // end format functions + + // start fancy functions + if (leader_sequence_two_keys(KC_V, KC_P)) { + SEND_STRING("ggvG}x:set paste\ni"); + pri_mod_keystroke(KC_V); + } + if (leader_sequence_three_keys(KC_C, KC_C, KC_ENT)) { + surround_type(6, KC_GRAVE, false); + pri_mod_keystroke(KC_V); + multi_tap(3, KC_RGHT, false); + tap_code(KC_ENTER); + } + if (leader_sequence_three_keys(KC_T, KC_C, KC_ENT)) { + multi_tap(3, KC_GRAVE, false); + pri_mod_keystroke(KC_V); + multi_tap(2, KC_ENTER, false); + } + // end fancy functions + + // start typing functions + if (leader_sequence_two_keys(KC_T, KC_M)) { + register_unicode(0x2122); // ™ + } + if (leader_sequence_two_keys(KC_D, KC_D)) { + SEND_STRING(".\\Administrator"); + } + if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) { + SEND_STRING(".\\Administrator"); + tap_code(KC_TAB); + pri_mod_keystroke(KC_V); + tap_code(KC_ENTER); + } + if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) { + send_unicode_string("ಠ__ಠ"); + } + if (leader_sequence_three_keys(KC_M, KC_A, KC_P)) { + SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); + } + if (leader_sequence_two_keys(KC_F, KC_F)) { + send_unicode_string("(╯‵Д′)╯彡┻━┻"); + } + if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) { + send_unicode_string("┬─┬ノ( º _ º ノ)"); + } + if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) { + send_unicode_string("( ͡° ͜ʖ ͡°)"); + } + if (leader_sequence_three_keys(KC_S, KC_S, KC_S)) { + send_unicode_string("¯\\_(ツ)_/¯"); + } + // end typing functions +} + void matrix_init_user(void) { current_os = eeprom_read_byte(EECONFIG_USERSPACE); set_os(current_os, false); } -LEADER_EXTERNS(); - void matrix_scan_user(void) { check_state(); flash_rgb(); fade_rgb(); - LEADER_DICTIONARY() { - leading = false; - leader_end(); - - // begin OS functions - SEQ_TWO_KEYS(KC_P, KC_B) { - if (current_os == OS_WIN) { - long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE}); - } else { - return; - } - } - SEQ_TWO_KEYS(KC_S, KC_S) { - if (current_os == OS_MAC) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); - } else if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); - } else { - return; - } - } - SEQ_THREE_KEYS(KC_C, KC_A, KC_D) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL}); - } else { - } - } - SEQ_THREE_KEYS(KC_C, KC_A, KC_E) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); - } else { - } - } - // end OS functions - - // begin format functions - SEQ_ONE_KEY(KC_B) { - surround_type(2, KC_8, true); - } - SEQ_ONE_KEY(KC_I) { - surround_type(2, KC_MINS, true); - } - SEQ_ONE_KEY(KC_U) { - surround_type(4, KC_MINS, true); - } - SEQ_ONE_KEY(KC_S) { - surround_type(4, KC_GRAVE, true); - } - SEQ_ONE_KEY(KC_C) { - register_unicode(0x00E7); // ç - } - SEQ_TWO_KEYS(KC_A, KC_V) { - surround_type(2, KC_QUOT, true); - pair_surround_type(2, KC_LCBR, true); - surround_type(2, KC_SPC, false); - } - SEQ_TWO_KEYS(KC_M, KC_L) { - pair_surround_type(1, KC_LBRC, false); - SEND_STRING("LINK_NAME"); - tap_code(KC_RGHT); - pair_surround_type(1, KC_LPRN, true); - pri_mod_keystroke(KC_V); - } - SEQ_TWO_KEYS(KC_C, KC_C) { - surround_type(2, KC_GRAVE, false); - } - SEQ_THREE_KEYS(KC_C, KC_C, KC_C) { - surround_type(6, KC_GRAVE, false); - } - SEQ_ONE_KEY(KC_E) { - register_unicode(0x00E8); // è - } - SEQ_TWO_KEYS(KC_E, KC_E) { - register_unicode(0x00E9); // é - } - // end format functions - - // start fancy functions - SEQ_TWO_KEYS(KC_V, KC_P) { - SEND_STRING("ggvG}x:set paste\ni"); - pri_mod_keystroke(KC_V); - } - SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { - surround_type(6, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(3, KC_RGHT, false); - tap_code(KC_ENTER); - } - SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { - multi_tap(3, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(2, KC_ENTER, false); - } - // end fancy functions - - // start typing functions - SEQ_TWO_KEYS(KC_T, KC_M) { - register_unicode(0x2122); // ™ - } - SEQ_TWO_KEYS(KC_D, KC_D) { - SEND_STRING(".\\Administrator"); - } - SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { - SEND_STRING(".\\Administrator"); - tap_code(KC_TAB); - pri_mod_keystroke(KC_V); - tap_code(KC_ENTER); - } - SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { - send_unicode_string("ಠ__ಠ"); - } - SEQ_THREE_KEYS(KC_M, KC_A, KC_P) { - SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); - } - SEQ_TWO_KEYS(KC_F, KC_F) { - send_unicode_string("(╯‵Д′)╯彡┻━┻"); - } - SEQ_THREE_KEYS(KC_F, KC_F, KC_F) { - send_unicode_string("┬─┬ノ( º _ º ノ)"); - } - SEQ_THREE_KEYS(KC_L, KC_O, KC_L) { - send_unicode_string("( ͡° ͜ʖ ͡°)"); - } - SEQ_THREE_KEYS(KC_S, KC_S, KC_S) { - send_unicode_string("¯\\_(ツ)_/¯"); - } - // end typing functions - - } } bool process_record_user(uint16_t keycode, keyrecord_t *record) { -- cgit v1.2.3