From 1aee492c0f88b1a96fabdf750a03ed128d9d844a Mon Sep 17 00:00:00 2001 From: Jonas Avellana <14019120+ninjonas@users.noreply.github.com> Date: Fri, 31 Jan 2020 23:38:05 -0700 Subject: [keymap(kyria), refactor] created kyria keymap. refactored ninjonas userspace (#8053) * [keymap(kyria), refactor] created kyria keymap. refactored ninjonas userspace and keyboards * [fix(#8053)] removed redundant code based off Duckle29's code review * [fix(#8053)] fixing typos * [refactor(#8053)] updating oled timeout * [fix(8053) resolved code review issues identified by noroadsleft --- users/ninjonas/README.md | 13 +++++++++---- users/ninjonas/ninjonas.h | 20 +++++++++++++------- users/ninjonas/oled.c | 29 +++++++++++++++++++---------- users/ninjonas/process_records.c | 16 +++++++++++++++- users/ninjonas/process_records.h | 1 + 5 files changed, 57 insertions(+), 22 deletions(-) (limited to 'users') diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md index 1e3fe9c31f..301b350e7a 100644 --- a/users/ninjonas/README.md +++ b/users/ninjonas/README.md @@ -14,6 +14,7 @@ See: https://docs.qmk.fm/#/feature_userspace - [Hotdox](../../keyboards/hotdox/keymaps/ninjonas) - [Pinky3](../../keyboards/pinky/3/keymaps/ninjonas) - [Lily58](../../keyboards/lily58/keymaps/ninjonas) +- [Kyria](../../keyboards/kyria/keymaps/ninjonas) ## Features ### [Keys](ninjonas.h#L37) @@ -33,6 +34,8 @@ See: https://docs.qmk.fm/#/feature_userspace |LT_LOW + LT_RAI | Hold for ADJUST | |LM_LOW | Dedicated key to momentarily toggle to use LOWER layer | |LM_RAI | Dedicated key to momentarily toggle to use RAISE layer | +|LG_LOW | Press to toggle LOWER layer | +|LG_RAI | Press to toggle RAISE layer | ### [Mod-Taps](ninjonas.h#L50) |Code | Description | @@ -59,13 +62,15 @@ Predefined keyboard layout templates to speed up configuring split keyboards ### [Macros](process_records.c) |Code | Description | |---|---| -|M_PYNV | macro to activate pyenv with the name `jira` | -|M_MAKE | macro to send QMK make command to compile keyboard | -|M_FLSH | macro to send QMK make command to compile keyboard with the correct bootloader | -|M_VRSN | macro to send QMK version | +|M_PYNV | Macro to activate pyenv with the name `jira` | +|M_MAKE | Macro to send QMK make command to compile keyboard | +|M_MALL | Macro to send QMK make command to all [ninjonas](#Supported%20Keyboards) keyboards | +|M_FLSH | Macro to send QMK make command to compile keyboard with the correct bootloader | +|M_VRSN | Macro to send QMK version | |M_SHFT | Sends  + alt + shift to a keycode to activate [ShiftIt](https://github.com/fikovnik/ShiftIt) | |M_CODE | Opens [Visual Studio Code](https://code.visualstudio.com/) on current directory | |M_TERM | Launches Spotlight and calls Terminal | +|M_COPA | Single key copy/paste | |M_XXX1 to M_XXX5 | Reserved for secret macros see [Secrets](#secrets) | ### [Tap-Dance](tap_dances.h) diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index b86ccc7333..ba94c8ea89 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -44,6 +44,8 @@ // Layer Keys #define LM_LOW MO(_LOWER) #define LM_RAI MO(_RAISE) +#define LG_LOW TG(_LOWER) +#define LG_RAI TG(_RAISE) #define LT_LOW LT(_LOWER, KC_ENT) #define LT_RAI LT(_RAISE, KC_SPC) @@ -52,7 +54,7 @@ #define MT_EQL MT(MOD_LALT | MOD_LSFT, KC_EQL) // Layout blocks -#define _____________________QWERTY_L1______________________ T_TAB, T_Q, T_W, KC_E, KC_R, KC_T +#define _____________________QWERTY_L1______________________ T_TAB, T_Q, KC_W, KC_E, KC_R, KC_T #define _____________________QWERTY_L2______________________ T_ESC, KC_A, KC_S, KC_D, KC_F, KC_G #define _____________________QWERTY_L3______________________ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B @@ -62,13 +64,13 @@ #define _____________________DVORAK_L1______________________ T_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y #define _____________________DVORAK_L2______________________ T_ESC, KC_A, KC_O, KC_E, KC_U, KC_I -#define _____________________DVORAK_L3______________________ KC_LSFT, KC_SCLN, T_Q, KC_J, KC_K, KC_X +#define _____________________DVORAK_L3______________________ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X #define _____________________DVORAK_R1______________________ KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS #define _____________________DVORAK_R2______________________ KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH -#define _____________________DVORAK_R3______________________ KC_B, KC_M, T_W, KC_V, KC_Z, MT_EQL +#define _____________________DVORAK_R3______________________ KC_B, KC_M, KC_W, KC_V, KC_Z, MT_EQL -#define _____________________COLEMAK_L1_____________________ T_TAB, T_Q, T_W, KC_F, KC_P, KC_G +#define _____________________COLEMAK_L1_____________________ T_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G #define _____________________COLEMAK_L2_____________________ T_ESC, KC_A, KC_R, KC_S, KC_T, KC_D #define _____________________COLEMAK_L3_____________________ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B @@ -94,7 +96,8 @@ #define _____________________LOWER_R3_______________________ T_RBRC, KC_M, M_TERM, M_CODE, M_XXX1, M_PYNV #define _____________________ADJUST_L1______________________ M_MAKE, EEP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX -#ifdef RGB_MATRIX_ENABLE + +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) #define _____________________ADJUST_L2______________________ M_VRSN, M_MALL, RGB_SPI, RGB_SAI, RGB_HUI, RGB_VAI #define _____________________ADJUST_L3______________________ M_FLSH, XXXXXXX, RGB_SPD, RGB_SAD, RGB_HUD, RGB_VAD #else @@ -102,7 +105,7 @@ #define _____________________ADJUST_L3______________________ M_FLSH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX #endif -#ifdef RGB_MATRIX_ENABLE +#if defined(RGB_MATRIX_ENABLE) || defined(RGBLIGHT_ENABLE) #define _____________________ADJUST_R1______________________ RGB_TOG, XXXXXXX, XXXXXXX, COLEMAK, DVORAK, QWERTY #define _____________________ADJUST_R3______________________ RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX #else @@ -119,11 +122,14 @@ #define __________________________________ _______, _______, _______, _______ +#define _____________MOD_LEFT_____________ KC_LALT, T_GUI, KC_LCTL, LT_RAI +#define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, LM_LOW + #define _________MEDIA_1_________ KC_BRIU, KC_MPLY, KC_MUTE #define _________MEDIA_2_________ KC_BRID, KC_MFFD, KC__VOLUP #define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC__VOLDOWN -#ifdef KEYBOARD_crkbd_rev1 +#if defined(KEYBOARD_crkbd_rev1) || defined(KEYBOARD_kyria_rev1) #define ________MOD_LEFT_________ T_GUI, KC_LCTL, LT_RAI #define ________MOD_RIGHT________ LT_LOW, KC_BSPC, MT_DEL #else diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 721038e15b..ac98133bc7 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -2,7 +2,7 @@ #include #include "ninjonas.h" -#ifdef OLED_DRIVER_ENABLE +#if defined(OLED_DRIVER_ENABLE) & !defined(KEYBOARD_kyria_rev1) static uint32_t oled_timer = 0; extern uint8_t is_master; @@ -38,19 +38,28 @@ void render_default_layer_state(void) { } } +void oled_white_space(void){ + oled_write_P(PSTR(" "), false); +} + void render_layer_state(void) { - oled_write_P(PSTR("\nLayer:"), false); - oled_write_P(PSTR(" LOW"), layer_state_is(_LOWER)); - oled_write_P(PSTR(" RAI"), layer_state_is(_RAISE)); - oled_write_P(PSTR(" ADJ"), layer_state_is(_ADJUST)); + oled_write_P(PSTR("\nLayer: "), false); + oled_write_P(PSTR("LOW"), (layer_state_is(_LOWER) & !layer_state_is(_ADJUST))); + oled_white_space(); + oled_write_P(PSTR("RAI"), (layer_state_is(_RAISE) & !layer_state_is(_ADJUST))); + oled_white_space(); + oled_write_P(PSTR("ADJ"), layer_state_is(_ADJUST)); } void render_mod_status(uint8_t modifiers) { - oled_write_P(PSTR("\nMods: "), false); - oled_write_P(PSTR("SHF "), (modifiers & MOD_MASK_SHIFT)); - oled_write_P(PSTR("CTL "), (modifiers & MOD_MASK_CTRL)); - oled_write_P(PSTR("ALT "), (modifiers & MOD_MASK_ALT)); - oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI)); + oled_write_P(PSTR("\nMods: "), false); + oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT)); + oled_white_space(); + oled_write_P(PSTR("CTL"), (modifiers & MOD_MASK_CTRL)); + oled_white_space(); + oled_write_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT)); + oled_white_space(); + oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI)); } void render_status(void){ diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c index 8044b49f10..5c6d98ec8f 100644 --- a/users/ninjonas/process_records.c +++ b/users/ninjonas/process_records.c @@ -1,5 +1,7 @@ #include "ninjonas.h" +uint16_t copy_paste_timer; + __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } @@ -44,7 +46,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Sends QMK make command to compile all keyboards case M_MALL: if (record->event.pressed) { - SEND_STRING("rm -f *.hex && rm -rf .build/ && make crkbd:ninjonas lily58:ninjonas hotdox:ninjonas pinky/3:ninjonas\n"); + SEND_STRING("rm -f *.hex && rm -rf .build/ && make crkbd:ninjonas lily58:ninjonas hotdox:ninjonas pinky/3:ninjonas kyria:ninjonas\n"); } break; @@ -90,6 +92,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; + // Single key copy/paste + case M_COPA: + if (record->event.pressed) { + copy_paste_timer = timer_read(); + } else { + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { + tap_code16(LGUI(KC_C)); // Hold  + C + } else { + tap_code16(LGUI(KC_V)); // Tap  + V + } + } + // BEGIN: Layer macros case QWERTY: if (record->event.pressed) { diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h index 2e69ca2163..34886531a5 100644 --- a/users/ninjonas/process_records.h +++ b/users/ninjonas/process_records.h @@ -15,6 +15,7 @@ enum custom_keycodes { M_VRSN, M_CODE, M_TERM, + M_COPA, // Secret Macros M_XXX1, M_XXX2, -- cgit v1.2.3