From 7f3a41108f003063f2663847df1d889314ad5791 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 3 Oct 2020 13:50:30 -0400 Subject: [PATCH] leader key looks fun --- moonlander/combos.def | 40 +++---------------------- moonlander/config.h | 2 ++ moonlander/keymap.c | 12 ++------ moonlander/leader.c | 70 +++++++++++++++++++++++++++++++++++++++++++ moonlander/rules.mk | 3 +- 5 files changed, 81 insertions(+), 46 deletions(-) create mode 100644 moonlander/leader.c diff --git a/moonlander/combos.def b/moonlander/combos.def index b7496d1..5bfc68b 100644 --- a/moonlander/combos.def +++ b/moonlander/combos.def @@ -1,40 +1,8 @@ -// Programming -SUBS(ifErr, "if err != nil {\n\t\n}", KC_E, KC_I) -SUBS(goTest, "go test ./...\n", KC_G, KC_T) -SUBS(cargoTest, "cargo test\n", KC_C, KC_T) - // 1c project names -SUBS(kumo, "kumo ", KC_K, KC_M) -SUBS(gaia, "gaia ", KC_G, KC_A) -SUBS(leeroy, "leeroy ", KC_L, KC_R) -SUBS(jinn, "jinn ", KC_J, KC_I) - -// proxy tags -SUBS(cadey, "Cadey\\ ", KC_C, KC_A) -SUBS(nicole, "Nicole\\ ", KC_N, KC_I) -SUBS(jessie, "Jessie\\ ", KC_J, KC_E) -SUBS(ashe, "Ashe\\ ", KC_A, KC_S) -SUBS(sephie, "Sephie\\ ", KC_S, KC_E) -SUBS(mai, "Mai\\ ", KC_M, KC_A) - -// Helpers for Kubernetes -SUBS(kyGetDepl, "kubectl get deployments ", KC_K, KC_Y) -SUBS(kuGetVer, "kubectl version ", KC_K, KC_U) -SUBS(kiExec, "kubectl exec -it ", KC_K, KC_I) -SUBS(koDesc, "kubectl describe ", KC_K, KC_O) -SUBS(kpGetPods, "kubectl get pods ", KC_K, KC_P) -SUBS(knGetNodes, "kubectl get nodes -o wide ", KC_K, KC_N) -SUBS(kmLogs, "kubectl logs ", KC_K, KC_M) -SUBS(kConfig, "kubectl logs ", KC_K, KC_COMM) - -// pastas -SUBS( - nonbinary, - "Non-binary gender identity is just one term used to describe individuals who may experience a gender identity that is neither exclusively male or female or is in between or beyond both genders. Non-binary individuals may identify as gender fluid, agender (without gender), third gender, or something else entirely.", - KC_E, - KC_B -) -SUBS(breatheManually, "this sentence makes you breathe manually", KC_B, KC_M) +//SUBS(kumo, "kumo ", KC_K, KC_M) +//SUBS(gaia, "gaia ", KC_G, KC_A) +//SUBS(leeroy, "leeroy ", KC_L, KC_R) +//SUBS(jinn, "jinn ", KC_J, KC_I) // Vim-Mode combos COMB(weEsc, KC_ESC, KC_W, KC_F) diff --git a/moonlander/config.h b/moonlander/config.h index 0d20c90..23327e2 100644 --- a/moonlander/config.h +++ b/moonlander/config.h @@ -5,6 +5,8 @@ #define ORYX_CONFIGURATOR #define FIRMWARE_VERSION u8"xbJXx/Gw3K3" #define RGB_MATRIX_STARTUP_SPD 60 +#define LEADER_TIMEOUT 100 +#define LEADER_PER_KEY_TIMING #define COMBO_COUNT 1 #define COMBO_TERM 50 #define COMBO_ALLOW_ACTION_KEYS diff --git a/moonlander/keymap.c b/moonlander/keymap.c index 4d2b027..0e53940 100644 --- a/moonlander/keymap.c +++ b/moonlander/keymap.c @@ -1,8 +1,8 @@ #include QMK_KEYBOARD_H #include "config.h" #include "version.h" -#include "g/keymap_combo.h" #include "keymap_steno.h" +#include "g/keymap_combo.h" #include "music.h" #define KC_MAC_UNDO LGUI(KC_Z) @@ -76,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_DELETE, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(4), TG(2), KC_J, KC_L, KC_U, KC_Y, KC_SCOLON, KC_BSLASH, KC_ESCAPE, KC_A, KC_R, KC_S, KC_T, KC_D, TG(1), TG(5), KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOTE, KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSPC, - LT(3,KC_GRAVE), LCTL_T(KC_NO), LALT(KC_LSHIFT),KC_LEFT, KC_RIGHT, KC_LALT, RCTL_T(KC_ESCAPE), KC_UP, KC_DOWN, KC_LBRACKET, KC_RBRACKET, MO(3), + LT(3,KC_GRAVE), KC_LCTRL, LALT(KC_LSHIFT),KC_LEFT, KC_RIGHT, LALT_T(KC_LEAD), RCTL_T(KC_ESCAPE), KC_UP, KC_DOWN, KC_LBRACKET, KC_RBRACKET, MO(3), KC_SPACE, KC_BSPACE, KC_LGUI, KC_COLON, KC_TAB, KC_ENTER ), @@ -442,30 +442,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void matrix_init_user() { steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT + autoshift_enable(); } layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { case COLEMAK: - autoshift_enable(); break; case QWERTY: - autoshift_disable(); break; case DVORAK: - autoshift_enable(); break; case SYMNUM: - autoshift_disable(); break; case MEDIA: - autoshift_disable(); break; case DWM: - autoshift_disable(); break; case STENO: - autoshift_disable(); PLAY_SONG(sonic_ring); break; } diff --git a/moonlander/leader.c b/moonlander/leader.c new file mode 100644 index 0000000..6779d57 --- /dev/null +++ b/moonlander/leader.c @@ -0,0 +1,70 @@ +#include QMK_KEYBOARD_H +#include "config.h" +#include "version.h" + +extern void combo_enable(void); +extern void combo_disable(void); + +LEADER_EXTERNS(); + +void matrix_scan_user(void) { + LEADER_DICTIONARY() { + leading = false; + leader_end(); + + // Proxytags + SEQ_TWO_KEYS(KC_P, KC_C) { SEND_STRING("Cadey\\ "); } + SEQ_TWO_KEYS(KC_P, KC_N) { SEND_STRING("Nicole\\ "); } + SEQ_TWO_KEYS(KC_P, KC_J) { SEND_STRING("Jessie\\ "); } + SEQ_TWO_KEYS(KC_P, KC_A) { SEND_STRING("Ashe\\ "); } + SEQ_TWO_KEYS(KC_P, KC_S) { SEND_STRING("Sephie\\ "); } + SEQ_TWO_KEYS(KC_P, KC_M) { SEND_STRING("Mai\\ "); } + + // Combos + SEQ_TWO_KEYS(KC_C, KC_D) { combo_disable(); } + SEQ_TWO_KEYS(KC_C, KC_E) { combo_enable(); } + + // Autoshift + SEQ_THREE_KEYS(KC_A, KC_S, KC_T) { autoshift_toggle(); } + SEQ_THREE_KEYS(KC_A, KC_S, KC_E) { autoshift_enable(); } + SEQ_THREE_KEYS(KC_A, KC_S, KC_D) { autoshift_disable(); } + + // Go + SEQ_THREE_KEYS(KC_G, KC_I, KC_E) { + SEND_STRING("if err != nil {\n\t\n}"); + } + + // k8s + SEQ_THREE_KEYS(KC_K, KC_G, KC_D) { SEND_STRING("kubectl get deployments "); } + SEQ_THREE_KEYS(KC_K, KC_G, KC_P) { SEND_STRING("kubectl get pods "); } + SEQ_THREE_KEYS(KC_K, KC_G, KC_N) { SEND_STRING("kubectl get nodes -o wide "); } + SEQ_TWO_KEYS(KC_K, KC_L) { SEND_STRING("kubectl logs "); } + SEQ_THREE_KEYS(KC_K, KC_L, KC_D) { SEND_STRING("kubectl logs deployment/"); } + SEQ_TWO_KEYS(KC_K, KC_V) { SEND_STRING("kubectl version "); } + SEQ_TWO_KEYS(KC_K, KC_I) { SEND_STRING("kubectl exec -it "); } + SEQ_TWO_KEYS(KC_K, KC_D) { SEND_STRING("kubectl describe "); } + + // Git + SEQ_TWO_KEYS(KC_G, KC_P) { SEND_STRING("git push"); } + SEQ_THREE_KEYS(KC_G, KC_F, KC_P) { SEND_STRING("git push --force-with-lease"); } + SEQ_TWO_KEYS(KC_G, KC_U) { SEND_STRING("git pull"); } + SEQ_TWO_KEYS(KC_G, KC_A) { SEND_STRING("git add ."); } + SEQ_TWO_KEYS(KC_G, KC_D) { SEND_STRING("git diff"); } + SEQ_THREE_KEYS(KC_G, KC_D, KC_S) { SEND_STRING("git diff --staged"); } + SEQ_TWO_KEYS(KC_G, KC_L) { SEND_STRING("git log"); } + SEQ_THREE_KEYS(KC_G, KC_L, KC_O) { SEND_STRING("git log --oneline"); } + SEQ_TWO_KEYS(KC_G, KC_O) { SEND_STRING("git checkout"); } + SEQ_THREE_KEYS(KC_G, KC_O, KC_B) { SEND_STRING("git checkout -b"); } + SEQ_TWO_KEYS(KC_G, KC_S) { SEND_STRING("git status"); } + SEQ_TWO_KEYS(KC_G, KC_C) { SEND_STRING("git commit -m ''"); } + SEQ_THREE_KEYS(KC_G, KC_C, KC_A) { SEND_STRING("git commit --amend"); } + + // copypastas + SEQ_THREE_KEYS(KC_P, KC_N, KC_B) { + SEND_STRING("Non-binary gender identity is just one term used to describe individuals who may experience a gender identity that is neither exclusively male or female or is in between or beyond both genders. Non-binary individuals may identify as gender fluid, agender (without gender), third gender, or something else entirely."); + } + SEQ_THREE_KEYS(KC_P, KC_B, KC_M) { + SEND_STRING("this sentence makes you breathe manually"); + } + } +} diff --git a/moonlander/rules.mk b/moonlander/rules.mk index bb7b1cb..b87832b 100644 --- a/moonlander/rules.mk +++ b/moonlander/rules.mk @@ -4,7 +4,7 @@ COMMAND_ENABLE = no WEBUSB_ENABLE = yes ORYX_ENABLE = yes DYNAMIC_MACRO_ENABLE = yes -SRC = matrix.c +SRC = matrix.c leader.c RGBLIGHT_ENABLE = no RGB_MATRIX_ENABLE = yes COMBO_ENABLE = yes @@ -12,3 +12,4 @@ VPATH += keyboards/gboards/ WPM_ENABLE = yes STENO_ENABLE = yes AUTO_SHIFT_ENABLE = yes +LEADER_ENABLE = yes