1
0
Fork 0

Refactor Leader key feature (#19632)

Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
Ryan 2023-02-13 03:19:02 +11:00 committed by GitHub
parent d10350cd2c
commit bbf7a20b33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 2457 additions and 1968 deletions

View file

@ -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) {