From 2881f53dd49d3fe70fefe9f05a618ac713c8529b Mon Sep 17 00:00:00 2001 From: Jonas Avellana <14019120+ninjonas@users.noreply.github.com> Date: Mon, 7 Oct 2019 11:42:03 -0600 Subject: [Keymap] updating ninjonas userspace (#6903) * [refactor] updating ninjonas layout blocks and standardized LOWER & ADJUST * [feat] added new macro M_TERM to open MacOS terminal app * [feat] introducing mod-tap functionality on keymap * [fix] fixing oled turning on when it feels like it. thanks @drashna for helping * [feat] updating OLED to rotate logo 180 degrees * [feat] updating keymaps to reflect VSCode frequent habits * [refactor] converting crkbd modifier keys to layer blocks * [fix(#6903)] converting _delay_ms to wait_ms on launching terminal macro --- users/ninjonas/README.md | 13 ++++++++--- users/ninjonas/ninjonas.h | 47 +++++++++++++++++++++++++++++++++------- users/ninjonas/oled.c | 15 +++++++++---- users/ninjonas/process_records.c | 21 +++++++++++++----- users/ninjonas/process_records.h | 1 + 5 files changed, 76 insertions(+), 21 deletions(-) (limited to 'users') diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md index 32ccdc699f..1e3fe9c31f 100644 --- a/users/ninjonas/README.md +++ b/users/ninjonas/README.md @@ -19,7 +19,7 @@ See: https://docs.qmk.fm/#/feature_userspace ### [Keys](ninjonas.h#L37) |Code | Description | |---|---| -|K_LOCK | MacOS shortcut to execute lock command  + ctrl + Q | +|K_LOCK | MacOS shortcut to execute lock command  + CTRL + Q | |K_CSCN | MacOS shortcut to copy a portion of the screen to the clipboard | |K_MDSH | MacOS shortcut to get em-dash `–` | |K_RAPP | MacOS shortcut to switch apps to the right | @@ -34,7 +34,13 @@ See: https://docs.qmk.fm/#/feature_userspace |LM_LOW | Dedicated key to momentarily toggle to use LOWER layer | |LM_RAI | Dedicated key to momentarily toggle to use RAISE layer | -### [Layout Blocks](ninjonas.h#L50) +### [Mod-Taps](ninjonas.h#L50) +|Code | Description | +|---|---| +|MT_DEL | Tap for Delete, hold for  + ALT + SHIFT | +|MT_EQL | Tap for =, hold for ALT + SHIFT | + +### [Layout Blocks](ninjonas.h#L54) Predefined keyboard layout templates to speed up configuring split keyboards |Code | Description | @@ -59,6 +65,7 @@ Predefined keyboard layout templates to speed up configuring split keyboards |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_XXX1 to M_XXX5 | Reserved for secret macros see [Secrets](#secrets) | ### [Tap-Dance](tap_dances.h) @@ -78,7 +85,7 @@ There's times where you have macros you don't want to share like emails, an addr ```c // secrets.c -#include "ninjonas.h" +#include "ninjonas.h" static const char * const secret[] = { "BLANK1", diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index fdba683702..b86ccc7333 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -47,6 +47,10 @@ #define LT_LOW LT(_LOWER, KC_ENT) #define LT_RAI LT(_RAISE, KC_SPC) +// Mod-Tap Keys +#define MT_DEL MT(MOD_LGUI | MOD_LALT | MOD_LSFT, KC_DEL) +#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_L2______________________ T_ESC, KC_A, KC_S, KC_D, KC_F, KC_G @@ -54,7 +58,7 @@ #define _____________________QWERTY_R1______________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS #define _____________________QWERTY_R2______________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT -#define _____________________QWERTY_R3______________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL +#define _____________________QWERTY_R3______________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT_EQL #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 @@ -62,7 +66,7 @@ #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, KC_EQL +#define _____________________DVORAK_R3______________________ KC_B, KC_M, T_W, KC_V, KC_Z, MT_EQL #define _____________________COLEMAK_L1_____________________ T_TAB, T_Q, T_W, KC_F, KC_P, KC_G #define _____________________COLEMAK_L2_____________________ T_ESC, KC_A, KC_R, KC_S, KC_T, KC_D @@ -70,7 +74,7 @@ #define _____________________COLEMAK_R1_____________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS #define _____________________COLEMAK_R2_____________________ KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT -#define _____________________COLEMAK_R3_____________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL +#define _____________________COLEMAK_R3_____________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, MT_EQL #define _____________________NUM_LEFT_______________________ T_GRV, KC_1, KC_2, KC_3, KC_4, KC_5 #define _____________________NUM_RIGHT______________________ KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS @@ -81,8 +85,31 @@ #define _____________________SYM_LEFT_______________________ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC #define _____________________SYM_RIGHT______________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_UNDS -#define ____________________________________________________ _______, _______, _______, _______, _______, _______ -#define _____________________XXXXXXX________________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define _____________________LOWER_L1_______________________ M_XXX2, M_XXX3, _________MEDIA_1_________, K_CSCN +#define _____________________LOWER_L2_______________________ M_XXX4, M_XXX5, _________MEDIA_2_________, XXXXXXX +#define _____________________LOWER_L3_______________________ KC_LSFT, M_SHFT, _________MEDIA_3_________, T_LBRC + +#define _____________________LOWER_R1_______________________ _______________NAV_1______________, XXXXXXX, K_MDSH +#define _____________________LOWER_R2_______________________ _______________NAV_2______________, K_LOCK, XXXXXXX +#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 + #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 + #define _____________________ADJUST_L2______________________ M_VRSN, M_MALL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + #define _____________________ADJUST_L3______________________ M_FLSH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#endif + +#ifdef RGB_MATRIX_ENABLE + #define _____________________ADJUST_R1______________________ RGB_TOG, XXXXXXX, XXXXXXX, COLEMAK, DVORAK, QWERTY + #define _____________________ADJUST_R3______________________ RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#else + #define _____________________ADJUST_R1______________________ XXXXXXX, XXXXXXX, XXXXXXX, COLEMAK, DVORAK, QWERTY + #define _____________________ADJUST_R3______________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#endif +#define _____________________ADJUST_R2______________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX #define _______________NAV_1______________ KC_PGUP, KC_HOME, KC_UP, KC_END #define _______________NAV_2______________ KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT @@ -91,14 +118,18 @@ #define _____________MOUSE_2______________ KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U #define __________________________________ _______, _______, _______, _______ -#define _____________XXXXXXX______________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX #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 -#define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL -#define ________MOD_RIGHT________ KC_BSPC, KC_DEL, LM_LOW +#ifdef KEYBOARD_crkbd_rev1 + #define ________MOD_LEFT_________ T_GUI, KC_LCTL, LT_RAI + #define ________MOD_RIGHT________ LT_LOW, KC_BSPC, MT_DEL +#else + #define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL + #define ________MOD_RIGHT________ KC_BSPC, MT_DEL, LM_LOW +#endif // Layout wrappers #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 8a9c995936..721038e15b 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -4,12 +4,19 @@ #ifdef OLED_DRIVER_ENABLE -static uint16_t oled_timer = 0; +static uint32_t oled_timer = 0; extern uint8_t is_master; +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_master) { + return OLED_ROTATION_0; + } + return OLED_ROTATION_180; +} + bool process_record_oled(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { - oled_timer = timer_read(); + oled_timer = timer_read32(); } return true; } @@ -64,7 +71,7 @@ static void render_logo(void) { } void oled_task_user(void) { - if (timer_elapsed(oled_timer) > 30000) { + if (timer_elapsed32(oled_timer) > 30000) { oled_off(); return; } @@ -75,8 +82,8 @@ void oled_task_user(void) { if (is_master) { render_status(); } else { - oled_write_P(PSTR("\n"), false); render_logo(); + oled_write_P(PSTR("\n"), false); oled_scroll_left(); } } diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c index 6ec5be5978..8044b49f10 100644 --- a/users/ninjonas/process_records.c +++ b/users/ninjonas/process_records.c @@ -12,10 +12,6 @@ bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; } #endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { - #ifdef OLED_DRIVER_ENABLE - process_record_oled(keycode, record); - #endif - switch (keycode) { // Sends pyenv to activate 'jira' environment @@ -81,7 +77,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Opens Visual Studio Code on current directory case M_CODE: if (record->event.pressed) { - SEND_STRING("code ." SS_TAP(X_ENTER)); + SEND_STRING("code .\n"); + } + break; + + // Opens Terminal + case M_TERM: + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI)); + wait_ms(250); + SEND_STRING("terminal\n"); } break; @@ -104,5 +109,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // END: Layer macros } - return process_record_keymap(keycode, record) && process_record_secrets(keycode, record); + return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) + #ifdef OLED_DRIVER_ENABLE + && process_record_oled(keycode, record) + #endif + ; // Close return } diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h index 07babdd583..2e69ca2163 100644 --- a/users/ninjonas/process_records.h +++ b/users/ninjonas/process_records.h @@ -14,6 +14,7 @@ enum custom_keycodes { M_FLSH, M_VRSN, M_CODE, + M_TERM, // Secret Macros M_XXX1, M_XXX2, -- cgit v1.2.3