diff options
author | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
---|---|---|
committer | William Chang <william@factual.com> | 2019-11-20 22:17:07 -0800 |
commit | e7f4d56592b3975c38af329e77b4efd9108495e8 (patch) | |
tree | 0a416bccbf70bfdbdb9ffcdb3bf136b47378c014 /users/ninjonas | |
parent | 71493b2f9bbd5f3d18373c518fa14ccafcbf48fc (diff) | |
parent | 8416a94ad27b3ff058576f09f35f0704a8b39ff3 (diff) | |
download | firmware-e7f4d56592b3975c38af329e77b4efd9108495e8.tar.gz firmware-e7f4d56592b3975c38af329e77b4efd9108495e8.tar.bz2 firmware-e7f4d56592b3975c38af329e77b4efd9108495e8.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'users/ninjonas')
-rw-r--r-- | users/ninjonas/.gitignore | 1 | ||||
-rw-r--r-- | users/ninjonas/README.md | 109 | ||||
-rw-r--r-- | users/ninjonas/config.h | 14 | ||||
-rw-r--r-- | users/ninjonas/ninjonas.c | 20 | ||||
-rw-r--r-- | users/ninjonas/ninjonas.h | 136 | ||||
-rw-r--r-- | users/ninjonas/oled.c | 91 | ||||
-rw-r--r-- | users/ninjonas/process_records.c | 117 | ||||
-rw-r--r-- | users/ninjonas/process_records.h | 30 | ||||
-rw-r--r-- | users/ninjonas/rules.mk | 13 | ||||
-rw-r--r-- | users/ninjonas/tap_dances.c | 12 | ||||
-rw-r--r-- | users/ninjonas/tap_dances.h | 22 |
11 files changed, 565 insertions, 0 deletions
diff --git a/users/ninjonas/.gitignore b/users/ninjonas/.gitignore new file mode 100644 index 000000000..c6df8c013 --- /dev/null +++ b/users/ninjonas/.gitignore @@ -0,0 +1 @@ +secrets.c diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md new file mode 100644 index 000000000..1e3fe9c31 --- /dev/null +++ b/users/ninjonas/README.md @@ -0,0 +1,109 @@ +# QMK User Configuration for [ninjonas](https://github.com/ninjonas/qmk-yonas) +Tired of copying and pasting the same macros and tap dances for all my keymaps. Utilizing user keymaps functionality. +See: https://docs.qmk.fm/#/feature_userspace + +## [ninjonas.c](ninjonas.c) +- ninjonas [QMK user configuration](https://github.com/qmk/qmk_firmware/blob/master/docs/feature_userspace.md) +- On `keymap.c` include `ninjonas.h` + ```c + #include "ninjonas.h" + ``` + +## Supported Keyboards +- [Crkbd ](../../keyboards/crkbd/keymaps/ninjonas) +- [Hotdox](../../keyboards/hotdox/keymaps/ninjonas) +- [Pinky3](../../keyboards/pinky/3/keymaps/ninjonas) +- [Lily58](../../keyboards/lily58/keymaps/ninjonas) + +## Features +### [Keys](ninjonas.h#L37) +|Code | Description | +|---|---| +|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 | +|K_LAPP | MacOS shortcut to switch apps to the left | + +### [Layers](ninjonas.h#L44) +|Code | Description | +|---|---| +|LT_LOW | Tap for ENTER, hold for RAISE | +|LT_RAI | Tap for SPACE, hold for LOWER | +|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 | + +### [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 | +|---|---| +|QWERTY | Qwerty Layout | +|DVORAK | Dvorak Layout | +|COLEMAK | Colemak Layout | +|NUM | Number Rows | +|FUNC | Function Rows | +|SYM | Symbol Rows \(When holding shift on numbers\) | +|NAV | Navigation Cluster | +|MOUSE | Mouse Cluster | +|MEDIA | Media Cluster | +|MOD | Modifier Cluster | + +### [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_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) +|Code | Description | +|---|---| +|T_ESC | Tap once for ESC, double tap for CAPS_LOCK | +|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 | + +### 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. + +```c +// secrets.c +#include "ninjonas.h" + +static const char * const secret[] = { + "BLANK1", + "BLANK2", + "BLANK3", + "BLANK4", + "BLANK5" +}; + +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case M_XXX1...M_XXX5: + if (record->event.pressed) { + send_string(secret[keycode - M_XXX1]); + } + break; + } + return true; +} + +```
\ No newline at end of file diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h new file mode 100644 index 000000000..1166939c6 --- /dev/null +++ b/users/ninjonas/config.h @@ -0,0 +1,14 @@ +#ifdef TAPPING_TERM + #undef TAPPING_TERM + #define TAPPING_TERM 200 +#endif + +// Mouse Settings: Smoothing out mouse movement on keypress +#ifndef MOUSEKEY_INTERVAL + #undef MOUSEKEY_INTERVAL + #define MOUSEKEY_INTERVAL 16 +#endif +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 +#define MOUSEKEY_WHEEL_DELAY 0
\ No newline at end of file diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c new file mode 100644 index 000000000..49e12e482 --- /dev/null +++ b/users/ninjonas/ninjonas.c @@ -0,0 +1,20 @@ +/* Copyright 2019 @ninjonas + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include "ninjonas.h" + +layer_state_t layer_state_set_user (layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +}
\ No newline at end of file diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h new file mode 100644 index 000000000..b86ccc733 --- /dev/null +++ b/users/ninjonas/ninjonas.h @@ -0,0 +1,136 @@ +/* Copyright 2019 @ninjonas + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once +#include "quantum.h" +#include "version.h" +#include "eeprom.h" +#include "process_records.h" + +#ifdef TAP_DANCE_ENABLE + #include "tap_dances.h" +#endif +#if defined(KEYBOARD_lily58_rev1) & defined(PROTOCOL_LUFA) + #include "lufa.h" + #include "split_util.h" +#endif + +#define _QWERTY 0 +#define _DVORAK 1 +#define _COLEMAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 5 + +// 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_MDSH LSFT(LALT(KC_MINS)) +#define K_LAPP SGUI(KC_TAB) // + Shift + Tab +#define K_RAPP LGUI(KC_TAB) // + Tab + +// Layer Keys +#define LM_LOW MO(_LOWER) +#define LM_RAI MO(_RAISE) +#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 +#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_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 + +#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_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 _____________________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 +#define _____________________COLEMAK_L3_____________________ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B + +#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, 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 + +#define _____________________FUNC_LEFT______________________ KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 +#define _____________________FUNC_RIGHT_____________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12 + +#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 _____________________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 + +#define _____________MOUSE_1______________ KC_BTN1, KC_MS_U, KC_BTN2, KC_WH_D +#define _____________MOUSE_2______________ KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_U + +#define __________________________________ _______, _______, _______, _______ + +#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 + #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__) +#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)
\ No newline at end of file diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c new file mode 100644 index 000000000..721038e15 --- /dev/null +++ b/users/ninjonas/oled.c @@ -0,0 +1,91 @@ +#include QMK_KEYBOARD_H +#include <stdio.h> +#include "ninjonas.h" + +#ifdef OLED_DRIVER_ENABLE + +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_read32(); + } + return true; +} + +void render_default_layer_state(void) { + oled_write_P(PSTR("Layout: "), false); + switch (biton32(default_layer_state)) { + case _COLEMAK: + oled_write_P(PSTR("Colemak"), false); + break; + case _DVORAK: + oled_write_P(PSTR("Dvorak"), false); + break; + case _QWERTY: + oled_write_P(PSTR("Qwerty"), false); + break; + default: + oled_write_ln_P(PSTR("Undefined"), 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)); +} + +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)); +} + +void render_status(void){ + render_default_layer_state(); + oled_write_P(PSTR("\n"), false); + render_layer_state(); + render_mod_status(get_mods()|get_oneshot_mods()); +} + +static void render_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + + oled_write_P(qmk_logo, false); +} + +void oled_task_user(void) { + if (timer_elapsed32(oled_timer) > 30000) { + oled_off(); + return; + } + #ifndef SPLIT_KEYBOARD + else { oled_on(); } + #endif + + if (is_master) { + render_status(); + } else { + render_logo(); + oled_write_P(PSTR("\n"), false); + oled_scroll_left(); + } +} + +#endif
\ No newline at end of file diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c new file mode 100644 index 000000000..8044b49f1 --- /dev/null +++ b/users/ninjonas/process_records.c @@ -0,0 +1,117 @@ +#include "ninjonas.h" + +__attribute__((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } + +__attribute__((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } + +#ifdef OLED_DRIVER_ENABLE +__attribute__((weak)) +bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; } +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + // Sends pyenv to activate 'jira' environment + case M_PYNV: + if (record->event.pressed) { + SEND_STRING("pyenv activate jira\n"); + } + break; + + // Sends + 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); + register_code(KC_LALT); + register_code(KC_LCTL); + } else { + unregister_code(KC_LGUI); + unregister_code(KC_LALT); + unregister_code(KC_LCTL); + } + break; + + // Sends QMK make command to compile keyboard + case M_MAKE: + if (record->event.pressed) { + SEND_STRING("rm -f *.hex && rm -rf .build/ && make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER)); + } + break; + + // 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"); + } + break; + + // Sends QMK make command with the correct bootloader + case M_FLSH: + if (!record->event.pressed) { + SEND_STRING("rm -f *.hex && rm -rf .build/ && make " QMK_KEYBOARD ":" QMK_KEYMAP + #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu " + #elif defined(BOOTLOADER_CATERINA) + ":avrdude " + #endif + SS_TAP(X_ENTER) + ); + + // Send reset_keyboard command instead of pressing reset button + #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + reset_keyboard(); + #endif + } + break; + + // Sends QMK version + case M_VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); + } + break; + + // Opens Visual Studio Code on current directory + case M_CODE: + if (record->event.pressed) { + 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; + + // BEGIN: Layer macros + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + break; + // END: Layer macros + } + + 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 new file mode 100644 index 000000000..2e69ca216 --- /dev/null +++ b/users/ninjonas/process_records.h @@ -0,0 +1,30 @@ +#pragma once +#include "ninjonas.h" + +enum custom_keycodes { + // Layer Macros + QWERTY = SAFE_RANGE, + DVORAK, + COLEMAK, + // Custom Macros + M_PYNV, + M_SHFT, + M_MAKE, + M_MALL, + M_FLSH, + M_VRSN, + M_CODE, + M_TERM, + // Secret Macros + M_XXX1, + M_XXX2, + M_XXX3, + M_XXX4, + M_XXX5, +}; + +bool process_record_secrets(uint16_t keycode, keyrecord_t *record); +bool process_record_keymap(uint16_t keycode, keyrecord_t *record); +#ifdef OLED_DRIVER_ENABLE +bool process_record_oled(uint16_t keycode, keyrecord_t *record); +#endif diff --git a/users/ninjonas/rules.mk b/users/ninjonas/rules.mk new file mode 100644 index 000000000..7b77e153d --- /dev/null +++ b/users/ninjonas/rules.mk @@ -0,0 +1,13 @@ +BOOTMAGIC_ENABLE = no # Disable Boot Magic (https://beta.docs.qmk.fm/features/feature_bootmagic) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +TAP_DANCE_ENABLE = yes # Enable Tap Dance. + +SRC += ninjonas.c \ + process_records.c \ + tap_dances.c \ + oled.c + +ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") + SRC += secrets.c +endif
\ No newline at end of file diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c new file mode 100644 index 000000000..0665a1607 --- /dev/null +++ b/users/ninjonas/tap_dances.c @@ -0,0 +1,12 @@ +#include "ninjonas.h" + +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)), + [TD_RBRC_FWD] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, LGUI(KC_RBRC)), + [TD_TAB_CTRLTAB] = ACTION_TAP_DANCE_DOUBLE(KC_TAB, LCTL(KC_TAB)), + [TD_GRV_CTRLGRV] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, LGUI(KC_GRV)), + [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)), +};
\ No newline at end of file diff --git a/users/ninjonas/tap_dances.h b/users/ninjonas/tap_dances.h new file mode 100644 index 000000000..0a781ce4e --- /dev/null +++ b/users/ninjonas/tap_dances.h @@ -0,0 +1,22 @@ +#pragma once +#include "ninjonas.h" + +enum custom_tapdances{ + TD_ESC_CAPS = 0, + TD_LBRC_BACK, + TD_RBRC_FWD, + TD_TAB_CTRLTAB, + TD_GRV_CTRLGRV, + TD_GUI_GUISPC, + TD_W_CTRLW, + TD_Q_GUIQ, +}; + +#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 |