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 --- keyboards/splitkb/kyria/keymaps/corodiak/keymap.c | 65 ++++++++++------------- 1 file changed, 29 insertions(+), 36 deletions(-) (limited to 'keyboards/splitkb/kyria/keymaps/corodiak/keymap.c') 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))); } } } -- cgit v1.2.3