diff options
author | Jonas Avellana <14019120+ninjonas@users.noreply.github.com> | 2020-02-17 02:30:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 01:30:03 -0800 |
commit | 79e6b7866988f3cfc1c5b6746e5f400b50704ce8 (patch) | |
tree | 79b72d2c165198fbd1715ac42b625dae1ab1e1a4 /users | |
parent | 5e79da9f321a7b50fc82201ad51b1f1bfa0e0114 (diff) | |
download | qmk_firmware-79e6b7866988f3cfc1c5b6746e5f400b50704ce8.tar.gz qmk_firmware-79e6b7866988f3cfc1c5b6746e5f400b50704ce8.zip |
[Keymap] ninjonas keymap updates (#8170)
* [keymap] ninjonas keymap updates
* [refactor(kyria)] updating keymap for numpad layer to be transparent rather than ignores
* [keymap(lily58)] added numpad layer
* [keymap(crkbd)] added numpad layer activated through tapdance
* [fix(8170)] fixing code review changes requested by noroadsleft
* [fix(8170)] updating comments and .md files to use 'Cmd' instead of and ⌘
Diffstat (limited to 'users')
-rw-r--r-- | users/ninjonas/README.md | 27 | ||||
-rw-r--r-- | users/ninjonas/config.h | 2 | ||||
-rw-r--r-- | users/ninjonas/ninjonas.h | 18 | ||||
-rw-r--r-- | users/ninjonas/oled.c | 5 | ||||
-rw-r--r-- | users/ninjonas/process_records.c | 6 | ||||
-rw-r--r-- | users/ninjonas/tap_dances.c | 86 | ||||
-rw-r--r-- | users/ninjonas/tap_dances.h | 23 |
7 files changed, 140 insertions, 27 deletions
diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md index 39d92cff35..f537373bcf 100644 --- a/users/ninjonas/README.md +++ b/users/ninjonas/README.md @@ -17,17 +17,17 @@ See: https://docs.qmk.fm/#/feature_userspace - [Kyria](../../keyboards/kyria/keymaps/ninjonas) ## Features -### [Keys](ninjonas.h#L37) +### [Keys](ninjonas.h) |Code | Description | |---|---| -|K_LOCK | MacOS shortcut to execute lock command + CTRL + Q | +|K_LOCK | MacOS shortcut to execute lock command Cmd + 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 | |K_LAPP | MacOS shortcut to switch apps to the left | -|K_CPRF | + Shift + M. Used for switching Google Chrome profiles | +|K_CPRF | Cmd + Shift + M. Used for switching Google Chrome profiles | -### [Layers](ninjonas.h#L44) +### [Layers](ninjonas.h) |Code | Description | |---|---| |LT_LOW | Tap for ENTER, hold for RAISE | @@ -38,13 +38,13 @@ See: https://docs.qmk.fm/#/feature_userspace |LG_LOW | Press to toggle LOWER layer | |LG_RAI | Press to toggle RAISE layer | -### [Mod-Taps](ninjonas.h#L50) +### [Mod-Taps](ninjonas.h) |Code | Description | |---|---| -|MT_DEL | Tap for Delete, hold for + ALT + SHIFT | +|MT_DEL | Tap for Delete, hold for Cmd + ALT + SHIFT | |MT_EQL | Tap for =, hold for ALT + SHIFT | -### [Layout Blocks](ninjonas.h#L54) +### [Layout Blocks](ninjonas.h) Predefined keyboard layout templates to speed up configuring split keyboards |Code | Description | @@ -59,6 +59,7 @@ Predefined keyboard layout templates to speed up configuring split keyboards |MOUSE | Mouse Cluster | |MEDIA | Media Cluster | |MOD | Modifier Cluster | +|NUMPAD | Numpad Cluster | ### [Macros](process_records.c) |Code | Description | @@ -68,7 +69,7 @@ Predefined keyboard layout templates to speed up configuring split keyboards |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_SHFT | Sends Cmd + 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 | @@ -81,10 +82,12 @@ Predefined keyboard layout templates to speed up configuring split keyboards |T_LBRC | Tap once for [, double for back browser | |T_RBRC | Tap once for ], double for forward browser | |T_TAB | Tap once for TAB, double for CTRL + TAB | -|T_GRV | Tap once for GRV, double for + GRV | -|T_GUI | Tap once for , double to open spotlight | -|T_W | Tap for W, double tap for + W | -|T_Q | Tap for Q, double tap for + Q | +|T_GRV | Tap once for GRV, double for Cmd + GRV | +|T_GUI | Tap once for Cmd, double to open spotlight | +|T_W | Tap for W, double tap for Cmd + W | +|T_Q | Tap for Q, double tap for Cmd + Q | +|T_CPNU | Tap for Cmd + V, hold for Cmd + C, double tap for NUMPAD layer | +|T_Y | Tap for Y, double tap for NUMPAD layer | ### Secrets There's times where you have macros you don't want to share like emails, an address you need but you always forget, passwords 😱, & and private strings. Based off [drashna's secret macros](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md), it's now possible to do this. All you need to do is create a `secrets.c` file. Below is an example of how this is used. diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h index 1166939c65..ae2370c5a1 100644 --- a/users/ninjonas/config.h +++ b/users/ninjonas/config.h @@ -1,6 +1,6 @@ #ifdef TAPPING_TERM #undef TAPPING_TERM - #define TAPPING_TERM 200 + #define TAPPING_TERM 300 #endif // Mouse Settings: Smoothing out mouse movement on keypress diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index 6f79b262f6..6772957e27 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -33,20 +33,22 @@ #define _LOWER 3 #define _RAISE 4 #define _ADJUST 5 +#define _NUMPAD 6 // Shortcut Keys #define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS #define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard -#define K_CPRF LGUI(LSFT(KC_M)) // + Shift + M. Used for switching Google Chrome profiles +#define K_CPRF LGUI(LSFT(KC_M)) // Cmd + Shift + M. Used for switching Google Chrome profiles #define K_MDSH LSFT(LALT(KC_MINS)) -#define K_LAPP SGUI(KC_TAB) // + Shift + Tab -#define K_RAPP LGUI(KC_TAB) // + Tab +#define K_LAPP SGUI(KC_TAB) // Cmd + Shift + Tab +#define K_RAPP LGUI(KC_TAB) // Cmd + Tab // Layer Keys #define LM_LOW MO(_LOWER) #define LM_RAI MO(_RAISE) #define LG_LOW TG(_LOWER) #define LG_RAI TG(_RAISE) +#define LG_NUM TG(_NUMPAD) #define LT_LOW LT(_LOWER, KC_ENT) #define LT_RAI LT(_RAISE, KC_SPC) @@ -59,7 +61,7 @@ #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 -#define _____________________QWERTY_R1______________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS +#define _____________________QWERTY_R1______________________ T_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, MT_EQL @@ -115,6 +117,10 @@ #endif #define _____________________ADJUST_R2______________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define _____________________NUMPAD_1_______________________ T_Y, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_PAST +#define _____________________NUMPAD_2_______________________ XXXXXXX, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PSLS +#define _____________________NUMPAD_3_______________________ KC_P0, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_COLN + #define _______________NAV_1______________ KC_PGUP, KC_HOME, KC_UP, KC_END #define _______________NAV_2______________ KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT @@ -124,7 +130,7 @@ #define __________________________________ _______, _______, _______, _______ #define _____________MOD_LEFT_____________ KC_LALT, T_GUI, KC_LCTL, LT_RAI -#define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, LM_LOW +#define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, T_CPNU #define _________MEDIA_1_________ KC_BRIU, KC_MPLY, KC_MUTE #define _________MEDIA_2_________ KC_BRID, KC_MFFD, KC__VOLUP @@ -135,7 +141,7 @@ #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 + #define ________MOD_RIGHT________ KC_BSPC, MT_DEL, T_CPNU #endif // Layout wrappers diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 285b0364e5..ffb9eecbcb 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -47,13 +47,16 @@ void render_layer_state(void) { bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST); bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST); bool adjust = layer_state_is(_ADJUST); + bool numpad = layer_state_is(_NUMPAD); if(lower){ oled_write_P(PSTR(" Lower "), true); } else if(raise){ oled_write_P(PSTR(" Raise "), true); } else if(adjust){ - oled_write_P(PSTR(" Adjust "), true); + oled_write_P(PSTR(" Adjust "), true); + } else if(numpad) { + oled_write_P(PSTR(" Numpad "), true); } else { oled_write_P(PSTR(" Default"), false); } diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c index 5c6d98ec8f..b4a5e35d13 100644 --- a/users/ninjonas/process_records.c +++ b/users/ninjonas/process_records.c @@ -23,7 +23,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; - // Sends + alt + shift to a keycode to activate shiftit. See: https://github.com/fikovnik/ShiftIt + // Sends Cmd + alt + shift to a keycode to activate shiftit. See: https://github.com/fikovnik/ShiftIt case M_SHFT: if (record->event.pressed) { register_code(KC_LGUI); @@ -98,9 +98,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { copy_paste_timer = timer_read(); } else { if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { - tap_code16(LGUI(KC_C)); // Hold + C + tap_code16(LGUI(KC_C)); // Hold Cmd + C } else { - tap_code16(LGUI(KC_V)); // Tap + V + tap_code16(LGUI(KC_V)); // Tap Cmd + V } } diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c index 0665a1607d..ece95887a7 100644 --- a/users/ninjonas/tap_dances.c +++ b/users/ninjonas/tap_dances.c @@ -1,5 +1,87 @@ #include "ninjonas.h" +//// BEGIN: Advanced Tap Dances +int cur_dance (qk_tap_dance_state_t *state) { + if (state->count == 1) { + if (!state->pressed) { + return SINGLE_TAP; + } else { + return SINGLE_HOLD; + } + } else if (state->count == 2) { + return DOUBLE_TAP; + } + else return 8; +} + +// BEGIN: Copy, Paste, NUMPAD +// https://beta.docs.qmk.fm/features/feature_tap_dance#example-6-using-tap-dance-for-momentary-layer-switch-and-layer-toggle-keys +static tap copy_paste_numpad_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void copy_paste_numpad_finished (qk_tap_dance_state_t *state, void *user_data) { + copy_paste_numpad_tap_state.state = cur_dance(state); + switch (copy_paste_numpad_tap_state.state) { + case SINGLE_TAP: + tap_code16(LGUI(KC_V)); // Tap Cmd + V + break; + case SINGLE_HOLD: + tap_code16(LGUI(KC_C)); // Hold Cmd + C + break; + case DOUBLE_TAP: + if (layer_state_is(_NUMPAD)) { + layer_off(_NUMPAD); + } else { + layer_on(_NUMPAD); + } + break; + } +} + +void copy_paste_numpad_reset (qk_tap_dance_state_t *state, void *user_data) { + copy_paste_numpad_tap_state.state = 0; +} +// END: Copy, Paste, NUMPAD + +// BEGIN: Y, NUMPAD +static tap y_numpad_tap_state = { + .is_press_action = true, + .state = 0 +}; + +void y_numpad_finished (qk_tap_dance_state_t *state, void *user_data) { + y_numpad_tap_state.state = cur_dance(state); + switch (y_numpad_tap_state.state) { + case SINGLE_TAP: + tap_code(KC_Y); + break; + case SINGLE_HOLD: + register_code16(KC_Y); + break; + case DOUBLE_TAP: + if (layer_state_is(_NUMPAD)) { + layer_off(_NUMPAD); + } else { + layer_on(_NUMPAD); + } + break; + } +} + +void y_numpad_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (y_numpad_tap_state.state) { + case SINGLE_HOLD: + unregister_code16(KC_Y); + break; + } + y_numpad_tap_state.state = 0; +} +// END: Y, NUMPAD + +//// END: Advanced Tap Dances + qk_tap_dance_action_t tap_dance_actions[] = { [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS), [TD_LBRC_BACK] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, LGUI(KC_LBRC)), @@ -9,4 +91,8 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), [TD_W_CTRLW] = ACTION_TAP_DANCE_DOUBLE(KC_W, LGUI(KC_W)), [TD_Q_GUIQ] = ACTION_TAP_DANCE_DOUBLE(KC_Q, LGUI(KC_Q)), + + // Advanced Tap Dances + [TD_COPY_PASTE_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_numpad_finished, copy_paste_numpad_reset), + [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset), };
\ No newline at end of file diff --git a/users/ninjonas/tap_dances.h b/users/ninjonas/tap_dances.h index 0a781ce4ed..f2f39108dc 100644 --- a/users/ninjonas/tap_dances.h +++ b/users/ninjonas/tap_dances.h @@ -1,6 +1,17 @@ #pragma once #include "ninjonas.h" +typedef struct { + bool is_press_action; + int state; +} tap; + +enum tapdance_types{ + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3 +}; + enum custom_tapdances{ TD_ESC_CAPS = 0, TD_LBRC_BACK, @@ -10,13 +21,17 @@ enum custom_tapdances{ TD_GUI_GUISPC, TD_W_CTRLW, TD_Q_GUIQ, + TD_COPY_PASTE_NUMPAD, + TD_Y_NUMPAD, }; #define T_ESC TD(TD_ESC_CAPS) // Tap for ESC, double tap for CAPSLOCK #define T_LBRC TD(TD_LBRC_BACK) // Tap for [, double tap for back browser #define T_RBRC TD(TD_RBRC_FWD) // Tap for ], double tap for forward browser #define T_TAB TD(TD_TAB_CTRLTAB) // Tap for TAB, double tap for CTRL + TAB -#define T_GRV TD(TD_GRV_CTRLGRV) // Tap for GRV, double tap for + GRV -#define T_GUI TD(TD_GUI_GUISPC) // Tap for , double tap for + Space -#define T_W TD(TD_W_CTRLW) // Tap for W, double tap for + W -#define T_Q TD(TD_Q_GUIQ) // Tap for Q, double tap for + Q
\ No newline at end of file +#define T_GRV TD(TD_GRV_CTRLGRV) // Tap for GRV, double tap for Cmd + GRV +#define T_GUI TD(TD_GUI_GUISPC) // Tap for Cmd, double tap for Cmd + Space +#define T_W TD(TD_W_CTRLW) // Tap for W, double tap for Cmd + W +#define T_Q TD(TD_Q_GUIQ) // Tap for Q, double tap for Cmd + Q +#define T_CPNU TD(TD_COPY_PASTE_NUMPAD) // Tap for paste, hold for copy, double tap for NUMPAD +#define T_Y TD(TD_Y_NUMPAD) // Tap for Y, double tap for NUMPAD
\ No newline at end of file |