diff options
author | Joshua T <replicaJunction@users.noreply.github.com> | 2018-08-15 17:38:41 -0500 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2018-08-15 15:38:41 -0700 |
commit | c19d949b72844120fff5159bc7e637ada4dd2579 (patch) | |
tree | 834d410b135352015a887d6f5fc94feefd96b726 /users | |
parent | 632287535c83e6607de97a5998713def61dc01bc (diff) |
Keymap: Revamp replicaJunction keymaps (#3589)
* Revamp replicaJunction keymaps
Updates both the replicaJunction Ergodox and Atreus keymaps and moves
most of the logic into a new user directory.
* Cleanup as requested in #3589
* Slightly increased TAPPING_TERM
* Fixed typo in #pragma once
* Fix TAPPING_TERM redefined in config.h
* Add include of replicaJunction.h
Due to the tap dance references, without this include, I was getting
compiler errors about both internal QMK items like
`qk_tap_dance_state_t` and constants defined in my replicaJunction.h
file like TD_LAYER_TOGGLE.
Also remove some commented-out code that defined an enum which has since
moved to replicaJunction.h.
Diffstat (limited to 'users')
-rw-r--r-- | users/replicaJunction/config.h | 72 | ||||
-rw-r--r-- | users/replicaJunction/readme.md | 14 | ||||
-rw-r--r-- | users/replicaJunction/replicaJunction.c | 149 | ||||
-rw-r--r-- | users/replicaJunction/replicaJunction.h | 115 | ||||
-rw-r--r-- | users/replicaJunction/rules.mk | 1 |
5 files changed, 351 insertions, 0 deletions
diff --git a/users/replicaJunction/config.h b/users/replicaJunction/config.h new file mode 100644 index 0000000000..f3556c87ed --- /dev/null +++ b/users/replicaJunction/config.h @@ -0,0 +1,72 @@ +#pragma once + + +//////////////////////////////////////////////////////////////////////////////// +// Features That Can Be Enabled +// https://docs.qmk.fm/reference/config-options#features-that-can-be-enabled +//////////////////////////////////////////////////////////////////////////////// + +// Prevent modifiers from sticking when switching layers +// Uses 5 bytes of memory per 8 keys, but makes sure modifiers don't get "stuck" switching layers +#define PREVENT_STUCK_MODIFIERS + + + +//////////////////////////////////////////////////////////////////////////////// +// Behaviors That Can Be Configured +// https://docs.qmk.fm/reference/config-options#behaviors-that-can-be-configured +//////////////////////////////////////////////////////////////////////////////// + +// MS the button needs to be held before a tap becomes a hold (default: 200) +#undef TAPPING_TERM +#define TAPPING_TERM 250 + +// Makes it easier for fast typists to use dual-role keys. See additional details here: +// https://docs.qmk.fm/features/advanced-keycodes#permissive-hold +#define PERMISSIVE_HOLD + +// MS after tapping the Leader key to listen for a sequence (default: 300) +#undef LEADER_TIMEOUT +#define LEADER_TIMEOUT 750 + +// This makes it possible to do rolling combos (zx) with keys that convert to other keys on hold +// (for example, if z becomes ctrl when you hold it, when this option isn't enabled, z rapidly +// followed by x actually sends Ctrl-x. That's bad.) +#define IGNORE_MOD_TAP_INTERRUPT + + + +//////////////////////////////////////////////////////////////////////////////// +// Mouse Key Options +// https://docs.qmk.fm/reference/config-options#mouse-key-options +//////////////////////////////////////////////////////////////////////////////// + +#ifdef MOUSEKEY_ENABLE +// Mouse key config + +// Frequency with which cursor movements are sent. Lower means more resolution / DPI. +// Default: 20 +// #undef MOUSEKEY_INTERVAL +// #define MOUSEKEY_INTERVAL 20 + +// MS after pressing the key before initial movement begins. Lower means quicker response. +// Default: 0 +// #undef MOUSEKEY_DELAY +// #define MOUSEKEY_DELAY 0 + +// MS it takes the cursor to accelerate to max speed +// Default: 60 +// #undef MOUSEKEY_TIME_TO_MAX +// #define MOUSEKEY_TIME_TO_MAX 60 + +// Maximum speed for the mouse keys +// Default: 7 +// #undef MOUSEKEY_MAX_SPEED +// #define MOUSEKEY_MAX_SPEED 7 + +// Delay before the mouse wheel +// Default: 0 +// #undef MOUSEKEY_WHEEL_DELAY +// #define MOUSEKEY_WHEEL_DELAY 0 + +#endif // MOUSEKEY_ENABLE diff --git a/users/replicaJunction/readme.md b/users/replicaJunction/readme.md new file mode 100644 index 0000000000..2a9cad2729 --- /dev/null +++ b/users/replicaJunction/readme.md @@ -0,0 +1,14 @@ +Copyright 2018 @<replicaJunction> + +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/>.
\ No newline at end of file diff --git a/users/replicaJunction/replicaJunction.c b/users/replicaJunction/replicaJunction.c new file mode 100644 index 0000000000..f0bc59d257 --- /dev/null +++ b/users/replicaJunction/replicaJunction.c @@ -0,0 +1,149 @@ +#include "replicaJunction.h" +#include "version.h" + +#ifdef TAP_DANCE_ENABLE +void dance_layer(qk_tap_dance_state_t *state, void *user_data) +{ + uint8_t layer = biton32(layer_state); + + if (state->count >= 5) + { + // 5 or more taps resets the keyboard + reset_keyboard(); + } + #ifdef L_QWERTY + else if (state->count == 3) + { + // Triple tap changes to QWERTY layer + if (layer == L_QWERTY) + { + layer_off(L_QWERTY); + } + else + { + layer_on(L_QWERTY); + } + } + #endif + #ifdef L_NUM + else if (state->count == 2) + { + // Double tap toggles Number layer + if (layer == L_NUM) + { + layer_off(L_NUM); + } + else + { + layer_on(L_NUM); + } + } + #endif + else + { + // Single tap sends Escape, and also turns off layers + // That's mostly in case I get stuck and forget where I am + #ifdef L_NUM + layer_off(L_NUM); + #endif + #ifdef L_EXTEND + layer_off(L_EXTEND); + #endif + #ifdef L_SYMBOL + layer_off(L_SYMBOL); + #endif + #ifdef L_QWERTY + layer_off(L_QWERTY); + #endif + register_code(KC_ESC); + unregister_code(KC_ESC); + } +}; + +// Tap Dance Definitions +// Note - this needs to come AFTER the function is declared +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_LAYER_TOGGLE] = ACTION_TAP_DANCE_FN(dance_layer) +}; + +#endif // TAP_DANCE_ENABLE + +// These functions can be overridden in individual keymap files. +// This allows a user function to be shared for all my keyboards, while each +// keyboard can also have a keyboard-specific section. + +// Note that keymaps don't need to override these if there's nothing to +// override them with. +__attribute__ ((weak)) +void matrix_init_keymap(void) {} + +__attribute__ ((weak)) +void matrix_scan_keymap(void) {} + +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + #ifdef UNICODEMAP_ENABLE + // Set Unicode input to use WinCompose + // https://github.com/samhocevar/wincompose + set_unicode_input_mode(UC_WINC); + #endif // UNICODEMAP_ENABLE + + matrix_init_keymap(); +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + matrix_scan_keymap(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) + return true; + + switch(keycode) + { + case RJ_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP + #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu" + #elif defined(BOOTLOADER_HALFKAY) + ":teensy" + #elif defined(BOOTLOADER_CATERINA) + ":avrdude" + #endif // bootloader options + //SS_TAP(X_ENTER) + ); + return false; + case RJ_QMKV: + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + return false; + case RJ_EQ: + SEND_STRING("=="); + return false; + case RJ_NEQ: + SEND_STRING("!="); + return false; + case RJ_GEQ: + SEND_STRING(">="); + return false; + case RJ_LEQ: + SEND_STRING("<="); + return false; + case RJ_GEQR: + SEND_STRING("=>"); + return false; + case RJ_DUND: + SEND_STRING("$_"); + return false; + case RJ_SELS: + SEND_STRING("select *"); + return false; + } + + return process_record_keymap(keycode, record); +}; diff --git a/users/replicaJunction/replicaJunction.h b/users/replicaJunction/replicaJunction.h new file mode 100644 index 0000000000..ab0e8ab3e3 --- /dev/null +++ b/users/replicaJunction/replicaJunction.h @@ -0,0 +1,115 @@ +#pragma once + +#include "quantum.h" + +/////////////////////////////////////////////////////////////////////////////// +// Keymap definitions +/////////////////////////////////////////////////////////////////////////////// + +// Layer definitions +// #define L_COLEMAK 0 +// #define L_QWERTY 1 +// #define L_NUM 2 +// #define L_EXTEND 3 +// #define L_FUNC 4 +// #define L_GAMING 5 +// #define L_SYMBOL 6 +// #define L_LL_R 7 +// #define L_LL_S 8 +// #define L_LL_E 9 +// #define L_LL_I 10 + +// Keyboard aliases +#define _______ KC_TRNS +#define ooooooo KC_TRNS + +#define MO_FUNC MO(L_FUNC) +#define TT_NUM TT(L_NUM) +#define TG_GAME TG(L_GAMING) +#define OSL_SYM OSL(L_SYMBOL) + +#define OSM_LSF OSM(MOD_LSFT) +#define OSM_RSF OSM(MOD_RSFT) + +#define KX_CTSF LCTL(KC_LSFT) +#define KX_STAB LSFT(KC_TAB) +#define KX_CGR LCTL(KC_GRV) +#define KX_PAST LCTL(LGUI(LALT(KC_V))) +#define KX_SRCH LCTL(LGUI(LALT(KC_S))) + +#define KX_BKNM LT(L_NUM, KC_BSPC) +#define KX_DCTL CTL_T(KC_DEL) +#define KX_NALT ALT_T(KC_ENT) +#define KX_ECTL CTL_T(KC_ESC) +#define KX_SPAC LT(L_EXTEND, KC_SPC) + +#define KX_Z_MT CTL_T(KC_Z) +#define KX_X_MT GUI_T(KC_X) +#define KX_C_MT MT(MOD_LCTL | MOD_LALT, KC_C) +#define KX_D_MT ALT_T(KC_D) + +#define KX_SLMT CTL_T(KC_SLSH) +#define KX_DOMT GUI_T(KC_DOT) +#define KX_COMT MT(MOD_LCTL | MOD_LALT, KC_COMM) +#define KX_H_MT ALT_T(KC_H) + +#ifdef L_LL_R + #define KC_R_LT LT(L_LL_R, KC_R) +#else + #define KC_R_LT KC_R +#endif + +#ifdef L_LL_S + #define KC_S_LT LT(L_LL_S, KC_S) +#else + #define KC_S_LT KC_S +#endif + +#ifdef L_LL_E + #define KC_E_LT LT(L_LL_E, KC_E) +#else + #define KC_E_LT KC_E +#endif + +#ifdef L_LL_I + #define KC_I_LT LT(L_LL_I, KC_I) +#else + #define KC_I_LT KC_I +#endif + +// "Macro" functions +enum userspace_custom_keycodes { + RJ_MAKE = SAFE_RANGE, // QMK make command + RJ_QMKV, // QMK version + RJ_EQ, // == + RJ_NEQ, // != + RJ_GEQ, // >= + RJ_LEQ, // <= + RJ_GEQR, // => ("greater than or equal - right") + RJ_DUND, // $_ + RJ_SELS, // select * (used for PowerShell) + RJ_MUTE, // Discord mute (GUI+Shift+M) + RJ_DEAF, // Discord deafen (GUI+Shift+D) + RJ_DOVR // Toggle Discord overlay (GUI+Shift+O) +}; + +// Mouse keys +#define M_UP KC_MS_UP +#define M_DOWN KC_MS_DOWN +#define M_LEFT KC_MS_LEFT +#define M_RIGHT KC_MS_RIGHT +#define M_LCLIK KC_MS_BTN1 +#define M_RCLIK KC_MS_BTN2 +#define M_MCLIK KC_MS_BTN3 +#define M_WHLUP KC_WH_U +#define M_WHLDN KC_WH_D + +// Used in macro definitions +#define TAP(code) register_code (code); unregister_code (code); + +// Tap Dance +#ifdef TAP_DANCE_ENABLE +#define TD_LAYER_TOGGLE 0 +extern void dance_layer(qk_tap_dance_state_t *state, void *user_data); +#define TD_LAYR TD(TD_LAYER_TOGGLE) +#endif // TAP_DANCE_ENABLE diff --git a/users/replicaJunction/rules.mk b/users/replicaJunction/rules.mk new file mode 100644 index 0000000000..30a330195d --- /dev/null +++ b/users/replicaJunction/rules.mk @@ -0,0 +1 @@ +SRC += replicaJunction.c |