From 27bbf48cbaeec15f6854019d55e7154e14d7e57c Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 18 Jul 2022 10:37:48 -0700 Subject: [PATCH] Added leader key --- .gitignore | 4 +- .../betalupi_ergodox/keymaps/default/config.h | 12 ++++-- .../betalupi_ergodox/keymaps/default/keymap.c | 37 +++++++++++++++++++ .../keymaps/default/layers/main.h | 2 +- .../keymaps/default/layers/russian.h | 6 +-- .../betalupi_ergodox/keymaps/default/rules.mk | 1 + 6 files changed, 54 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a3d36fd..1e954ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /venv /build -qmk/qmk.conf \ No newline at end of file +qmk/qmk.conf + +secrets.h \ No newline at end of file diff --git a/keyboards/betalupi_ergodox/keymaps/default/config.h b/keyboards/betalupi_ergodox/keymaps/default/config.h index 9adfd82..638e480 100644 --- a/keyboards/betalupi_ergodox/keymaps/default/config.h +++ b/keyboards/betalupi_ergodox/keymaps/default/config.h @@ -1,3 +1,12 @@ + +// No timeout after initial leader key press +#define LEADER_NO_TIMEOUT + +// Timeout resets after each keypress +#define LEADER_PER_KEY_TIMING +#define LEADER_TIMEOUT 250 + + // RGBLight effects // Static color is always enabled. //#define RGBLIGHT_EFFECT_ALTERNATING @@ -19,9 +28,6 @@ //#def DISABLE_RGB_MATRIX_FFT_ANIM // FFT Display (Requires framebuffer) - - - // Normal matrix effects //#define DISABLE_RGB_MATRIX_SOLID_COLOR #define DISABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue diff --git a/keyboards/betalupi_ergodox/keymaps/default/keymap.c b/keyboards/betalupi_ergodox/keymaps/default/keymap.c index e23a6ff..a492dc8 100644 --- a/keyboards/betalupi_ergodox/keymaps/default/keymap.c +++ b/keyboards/betalupi_ergodox/keymaps/default/keymap.c @@ -1,5 +1,11 @@ #include "keymap.h" +// Values that should not be saved to git. +// Create a `secrets.h` in the keymap directory. +// +// It should define the following: +// SECRET_EMAIL +#include "secrets.h" // Define custom keys // (Must be done BEFORE keymaps) @@ -81,6 +87,37 @@ void set_layer_color(int layer) { } } + +void leader_start(void) { + ergodox_right_led_3_on(); +} + +void leader_end(void) { + ergodox_right_led_3_off(); +} + +LEADER_EXTERNS(); +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + //SEQ_ONE_KEY(KC_F) {} + // + //SEQ_TWO_KEYS(KC_A, KC_S) { + // register_code(KC_LGUI); + // register_code(KC_S); + // unregister_code(KC_S); + // unregister_code(KC_LGUI); + //} + + + SEQ_TWO_KEYS(KC_E, KC_M) { + SEND_STRING(SECRET_EMAIL); + } + } +} + void rgb_matrix_indicators_user(void) { if (keyboard_config.disable_layer_led) { return; diff --git a/keyboards/betalupi_ergodox/keymaps/default/layers/main.h b/keyboards/betalupi_ergodox/keymaps/default/layers/main.h index f619c13..a129e6e 100644 --- a/keyboards/betalupi_ergodox/keymaps/default/layers/main.h +++ b/keyboards/betalupi_ergodox/keymaps/default/layers/main.h @@ -14,7 +14,7 @@ \ \ KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, LGUI(KC_TAB),\ - KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_NO,\ + KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_LEAD,\ KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS_IDX), KC_L, KC_NO,\ KC_NO, KC_N, KC_M, KC_P, KC_DOT, KC_COMMA, KC_NO,\ KC_RIGHT, KC_NO, KC_NO, TO(LAYER_KEYBOARD_IDX), KC_NO,\ diff --git a/keyboards/betalupi_ergodox/keymaps/default/layers/russian.h b/keyboards/betalupi_ergodox/keymaps/default/layers/russian.h index 30eccd2..b7d668a 100644 --- a/keyboards/betalupi_ergodox/keymaps/default/layers/russian.h +++ b/keyboards/betalupi_ergodox/keymaps/default/layers/russian.h @@ -13,10 +13,10 @@ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\ \ \ - KC_TRANSPARENT, RU_6, RU_7, RU_8, RU_9, RU_0, KC_TRANSPARENT,\ - RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_TRANSPARENT,\ + KC_NO, RU_6, RU_7, RU_8, RU_9, RU_0, KC_TRANSPARENT,\ + RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_NO,\ RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS_RU_IDX), RU_EL, KC_NO,\ - RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\ + RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_NO,\ KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\ \ KC_TRANSPARENT, TO(LAYER_MAIN_IDX),\ diff --git a/keyboards/betalupi_ergodox/keymaps/default/rules.mk b/keyboards/betalupi_ergodox/keymaps/default/rules.mk index c7696af..f94356b 100644 --- a/keyboards/betalupi_ergodox/keymaps/default/rules.mk +++ b/keyboards/betalupi_ergodox/keymaps/default/rules.mk @@ -1,5 +1,6 @@ # rules.mk overrides +LEADER_ENABLE = yes TAP_DANCE_ENABLE = yes SRC += \