diff --git a/keyboards/atreus/keymaps/replicaJunction/config.h b/keyboards/atreus/keymaps/replicaJunction/config.h index 8e786aa0d..a02f9a95d 100644 --- a/keyboards/atreus/keymaps/replicaJunction/config.h +++ b/keyboards/atreus/keymaps/replicaJunction/config.h @@ -1,11 +1,51 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + #pragma once -// Layer definitions +// Do not allow one macro to contain the other macro +#define DYNAMIC_MACRO_NO_NESTING -#define L_COLEMAK 0 -#define L_NUM 1 -#define L_EXTEND 2 -#define L_FUNC 3 -#define L_LL_R 4 -#define L_LL_E 5 -#define L_LL_I 6 +// "THE most important tap hold configuration setting" +// https://precondition.github.io/home-row-mods#ignore-mod-tap-interrupt +// https://docs.qmk.fm/#/tap_hold?id=ignore-mod-tap-interrupt +#define IGNORE_MOD_TAP_INTERRUPT + +// This one is a style choice. Play with it both on and off to see which +// one suits you better. +// https://precondition.github.io/home-row-mods#permissive-hold +// https://docs.qmk.fm/#/tap_hold?id=permissive-hold +#define PERMISSIVE_HOLD + +// If you press a dual-role key for longer than TAPPING_TERM, then +// release it without pressing another key, without this setting nothing +// would happen. With this setting, it sends the key's tap function. +// https://precondition.github.io/home-row-mods#retro-tapping +#define RETRO_TAPPING + +// Disable some unused features to save space +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +///// +// Flags for stuff in my userspace + +#define USER_INCLUDE_GAMING_LAYER +#define USER_INCLUDE_MACRO_LAYER + +// "Super Alt-Tab" +// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab +#define USER_SUPER_ALT_TAB_TIMEOUT 500 diff --git a/keyboards/atreus/keymaps/replicaJunction/keymap.c b/keyboards/atreus/keymaps/replicaJunction/keymap.c index c3cc37115..32cc95d2f 100644 --- a/keyboards/atreus/keymaps/replicaJunction/keymap.c +++ b/keyboards/atreus/keymaps/replicaJunction/keymap.c @@ -1,78 +1,95 @@ -/* - * Keyboard: Atreus - * Keymap: replicaJunction - * Version: 2.1 +/* Copyright 2021 Joshua T. + * + * 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 . */ #include QMK_KEYBOARD_H #include "replicaJunction.h" +#define BSP_SYM LT(L_SYMBOLS, KC_BSPC) +#define SPC_NAV LT(L_NAVIGATION, KC_SPC) +#define EQL_FUN LT(L_FN, KC_EQL) + +#define ESC_SFT LSFT_T(KC_ESC) +#define TAB_SFT RSFT_T(KC_TAB) + +#define DF_TYPE DF(L_BASE) +#define DF_GAME DF(L_GAMING) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[L_COLEMAK] = LAYOUT( - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, - KC_A, KC_R_LT, KC_S_LT, KC_T, KC_G, KC_M, KC_N, KC_E_LT, KC_I_LT, KC_O, - KX_Z_MT, KX_X_MT, KX_C_MT, KX_D_MT, KC_V, KC_K, KX_H_MT, KX_COMT, KX_DOMT, KX_SLMT, - TD_LAYR, KC_LGUI, KC_TAB, KC_LSFT, KX_BKNM, KX_DCTL, KX_NALT, KX_SPAC, KC_RSFT, KC_MINS, KC_QUOT, KC_EQL -) -, +[L_BASE] = LAYOUT( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, + KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM,KC_DOT, KC_SLSH, + KC_ESC, KC_LGUI,KC_TAB, ESC_SFT,BSP_SYM,CTL_DEL,ALT_ENT,SPC_NAV,TAB_SFT,KC_MINS,KC_QUOT,EQL_FUN +), -[L_NUM] = LAYOUT( - KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_SLSH, KC_COLN, KC_7, KC_8, KC_9, KC_SLSH, - KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_PIPE, KC_HASH, KC_4, KC_5, KC_6, KC_ASTR, - KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BSLS, KC_BSPC, KC_1, KC_2, KC_3, KC_MINS, - _______, KC_AMPR, KC_TILD, KC_GRV, ooooooo, _______, KC_ENT, MO_FUNC, KC_0, KC_DOT, KC_EQL, KC_PLUS -) -, +[L_GAMING] = LAYOUT( + _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, + _______,_______,KC_C, KC_D, _______, _______,_______,_______,_______,_______, + _______,KC_TAB, KC_LALT,KC_LSFT,KC_SPC, KC_LCTL,KC_LALT,KC_BSPC,KC_BTN1,KC_BTN2,KC_BTN3,_______ +), -[L_EXTEND] = LAYOUT( - _______, _______, _______, KC_APP, KX_CGR, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_DEL, - KC_LGUI, KC_LSFT, KC_LALT, KC_LCTL, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, - _______, _______, _______, KX_SRCH, KX_PAST, _______, KX_STAB, KC_TAB, _______, KC_INS, - _______, _______, _______, _______, MO_FUNC, KC_DEL, KC_ENT, _______, _______, _______, _______, KC_PSCR -) -, +[L_NUMBERS] = LAYOUT( + _______,_______,_______,_______,_______, KC_HASH,KC_7, KC_8, KC_9, KC_SLSH, + _______,_______,_______,_______,_______, KC_PLUS,KC_4, KC_5, KC_6, KC_ASTR, + _______,_______,_______,_______,_______, KC_MINS,KC_1, KC_2, KC_3, KC_BSLS, + _______,_______,_______,_______,_______,_______,_______,_______,KC_0, KC_0, KC_DOT, KC_ENT +), -[L_FUNC] = LAYOUT( - _______, _______, M_LCLIK, M_RCLIK, M_MCLIK, KC_VOLU, KC_F9, KC_F10, KC_F11, KC_F12, - KC_LGUI, KC_LSFT, KC_LALT, KC_LCTL, M_WHLUP, KC_MUTE, KC_F5, KC_F6, KC_F7, KC_F8, - M_LEFT, M_DOWN, M_UP, M_RIGHT, M_WHLDN, KC_VOLD, KC_F1, KC_F2, KC_F3, KC_F4, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -) -, +[L_SYMBOLS] = LAYOUT( + KC_AT, KC_LT, KC_DLR, KC_GT, XXXXXXX, XXXXXXX,KC_LBRC,KC_UNDS,KC_RBRC,XXXXXXX, + KC_BSLS,KC_LPRN,KC_DQUO,KC_RPRN,KC_HASH, KC_PERC,KC_LCBR,KC_EQL, KC_RCBR,KC_PIPE, + KC_EXLM,KC_COLN,KC_ASTR,KC_PLUS,XXXXXXX, XXXXXXX,KC_AMPR,KC_CIRC,KC_TILD,KC_GRV, + _______,_______,_______,_______,ooooooo,_______,_______,ooooooo,CAPWORD,_______,_______,_______ +), -[L_LL_R] = LAYOUT( - _______, _______, _______, _______, _______, KC_COLN, KC_P7, KC_P8, KC_P9, KC_PSLS, - _______, ooooooo, KC_AMPR, KC_PIPE, _______, KC_HASH, KC_P4, KC_P5, KC_P6, KC_PAST, - _______, _______, _______, _______, _______, KC_BSPC, KC_P1, KC_P2, KC_P3, KC_PMNS, - _______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_PLUS -) -, +[L_NAVIGATION] = LAYOUT( + OS_UNDO,OS_CUT, OS_PAST,OS_COPY,OS_SALL, KC_PGUP,KC_HOME,KC_UP, KC_END, KC_DEL, + KC_LGUI,KC_LALT,KC_LSFT,KC_LCTL,_______, KC_PGDN,KC_LEFT,KC_DOWN,KC_RGHT,KC_BSPC, + WIN_V, _______,_______,OS_FIND,SEARCH, _______,SFT_TAB,KC_TAB, KC_APP, KC_PSCR, + _______,_______,_______,NUMWORD,ooooooo,_______,_______,ooooooo,_______,_______,_______,_______ +), -[L_LL_E] = LAYOUT( - RJ_MAKE, RJ_EQ, RJ_LEQ, RJ_GEQ, RJ_GEQR, _______, _______, _______, _______, _______, - _______, _______, RJ_SELS, RJ_DUND, _______, _______, _______, ooooooo, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -) -, +[L_FN] = LAYOUT( + RESET, _______,_______,_______,_______, KC_VOLU,KC_F9, KC_F10, KC_F11, KC_F12, + MS_JIGL,_______,_______,_______,_______, KC_MUTE,KC_F5, KC_F6, KC_F7, KC_F8, + _______,K_SECR1,K_SECR2,K_SECR3,K_SECR4, KC_VOLD,KC_F1, KC_F2, KC_F3, KC_F4, + DF_TYPE,DF_GAME,_______,_______,_______,KC_LCTL,KC_LALT,_______,_______,_______,_______,ooooooo +), -[L_LL_I] = LAYOUT( - KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_SLSH, _______, KC_UNDS, KC_GRV, _______, _______, - KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_PIPE, _______, KC_MINS, KC_QUOT, ooooooo, _______, - KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BSLS, _______, KC_TILD, KC_DQT, _______, _______, - _______, KC_AMPR, KC_LABK, KC_RABK, _______, _______, _______, _______, _______, _______, _______, _______ +[L_MACROS] = LAYOUT( + QK_MAKE,_______,DM_REC2,DM_REC1,DM_RSTP, _______,SHEBANG,_______,_______,_______, + QK_FLSH,_______,DM_PLY2,DM_PLY1,_______, PRG_NE, PRG_EQ, PRG_GEQ,PRG_LEQ,PRG_ARR, + QK_VERS,_______,_______,_______,_______, _______,PS_ITEM,FS_PIPE,_______,FS_ARR, + _______,_______,_______,_______,ooooooo,_______,_______,ooooooo,_______,_______,_______,_______ ) + +// Template +// [L_FUNC] = LAYOUT( +// _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______ +// ), + }; -// Uncomment any of these to add keyboard-specific code. Otherwise, they -// will use user defaults defined in the replicaJunction.h header file. +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, L_SYMBOLS, L_NAVIGATION, L_MACROS); +} -// bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { -// return true; -// } - -// void matrix_init_keymap(void) {}; - -// void matrix_scan_keymap(void) {}; diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/base-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/base-layer.txt deleted file mode 100644 index aec41316f..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/base-layer.txt +++ /dev/null @@ -1,34 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2},"F"], -[{y:-0.65,x:1},"W",{x:1},"P"], -[{y:-0.75},"Q"], -[{y:-0.9,x:4},"B"], -[{y:-0.7,x:2},"S"], -[{y:-0.65,x:1,c:"#45b866"},"R",{x:1,c:"#cccccc"},"T"], -[{y:-0.75},"A"], -[{y:-0.9,x:4},"G"], -[{y:-0.7,x:2},"C\n\n\n"], -[{y:-0.65,x:1},"X\n\n\nCtrl",{x:1},"D\n\n\nCtrlAlt"], -[{y:-0.75},"Z"], -[{y:-0.9,x:4},"V\n\n\nAlt"], -[{y:-0.75,x:5,h:1.5},"Del\nCtrl"], -[{y:-0.95,x:2},"Tab"], -[{y:-0.65,x:1,a:7,fa:[7]},"",{x:1,a:4,f:3},"Shift"], -[{y:-0.75,f:3},"Layer tap"], -[{y:-0.9,x:4,f:3},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2,f:3},"U"], -[{y:-0.65,x:1,f:3},"L",{x:1,f:3},"Y"], -[{y:-0.75,x:4,f:3},":\n;"], -[{y:-0.9,f:3},"J"], -[{y:-0.7,x:2,c:"#ffb07b",f:3},"E"], -[{y:-0.65,x:1,c:"#cccccc",f:3},"N",{x:1,c:"#5dcde3",f:3},"I"], -[{y:-0.75,x:4,c:"#cccccc",f:3},"O"], -[{y:-0.9,f:3},"M"], -[{y:-0.7,x:2,f:3},"<\n,\n\nCtrlAlt"], -[{y:-0.65,x:1,f:3},"H\n\n\nAlt",{x:1,f:3},">\n.\n\n"], -[{y:-0.75,x:4,f:3},"?\n/\n\nCtrl"], -[{y:-0.9,f:3},"K"], -[{y:-0.75,x:-1,f:3,h:1.5},"Enter\nAlt"], -[{y:-0.95,x:2,f:3},"_\n-"], -[{y:-0.65,x:1,f:3},"Shift",{x:1,f:3},"\"\n'"], -[{y:-0.75,x:4,f:3},"+\n="], -[{y:-0.9,c:"#ffe08d",f:3},"Space"] diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/e-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/e-layer.txt deleted file mode 100644 index 2b4105b2b..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/e-layer.txt +++ /dev/null @@ -1,34 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2},"<="], -[{y:-0.65,x:1},"==",{x:1},">="], -[{y:-0.75},"make"], -[{y:-0.9,x:4},"=>"], -[{y:-0.7,x:2},"select *"], -[{y:-0.65,x:1,a:7},"",{x:1,a:4},"$_"], -[{y:-0.75,a:7},""], -[{y:-0.9,x:4},""], -[{y:-0.7,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{y:-0.75,x:5,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""], -[{y:-0.7,x:2,c:"#ffb07b"},""], -[{y:-0.65,x:1,c:"#cccccc"},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""], -[{y:-0.7,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""], -[{y:-0.75,x:-1,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""] diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/fn-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/fn-layer.txt deleted file mode 100644 index d45fb7e97..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/fn-layer.txt +++ /dev/null @@ -1,35 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2},"RClick"], -[{y:-0.65,x:1,a:7},"",{x:1,a:4},"LClick"], -[{y:-0.75,a:7},""], -[{y:-0.9,x:4,a:4},"MClick"], -[{y:-0.7,x:2},"Alt"], -[{y:-0.65,x:1},"Shift",{x:1},"Ctrl"], -[{y:-0.75,a:7,fa:[7]},""], -[{y:-0.9,x:4,a:4,fa:[5,0,0,0,0,0,0,0,0,0,7]},"\n\n\n\n\n\n\n\n\n\n"], -[{y:-0.7,x:2,fa:[0,0,0,0,0,0,0,0,0,0,7]},"\n\n\n\n\n\n\n\n\n\n"], -[{y:-0.65,x:1},"\n\n\n\n\n\n\n\n\n\n",{x:1},"\n\n\n\n\n\n\n\n\n\n"], -[{y:-0.75},"\n\n\n\n\n\n\n\n\n\n"], -[{y:-0.9,x:4,fa:[5,0,0,0,0,0,0,0,0,0,7]},"\n\n\n\n\n\n\n\n\n\n"], -[{y:-0.75,x:5,a:7,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4,c:"#ffe08d"},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2,c:"#cccccc",a:4,f:3},"F10"], -[{y:-0.65,x:1,f:3},"F9",{x:1,f:3},"F11"], -[{y:-0.75,x:4,f:3},"F12"], -[{y:-0.9,a:7},""], -[{y:-0.7,x:2,a:4,f:3},"F6"], -[{y:-0.65,x:1,f:3},"F5",{x:1,f:3},"F7"], -[{y:-0.75,x:4,f:3},"F8"], -[{y:-0.9,a:7},""], -[{y:-0.7,x:2,a:4,f:3},"F2"], -[{y:-0.65,x:1,f:3},"F1",{x:1,f:3},"F3"], -[{y:-0.75,x:4,f:3},"F4"], -[{y:-0.9,a:7},""], -[{y:-0.75,x:-1,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9,c:"#ffe08d"},""] - diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/i-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/i-layer.txt deleted file mode 100644 index 45bef783a..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/i-layer.txt +++ /dev/null @@ -1,34 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2},"{"], -[{y:-0.65,x:1},"@",{x:1},"}"], -[{y:-0.75},"!"], -[{y:-0.9,x:4},"/"], -[{y:-0.7,x:2},"("], -[{y:-0.65,x:1},"$",{x:1},")"], -[{y:-0.75},"#"], -[{y:-0.9,x:4},"|"], -[{y:-0.7,x:2},"["], -[{y:-0.65,x:1},"^",{x:1},"]"], -[{y:-0.75},"%"], -[{y:-0.9,x:4},"\\"], -[{y:-0.75,x:5,a:7,h:1.5},""], -[{y:-0.95,x:2,a:4},"<"], -[{y:-0.65,x:1},"&",{x:1},">"], -[{y:-0.75,a:7},""], -[{y:-0.9,x:4},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2,a:4},"`"], -[{y:-0.65,x:1},"_",{x:1,a:7},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""], -[{y:-0.7,x:2,a:4},"'"], -[{y:-0.65,x:1},"-",{x:1,c:"#5dcde3",a:7},""], -[{y:-0.75,x:4,c:"#cccccc"},""], -[{y:-0.9},""], -[{y:-0.7,x:2,a:4},"\""], -[{y:-0.65,x:1},"~",{x:1,a:7},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""], -[{y:-0.75,x:-1,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4},""], -[{y:-0.9},""] diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/r-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/r-layer.txt deleted file mode 100644 index 3d4438386..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/r-layer.txt +++ /dev/null @@ -1,34 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2,a:7},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{y:-0.7,x:2,a:4},"&"], -[{y:-0.65,x:1,c:"#45b866",a:7},"",{x:1,c:"#cccccc",a:4},"|"], -[{y:-0.75,a:7},""], -[{y:-0.9,x:4},""], -[{y:-0.7,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{y:-0.75,x:5,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2,a:4},"8"], -[{y:-0.65,x:1},"7",{x:1},"9"], -[{y:-0.75,x:4},"/"], -[{y:-0.9},":"], -[{y:-0.7,x:2},"5"], -[{y:-0.65,x:1},"4",{x:1},"6"], -[{y:-0.75,x:4},"*"], -[{y:-0.9},"#"], -[{y:-0.7,x:2},"2"], -[{y:-0.65,x:1},"1",{x:1},"3"], -[{y:-0.75,x:4},"-"], -[{y:-0.9},""], -[{y:-0.75,x:-1,a:7,h:1.5},""], -[{y:-0.95,x:2,a:4},"."], -[{y:-0.65,x:1},"0",{x:1},"="], -[{y:-0.75,x:4},"+"], -[{y:-0.9},"Space"] diff --git a/keyboards/atreus/keymaps/replicaJunction/kle/space-layer.txt b/keyboards/atreus/keymaps/replicaJunction/kle/space-layer.txt deleted file mode 100644 index d1ffa35f8..000000000 --- a/keyboards/atreus/keymaps/replicaJunction/kle/space-layer.txt +++ /dev/null @@ -1,34 +0,0 @@ -[{r:10,rx:1,y:-0.1,x:2,a:7},""], -[{y:-0.65,x:1},"",{x:1,fa:[7]},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{y:-0.7,x:2,a:4,f:3},"Alt"], -[{y:-0.65,x:1,f:3},"Shift",{x:1,f:3},"Ctrl"], -[{y:-0.75,a:7},""], -[{y:-0.9,x:4},""], -[{y:-0.7,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{y:-0.75,x:5,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75},""], -[{y:-0.9,x:4},""], -[{r:-10,rx:7,ry:0.965,y:-0.2,x:2},""], -[{y:-0.65,x:1,a:4,f:3},"Home",{x:1,f:3},"End"], -[{y:-0.75,x:4,f:3},"Delete"], -[{y:-0.9,f:3},"PgUp"], -[{y:-0.7,x:2,a:7},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4,a:4,f:3},"Bksp"], -[{y:-0.9,f:3},"PgDn"], -[{y:-0.7,x:2,f:3},"Tab"], -[{y:-0.65,x:1,f:3},"Shift+\n\n\n\n\n\nTab",{x:1,a:7},""], -[{y:-0.75,x:4,a:4,f:3},"Insert"], -[{y:-0.9,a:7},""], -[{y:-0.75,x:-1,h:1.5},""], -[{y:-0.95,x:2},""], -[{y:-0.65,x:1},"",{x:1},""], -[{y:-0.75,x:4,a:4,f:3},"Prnt Scrn"], -[{y:-0.9,c:"#ffe08d",a:7},""] diff --git a/keyboards/atreus/keymaps/replicaJunction/readme.md b/keyboards/atreus/keymaps/replicaJunction/readme.md index f1d6c47b1..6aa356f4f 100644 --- a/keyboards/atreus/keymaps/replicaJunction/readme.md +++ b/keyboards/atreus/keymaps/replicaJunction/readme.md @@ -1,103 +1,7 @@ # replicaJunction - Atreus Layout -This layout is designed to make the absolute most out of the Atreus 40% keyboard. +I no longer actively use this keyboard. I've replaced it with the [Keyboardio Atreus](../../../keyboardio/atreus/keymaps/replicaJunction/readme.md). -This layout is probably not perfect for you. That's okay! Use it for ideas as you design your own perfect layout. +I still try to make sure the layout compiles, but I'm no longer tweaking it or adding new features. -Most of the custom logic in this keyboard is actually not in these files. Instead, it's in the directory `/users/replicaJunction` (from the root of the QMK repo). This allows me to share macros and custom logic between multiple keyboards. A `process_record_keyboard()` function defined weakly in `replicaJunction.h` allows keyboards to process records individually as well without overriding the `process_record_user()` function. (My Ergodox uses this to handle its LEDs, for example.) - -The default letter layout in this keymap is [Colemak-ModDH](https://colemakmods.github.io/mod-dh/). I use the "matrix version" of that layout, which retains the M key on the home row as in normal Colemak. - -## Design Goals - -I designed this layout with the following goals in mind: - -* Nothing may interfere with ordinary typing. -* Symbols need to be accessible quickly and organized in a manner I can remember. -* Limit more difficult finger movements (and pinky usage in general). - -### Nothing may interfere with ordinary typing - -For a long time, this meant that I couldn't use letters or home row keys as dual-role keys. I'm a fast typer, and I'm sometimes already typing the next letter before I've fully released the previous one. Normal keyboards don't care about this, but if I started adding dual-role functionality to letters, I found that I would sometimes type the next letter before releasing the layer toggle, and the letter I tried to send would still be sent under the layer I thought I'd left off. - -Fortunately, though, QMK has addressed this with the `PERMISSIVE_HOLD` flag. [Details are on the QMK docs page.](https://docs.qmk.fm/#/feature_advanced_keycodes?id=permissive-hold) - -Using that flag, I'm comfortable having layer shift keys on the home row, and this goes a long way to eliminate finger stress. - -### Sympols need to be accessible quickly - -Symbols are available under my left hand by holding the I key (on my right hand). I've grouped parenthesis, slashes, and braces together; the remaining symbols are ordered in the same way as they appear on USA keycap legends (for example, 1 is !, so that symbol is first in my lineup). Practically, I just had to get used to these other "misc" symbols. - -This also means that some symbols are accessible in more than one way. For example, the carats (greater than and less than) are available both in the "normal" location (Shift+Comma / Shift+Period) and on the symbol layer. I make regular changes to some of the symbols I don't use as commonly as I think of them. - -### Limit more difficult finger movements - -This is why I kept trying to put layer toggles on the home row keys instead of just placing them on random thumb keys. I suffer from RSI, and it's important for me to watch out for more "stressful" finger movements. - -The home row is the easiest row for your fingers to hit, followed by the upper row, and the lower row is noticeably more difficult to press. Because of this, I favored the upper row over the lower one any time I had the option to do so. - -## Features - -### ZXC Mods - -Keys on the bottom row of each half of this keyboard can be held to send modifier keys. I've tried to map this in a relatively logical manner: - -* Z / Slash: Ctrl -* X / Period: GUI -* C / Comma: Ctrl+Alt -* D / H: Alt - -Combined with Shift keys on the thumbs, this makes all modifiers quick to access on either hand. - -### Layer tap dance - -The lower-left key on the left hand can be used to apply or remove layers based on a number of taps: - -* 1 tap sends Escape, and also disables any persistent layers. -* 2 taps enables the Number pad layer. -* 5 or more taps resets the keyboard. - -## Extend Layer - -[Originally found on the Colemak forums](https://forum.colemak.com/topic/2014-extend-extra-extreme/), having a QMK-powered keyboard allows a super easy implementation of this concept. The idea is to place commonly-used keys under easy reach of your hands. Since I work with text often, my most common needs are things like Ctrl+Shift+arrow keys, and they're easy to access using this layer. (While technically it's four keypresses instead of just three, since it takes one key to enter the layer, that one key is a thumb button and the other three are all on the home row, so I find it much more comfortable than modifiers on a traditional keyboard.) - -Also featured in this layer is easy access to Tab, plus a Shift+Tab key. Alt-Tabbing back and forth, along with Ctrl-Tab, are super easy and friendly. When I need Ctrl+Alt+Delete, I typically use the ones found on this layer. - -## Layout Images - -Colored keys indicate keys that swap to another layer when held. - -These images are located in the `kle` folder of this directory. Also included is the "raw data" from Keyboard-Layout-Editor in a corresponding text file. - -### Base layer - -![Base layer](kle/base-layer.png) - -### R layer - -![R layer](kle/r-layer.png) - -### E layer - -![E layer](kle/i-layer.png) - -### I layer - -![I layer](kle/i-layer.png) - -### Space layer - -![Space layer](kle/space-layer.png) - -### Function layer - -![Function layer](kle/fn-layer.png) - -## Credits - -* [Drashna](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme.md) - * User / keymap function ideas -* [Jeremy](https://github.com/qmk/qmk_firmware/blob/master/keyboards/atreus/keymaps/jeremy/readme.md) - * Sanity check on the Function keys (_of course they should be in rows of 4, not rows of 3 like a number pad. Why did I ever use anything else?_) -* [DreymaR of the Colemak forums](https://forum.colemak.com/topic/2014-extend-extra-extreme/) - * Original idea of the Extend layer +Most of the interesting features in this layout are defined in [my userspace folder](../../../../users/replicaJunction/readme.md). Refer to the documentation and code there for more details. diff --git a/keyboards/atreus/keymaps/replicaJunction/rules.mk b/keyboards/atreus/keymaps/replicaJunction/rules.mk index 9ff9c3fbb..13730aec6 100644 --- a/keyboards/atreus/keymaps/replicaJunction/rules.mk +++ b/keyboards/atreus/keymaps/replicaJunction/rules.mk @@ -1,12 +1,28 @@ -# https://docs.qmk.fm/getting_started_make_guide.html +# Userspace options +USER_CAPS_WORD_ENABLE = yes +USER_MOUSE_JIGGLE_ENABLE = yes +USER_NUM_WORD_ENABLE = yes +USER_SECRETS_ENABLE = yes -MOUSEKEY_ENABLE = yes -TAP_DANCE_ENABLE = yes -# KEY_LOCK_ENABLE = yes -# CONSOLE_ENABLE = no -# COMMAND_ENABLE = no +DYNAMIC_MACRO_ENABLE = yes -# Use the "Unicode map" method -# UNICODE_ENABLE = no -# UNICODEMAP_ENABLE = yes +# Extra features that are nice but takes space. Enable only if they're +# used in the layout. +WPM_ENABLE = no +# EXTRAKEY_ENABLE = no # For volume keys and similar +# MOUSEKEY_ENABLE = no # Them mouse keys yo +KEY_OVERRIDE_ENABLE = no +LEADER_ENABLE = no +TAP_DANCE_ENABLE = no +# RGBLIGHT_ENABLE = no # Keyboard RGB underglow +RGB_MATRIX_ENABLE = no +# Features I definitely don't care aboud +LTO_ENABLE = yes +CONSOLE_ENABLE = no +VERBOSE = no +DEBUG_MATRIX_SCAN_RATE = no +DEBUG_MATRIX = no +MAGIC_ENABLE = no +SPACE_CADET_ENABLE = no +GRAVE_ESC_ENABLE = no diff --git a/keyboards/keyboardio/atreus/keymaps/replicaJunction/config.h b/keyboards/keyboardio/atreus/keymaps/replicaJunction/config.h new file mode 100644 index 000000000..a02f9a95d --- /dev/null +++ b/keyboards/keyboardio/atreus/keymaps/replicaJunction/config.h @@ -0,0 +1,51 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once + +// Do not allow one macro to contain the other macro +#define DYNAMIC_MACRO_NO_NESTING + +// "THE most important tap hold configuration setting" +// https://precondition.github.io/home-row-mods#ignore-mod-tap-interrupt +// https://docs.qmk.fm/#/tap_hold?id=ignore-mod-tap-interrupt +#define IGNORE_MOD_TAP_INTERRUPT + +// This one is a style choice. Play with it both on and off to see which +// one suits you better. +// https://precondition.github.io/home-row-mods#permissive-hold +// https://docs.qmk.fm/#/tap_hold?id=permissive-hold +#define PERMISSIVE_HOLD + +// If you press a dual-role key for longer than TAPPING_TERM, then +// release it without pressing another key, without this setting nothing +// would happen. With this setting, it sends the key's tap function. +// https://precondition.github.io/home-row-mods#retro-tapping +#define RETRO_TAPPING + +// Disable some unused features to save space +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +///// +// Flags for stuff in my userspace + +#define USER_INCLUDE_GAMING_LAYER +#define USER_INCLUDE_MACRO_LAYER + +// "Super Alt-Tab" +// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab +#define USER_SUPER_ALT_TAB_TIMEOUT 500 diff --git a/keyboards/keyboardio/atreus/keymaps/replicaJunction/keymap.c b/keyboards/keyboardio/atreus/keymaps/replicaJunction/keymap.c new file mode 100644 index 000000000..9e47155f4 --- /dev/null +++ b/keyboards/keyboardio/atreus/keymaps/replicaJunction/keymap.c @@ -0,0 +1,94 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include QMK_KEYBOARD_H +#include "replicaJunction.h" + +#define BSP_SYM LT(L_SYMBOLS, KC_BSPC) +#define SPC_NAV LT(L_NAVIGATION, KC_SPC) +#define EQL_FUN LT(L_FN, KC_EQL) + +#define ESC_SFT LSFT_T(KC_ESC) +#define TAB_SFT RSFT_T(KC_TAB) + +#define DF_TYPE DF(L_BASE) +#define DF_GAME DF(L_GAMING) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[L_BASE] = LAYOUT( + KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, + KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, + KC_Z, KC_X, KC_C, KC_D, KC_V, SALTTAB,KC_BSLS,KC_K, KC_H, KC_COMM,KC_DOT, KC_SLSH, + KC_ESC, KC_LGUI,KC_TAB, ESC_SFT,BSP_SYM,CTL_DEL,ALT_ENT,SPC_NAV,TAB_SFT,KC_MINS,KC_QUOT,EQL_FUN +), + +[L_GAMING] = LAYOUT( + _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, + _______,_______,KC_C, KC_D, _______,_______,KC_LOCK,_______,_______,_______,_______,_______, + _______,KC_TAB, KC_LALT,KC_LSFT,KC_SPC, KC_LCTL,KC_LALT,KC_BSPC,KC_BTN1,KC_BTN2,KC_BTN3,_______ +), + +[L_NUMBERS] = LAYOUT( + _______,_______,_______,_______,_______, KC_HASH,KC_7, KC_8, KC_9, KC_SLSH, + _______,_______,_______,_______,_______, KC_PLUS,KC_4, KC_5, KC_6, KC_ASTR, + _______,_______,_______,_______,_______,_______,_______,KC_MINS,KC_1, KC_2, KC_3, KC_BSLS, + _______,_______,_______,_______,_______,_______,_______,_______,KC_0, KC_0, KC_DOT, KC_ENT +), + +[L_SYMBOLS] = LAYOUT( + KC_AT, KC_LT, KC_DLR, KC_GT, XXXXXXX, XXXXXXX,KC_LBRC,KC_UNDS,KC_RBRC,XXXXXXX, + KC_BSLS,KC_LPRN,KC_DQUO,KC_RPRN,KC_HASH, KC_PERC,KC_LCBR,KC_EQL, KC_RCBR,KC_PIPE, + KC_EXLM,KC_COLN,KC_ASTR,KC_PLUS,XXXXXXX,_______,_______,XXXXXXX,KC_AMPR,KC_CIRC,KC_TILD,KC_GRV, + _______,_______,_______,_______,ooooooo,_______,_______,ooooooo,CAPWORD,_______,_______,_______ +), + +[L_NAVIGATION] = LAYOUT( + OS_UNDO,OS_CUT, OS_PAST,OS_COPY,OS_SALL, KC_PGUP,KC_HOME,KC_UP, KC_END, KC_DEL, + KC_LGUI,KC_LALT,KC_LSFT,KC_LCTL,_______, KC_PGDN,KC_LEFT,KC_DOWN,KC_RGHT,KC_BSPC, + WIN_V, _______,_______,OS_FIND,SEARCH, _______,_______,_______,SFT_TAB,KC_TAB, KC_APP, KC_PSCR, + _______,_______,_______,NUMWORD,ooooooo,_______,_______,ooooooo,_______,_______,_______,_______ +), + +[L_FN] = LAYOUT( + _______,_______,_______,_______,_______, KC_VOLU,KC_F9, KC_F10, KC_F11, KC_F12, + _______,_______,_______,_______,_______, KC_MUTE,KC_F5, KC_F6, KC_F7, KC_F8, + _______,K_SECR1,K_SECR2,K_SECR3,K_SECR4,MS_JIGL,RESET, KC_VOLD,KC_F1, KC_F2, KC_F3, KC_F4, + DF_TYPE,DF_GAME,_______,_______,_______,KC_LCTL,KC_LALT,_______,_______,_______,_______,ooooooo +), + +[L_MACROS] = LAYOUT( + QK_MAKE,_______,DM_REC2,DM_REC1,DM_RSTP, _______,SHEBANG,_______,_______,_______, + QK_FLSH,_______,DM_PLY2,DM_PLY1,_______, PRG_NE, PRG_EQ, PRG_GEQ,PRG_LEQ,PRG_ARR, + QK_VERS,_______,_______,_______,_______,_______,_______,_______,PS_ITEM,FS_PIPE,_______,FS_ARR, + _______,_______,_______,_______,ooooooo,_______,_______,ooooooo,_______,_______,_______,_______ +) + + +// Template +// [L_FUNC] = LAYOUT( +// _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______, _______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______ +// ), + +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, L_SYMBOLS, L_NAVIGATION, L_MACROS); +} diff --git a/keyboards/keyboardio/atreus/keymaps/replicaJunction/readme.md b/keyboards/keyboardio/atreus/keymaps/replicaJunction/readme.md new file mode 100644 index 000000000..88f948a94 --- /dev/null +++ b/keyboards/keyboardio/atreus/keymaps/replicaJunction/readme.md @@ -0,0 +1,6 @@ +replicaJunction - Keyboardio Atreus +=================================== + +A 44-key layout designed for daily programming usage and occasional, light gaming. + +Most of the interesting logic in this is defined and described in [my userspace](../../../../../users/replicaJunction/readme.md), so check that out if you're interested in how things work. The CAPSWORD and NUMWORD features are especially important for a keyboard this size. diff --git a/keyboards/keyboardio/atreus/keymaps/replicaJunction/rules.mk b/keyboards/keyboardio/atreus/keymaps/replicaJunction/rules.mk new file mode 100644 index 000000000..7e0b3c9ca --- /dev/null +++ b/keyboards/keyboardio/atreus/keymaps/replicaJunction/rules.mk @@ -0,0 +1,29 @@ +# Userspace options +USER_CAPS_WORD_ENABLE = yes +USER_MOUSE_JIGGLE_ENABLE = yes +USER_NUM_WORD_ENABLE = yes +USER_SECRETS_ENABLE = yes +USER_SUPER_ALT_TAB_ENABLE = yes + +DYNAMIC_MACRO_ENABLE = yes + +# Extra features that are nice but takes space. Enable only if they're +# used in the layout. +WPM_ENABLE = no +# EXTRAKEY_ENABLE = no # For volume keys and similar +# MOUSEKEY_ENABLE = no # Them mouse keys yo +KEY_OVERRIDE_ENABLE = no +LEADER_ENABLE = no +TAP_DANCE_ENABLE = no +# RGBLIGHT_ENABLE = no # Keyboard RGB underglow +RGB_MATRIX_ENABLE = no + +# Features I definitely don't care aboud +LTO_ENABLE = yes +CONSOLE_ENABLE = no +VERBOSE = no +DEBUG_MATRIX_SCAN_RATE = no +DEBUG_MATRIX = no +MAGIC_ENABLE = no +SPACE_CADET_ENABLE = no +GRAVE_ESC_ENABLE = no diff --git a/keyboards/xd75/keymaps/replicaJunction/config.h b/keyboards/xd75/keymaps/replicaJunction/config.h new file mode 100644 index 000000000..a02f9a95d --- /dev/null +++ b/keyboards/xd75/keymaps/replicaJunction/config.h @@ -0,0 +1,51 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once + +// Do not allow one macro to contain the other macro +#define DYNAMIC_MACRO_NO_NESTING + +// "THE most important tap hold configuration setting" +// https://precondition.github.io/home-row-mods#ignore-mod-tap-interrupt +// https://docs.qmk.fm/#/tap_hold?id=ignore-mod-tap-interrupt +#define IGNORE_MOD_TAP_INTERRUPT + +// This one is a style choice. Play with it both on and off to see which +// one suits you better. +// https://precondition.github.io/home-row-mods#permissive-hold +// https://docs.qmk.fm/#/tap_hold?id=permissive-hold +#define PERMISSIVE_HOLD + +// If you press a dual-role key for longer than TAPPING_TERM, then +// release it without pressing another key, without this setting nothing +// would happen. With this setting, it sends the key's tap function. +// https://precondition.github.io/home-row-mods#retro-tapping +#define RETRO_TAPPING + +// Disable some unused features to save space +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +///// +// Flags for stuff in my userspace + +#define USER_INCLUDE_GAMING_LAYER +#define USER_INCLUDE_MACRO_LAYER + +// "Super Alt-Tab" +// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab +#define USER_SUPER_ALT_TAB_TIMEOUT 500 diff --git a/keyboards/xd75/keymaps/replicaJunction/keymap.c b/keyboards/xd75/keymaps/replicaJunction/keymap.c new file mode 100644 index 000000000..71ef2a668 --- /dev/null +++ b/keyboards/xd75/keymaps/replicaJunction/keymap.c @@ -0,0 +1,138 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include QMK_KEYBOARD_H +#include "replicaJunction.h" + +// enum additional_keyboard_layers { +// L_RGB = _LAYER_SAFE_RANGE +// }; + +#define BSP_SYM LT(L_SYMBOLS, KC_BSPC) +#define SPC_NAV LT(L_NAVIGATION, KC_SPC) +#define ESC_NUM LT(L_NUMBERS, KC_ESC) +#define MO_FN MO(L_FN) +#define MO_MAC MO(L_MACROS) + +#define DF_TYPE DF(L_BASE) +#define DF_GAME DF(L_GAMING) + +#define ESC_SFT LSFT_T(KC_ESC) +#define TAB_SFT RSFT_T(KC_TAB) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [L_BASE] = LAYOUT_ortho_5x15( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_GRV, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_EQL, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_LBRC, KC_BSLS, KC_RBRC, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_MINS, KC_A, KC_R, KC_S, KC_T, KC_G, SALTTAB, KC_UP, KC_END, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + NUMWORD, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_LEFT, KC_DOWN, KC_RGHT, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, CAPWORD, + KC_LCTL, KC_LGUI, KC_LALT, MO_FN, ESC_SFT, BSP_SYM, CTL_DEL, KC_ENT, ALT_ENT, SPC_NAV, TAB_SFT, MO_FN, KC_RALT, KC_RGUI, KC_RCTL + ), + + + [L_GAMING] = LAYOUT_ortho_5x15( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_GRV, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_BSLS, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_HOME, KC_DEL, KC_PGUP, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_END, KC_UP, KC_PGDN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, KC_LCTL, KC_LALT, KC_LSFT, KC_SPC, KC_LALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, KC_SPC, MO_FN, KC_RALT, KC_RGUI, KC_RCTL + ), + + + // [L_QWERTY] = LAYOUT_ortho_5x15( + // KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_GRV, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + // KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_BSLS, KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_QUOT, + // KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_HOME, KC_DEL, KC_PGUP, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + // KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_END, KC_UP, KC_PGDN, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + // KC_LCTL, KC_LGUI, KC_LALT, MO(_FN), KC_SPC, KC_SPC, KC_LEFT, KC_DOWN, KC_RGHT, KC_SPC, KC_SPC, MO(_FN), KC_RALT, KC_RGUI, KC_RCTL + // ), + + + // [L_CURSOR] = LAYOUT_ortho_5x15( + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + // _______, _______, _______, _______, _______, _______, _______, _______, _______, OS_SALL, OS_COPY, OS_PAST, OS_CUT, OS_UNDO, _______, + // _______, KC_LGUI, KC_LALT, KC_LSFT, KC_LCTL, _______, _______, _______, SEARCH, SALTTAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, + // _______, KC_RGUI, KC_RALT, KC_RSFT, KC_RCTL, _______, _______, _______, _______, OS_FIND, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, + // _______, _______, _______, _______, _______, ooooooo, _______, _______, _______, SPC_NAV, _______, _______, _______, _______, _______ + // ), + + + [L_NUMBERS] = LAYOUT_ortho_5x15( + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_NLCK, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HASH, KC_P7, KC_P8, KC_P9, KC_PSLS, SFT_TAB, + _______, KC_LGUI, KC_LALT, KC_LSFT, KC_LCTL, _______, _______, _______, _______, KC_PPLS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TAB, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_P1, KC_P2, KC_P3, KC_BSLS, KC_EQL, + _______, _______, _______, _______, ooooooo, _______, _______, _______, _______, _______, KC_P0, KC_P0, KC_PDOT, KC_PENT, _______ + ), + + + [L_SYMBOLS] = LAYOUT_ortho_5x15( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_AT, KC_LT, KC_DLR, KC_GT, XXXXXXX, _______, _______, _______, XXXXXXX, KC_LBRC, KC_UNDS, KC_RBRC, XXXXXXX, _______, + _______, KC_BSLS, KC_LPRN, KC_DQUO, KC_RPRN, KC_HASH, _______, _______, _______, KC_PERC, KC_LCBR, KC_EQL, KC_RCBR, KC_PIPE, _______, + _______, KC_EXLM, KC_COLN, KC_ASTR, KC_PLUS, XXXXXXX, _______, _______, _______, XXXXXXX, KC_AMPR, KC_CIRC, KC_TILD, KC_GRV, _______, + _______, _______, _______, _______, _______, ooooooo, _______, _______, _______, ooooooo, _______, _______, _______, _______, _______ + ), + + + [L_NAVIGATION] = LAYOUT_ortho_5x15( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, OS_UNDO, OS_CUT, OS_PAST, OS_COPY, OS_SALL, _______, _______, _______, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_DEL, _______, + _______, KC_LGUI, KC_LALT, KC_LSFT, KC_LCTL, _______, _______, _______, _______, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, _______, + _______, WIN_V, _______, _______, OS_FIND, SEARCH, _______, _______, _______, _______, SFT_TAB, KC_TAB, KC_APP, KC_PSCR, _______, + _______, _______, _______, _______, _______, ooooooo, _______, _______, _______, ooooooo, _______, _______, _______, _______, _______ + ), + + + [L_FN] = LAYOUT_ortho_5x15( + DF_TYPE, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, MS_JIGL, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + DF_GAME, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, _______, _______, _______, _______, KC_VOLU, _______, _______, _______, _______, KC_F12, + _______, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, KC_CAPS, RESET, _______, KC_MUTE, _______, _______, _______, _______, _______, + _______, RGB_M_P, RGB_M_B, _______, _______, _______, _______, _______, _______, KC_VOLD, K_SECR1, K_SECR2, K_SECR3, K_SECR4, _______, + _______, _______, _______, ooooooo, _______, _______, _______, _______, _______, _______, _______, ooooooo, _______, _______, _______ + ), + + + [L_MACROS] = LAYOUT_ortho_5x15( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, QK_MAKE, _______, DM_REC2, DM_REC1, _______, _______, _______, _______, _______, SHEBANG, _______, _______, _______, _______, + _______, QK_FLSH, _______, DM_PLY2, DM_PLY1, DM_RSTP, _______, _______, _______, PRG_NE, PRG_EQ, PRG_GEQ, PRG_LEQ, PRG_ARR, _______, + _______, QK_VERS, _______, _______, _______, _______, _______, _______, _______, _______, PS_ITEM, FS_PIPE, _______, FS_ARR, _______, + _______, _______, _______, _______, ooooooo, _______, _______, _______, _______, ooooooo, _______, _______, _______, _______, _______ + ) + + // [_FN] = LAYOUT_ortho_5x15( /* FUNCTION */ + // _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NLCK, KC_SLSH, KC_ASTR, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + // KC_MSEL, KC_CALC, KC_MYCM, KC_MAIL, RGB_HUD, RGB_HUI, KC_P7, KC_P8, KC_P9, KC_MINS, _______, _______, KC_PSCR, KC_SLCK, KC_F12, + // KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, RGB_SAD, RGB_SAI, KC_P4, KC_P5, KC_P6, KC_PLUS, _______, RESET, _______, _______, _______, + // KC_VOLD, KC_MUTE, KC_VOLU, KC_APP, RGB_VAD, RGB_VAI, KC_P1, KC_P2, KC_P3, KC_PENT, _______, _______, _______, _______, _______, + // _______, _______, RGB_TOG, ooooooo, RGB_RMOD,RGB_MOD, KC_P0, _______, KC_PDOT, KC_PENT, KC_PENT, ooooooo, _______, _______, _______ + // ) + + // // Template + // [_LAYER] = LAYOUT_ortho_5x15( + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + // _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + // ), +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, L_SYMBOLS, L_NAVIGATION, L_MACROS); +} diff --git a/keyboards/xd75/keymaps/replicaJunction/readme.md b/keyboards/xd75/keymaps/replicaJunction/readme.md new file mode 100644 index 000000000..980a2f727 --- /dev/null +++ b/keyboards/xd75/keymaps/replicaJunction/readme.md @@ -0,0 +1,5 @@ +# replicaJunction - XD75 layout + +As a longtime ortho user, I prefer the "pseudo-split" keymap, where the center 3 columns are used for other purposes. This leaves 6 columns on each side to used like a split Preonic. + +Most of the goodies in this layout are defined in [my userspace folder](../../../../users/replicaJunction/readme.md). Better explanations of the interesting features are provided there. diff --git a/keyboards/xd75/keymaps/replicaJunction/rules.mk b/keyboards/xd75/keymaps/replicaJunction/rules.mk new file mode 100644 index 000000000..7e0b3c9ca --- /dev/null +++ b/keyboards/xd75/keymaps/replicaJunction/rules.mk @@ -0,0 +1,29 @@ +# Userspace options +USER_CAPS_WORD_ENABLE = yes +USER_MOUSE_JIGGLE_ENABLE = yes +USER_NUM_WORD_ENABLE = yes +USER_SECRETS_ENABLE = yes +USER_SUPER_ALT_TAB_ENABLE = yes + +DYNAMIC_MACRO_ENABLE = yes + +# Extra features that are nice but takes space. Enable only if they're +# used in the layout. +WPM_ENABLE = no +# EXTRAKEY_ENABLE = no # For volume keys and similar +# MOUSEKEY_ENABLE = no # Them mouse keys yo +KEY_OVERRIDE_ENABLE = no +LEADER_ENABLE = no +TAP_DANCE_ENABLE = no +# RGBLIGHT_ENABLE = no # Keyboard RGB underglow +RGB_MATRIX_ENABLE = no + +# Features I definitely don't care aboud +LTO_ENABLE = yes +CONSOLE_ENABLE = no +VERBOSE = no +DEBUG_MATRIX_SCAN_RATE = no +DEBUG_MATRIX = no +MAGIC_ENABLE = no +SPACE_CADET_ENABLE = no +GRAVE_ESC_ENABLE = no diff --git a/layouts/community/ergodox/replicaJunction/config.h b/layouts/community/ergodox/replicaJunction/config.h index 9ffd74dcc..a02f9a95d 100644 --- a/layouts/community/ergodox/replicaJunction/config.h +++ b/layouts/community/ergodox/replicaJunction/config.h @@ -1,13 +1,51 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + #pragma once -// Layer definitions +// Do not allow one macro to contain the other macro +#define DYNAMIC_MACRO_NO_NESTING -#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_LL_R 6 -#define L_LL_E 7 -#define L_LL_I 8 +// "THE most important tap hold configuration setting" +// https://precondition.github.io/home-row-mods#ignore-mod-tap-interrupt +// https://docs.qmk.fm/#/tap_hold?id=ignore-mod-tap-interrupt +#define IGNORE_MOD_TAP_INTERRUPT + +// This one is a style choice. Play with it both on and off to see which +// one suits you better. +// https://precondition.github.io/home-row-mods#permissive-hold +// https://docs.qmk.fm/#/tap_hold?id=permissive-hold +#define PERMISSIVE_HOLD + +// If you press a dual-role key for longer than TAPPING_TERM, then +// release it without pressing another key, without this setting nothing +// would happen. With this setting, it sends the key's tap function. +// https://precondition.github.io/home-row-mods#retro-tapping +#define RETRO_TAPPING + +// Disable some unused features to save space +#undef LOCKING_SUPPORT_ENABLE +#undef LOCKING_RESYNC_ENABLE + +///// +// Flags for stuff in my userspace + +#define USER_INCLUDE_GAMING_LAYER +#define USER_INCLUDE_MACRO_LAYER + +// "Super Alt-Tab" +// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab +#define USER_SUPER_ALT_TAB_TIMEOUT 500 diff --git a/layouts/community/ergodox/replicaJunction/keymap.c b/layouts/community/ergodox/replicaJunction/keymap.c index ce0400be5..0c36abcf7 100644 --- a/layouts/community/ergodox/replicaJunction/keymap.c +++ b/layouts/community/ergodox/replicaJunction/keymap.c @@ -1,427 +1,378 @@ -/* - * Keyboard: Ergodox - * Keymap: replicaJunction - * Version: 2.1 +/* Copyright 2021 Joshua T. + * + * 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 . */ #include QMK_KEYBOARD_H -#include "config.h" #include "replicaJunction.h" +// Most layers are defined in my userspace, but this keyboard has +// an extra one. +enum additional_keyboard_layers { + L_SYSLEDS = _LAYER_SAFE_RANGE +}; + +#define BSP_SYM LT(L_SYMBOLS, KC_BSPC) +#define SPC_NAV LT(L_NAVIGATION, KC_SPC) + +#define MO_FN MO(L_FN) +#define MO_MAC MO(L_MACROS) +#define MO_SLED MO(L_SYSLEDS) + +#define TG_GAME TG(L_GAMING) + +#define ESC_SFT LSFT_T(KC_ESC) +#define TAB_SFT RSFT_T(KC_TAB) + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[L_COLEMAK] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - KC_ESC ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_GRV , -//--------|--------|--------|--------|--------|--------|--------| - KX_ECTL ,KC_Q ,KC_W ,KC_F ,KC_P ,KC_B ,KC_LBRC , -//--------|--------|--------|--------|--------|--------|--------| - KC_TAB ,KC_A ,KC_R_LT ,KC_S_LT ,KC_T ,KC_G, -//--------|--------|--------|--------|--------|--------|--------| - KC_LSFT ,KX_Z_MT ,KX_X_MT ,KX_C_MT ,KX_D_MT ,KC_V ,KC_RBRC , -//--------|--------|--------|--------|--------|--------|--------| - TD_LAYR ,KC_LGUI ,KC_HYPR ,KX_CTSF ,KC_LCTL , -//--------|--------|--------|--------|--------|--------|--------| - KC_HOME ,KC_END , -// |--------|--------| - KC_PGUP , -// |--------|--------|--------| - KX_BKNM ,KX_DCTL ,KC_PGDN , -// |--------|--------|--------| -//--------|--------|--------|--------|--------|--------|-------| - TG_GAME ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_EQL , -//--------|--------|--------|--------|--------|--------|-------| - KC_DEL ,KC_J ,KC_L ,KC_U ,KC_Y ,KC_SCLN ,KC_BSLS, -//--------|--------|--------|--------|--------|--------|-------| - KC_M ,KC_N ,KC_E_LT ,KC_I_LT ,KC_O ,KC_QUOT, -//--------|--------|--------|--------|--------|--------|-------| - KC_LOCK ,KC_K ,KX_H_MT ,KX_COMT ,KX_DOMT ,KX_SLMT ,KC_RSFT, -//--------|--------|--------|--------|--------|--------|-------| - KC_LALT ,KC_MINS ,KC_QUOT ,KC_EQL ,TT_NUM , -//--------|--------|--------|--------|--------|--------|-------| - KC_LEFT ,KC_RGHT , -//--------|--------| - KC_UP , -//--------|--------|--------| - KC_DOWN ,KX_NALT ,KX_SPAC -//--------|--------|--------| +[L_BASE] = LAYOUT_ergodox( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, + KC_EQL, KC_Q, KC_W, KC_F, KC_P, KC_B, NUMWORD, + KC_MINS, KC_A, KC_R, KC_S, KC_T, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_RBRC, + KC_LCTL, KC_LGUI ,KC_LALT, MO_FN, ESC_SFT, + KC_HOME, KC_END, + KC_PGUP, + BSP_SYM, CTL_DEL, KC_PGDN, + TG_GAME, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, + CAPWORD, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LOCK, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + TAB_SFT, MO_FN, KC_RALT, KC_RGUI, MO_SLED, + KC_LEFT, KC_RGHT, + KC_UP, + KC_DOWN, ALT_ENT, SPC_NAV ), - -[L_QWERTY] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| - -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,KC_EQL , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,KC_QUOT , -//--------|--------|--------|--------|--------|--------|--------| - KC_LOCK ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH ,KC_RSPC , -//--------|--------|--------|--------|--------|--------|--------| - KC_RALT ,KC_MINS ,KC_QUOT ,KC_EQL ,TT_NUM , -//--------|--------|--------|--------|--------|--------|--------| - KC_LEFT ,KC_RGHT , -//--------|--------| - KC_UP , -//--------|--------|--------| - KC_DOWN ,KX_NALT ,KX_SPAC -//--------|--------|--------| -), - - - -[L_NUM] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_SLSH ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_PIPE, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_BSLS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_AMPR ,KC_LABK ,KC_RABK, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| - -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_F11 , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_COLN ,KC_P7 ,KC_P8 ,KC_P9 ,KC_PSLS ,KC_F12 , -//--------|--------|--------|--------|--------|--------|--------| - KC_HASH ,KC_P4 ,KC_P5 ,KC_P6 ,KC_PAST ,KC_BSPC , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_BSPC ,KC_P1 ,KC_P2 ,KC_P3 ,KC_PMNS ,KC_TAB , -//--------|--------|--------|--------|--------|--------|--------| - KC_P0 ,KC_PDOT ,KC_PEQL ,KC_PPLS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------| - _______ , -//--------|--------|--------| - _______ ,KC_PENT ,MO_FUNC -//--------|--------|--------| -), - - - -[L_EXTEND] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,KC_APP ,KX_CGR, KC_VOLU, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_LGUI, KC_LSFT, KC_LALT, KC_LCTL, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,KX_SRCH, KX_PAST, KC_VOLD, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------|--------| - _______ , -// |--------|--------|--------| - MO_FUNC, _______ ,_______ , -// |--------|--------|--------| - -//--------|--------|--------|--------|--------|--------|--------| - KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_PGUP, KC_HOME, KC_UP, KC_END, KC_DEL, _______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_BSPC, KC_MENU, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KX_STAB, KC_TAB, _______ ,KC_INS, KC_PSCR, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,KC_PSCR, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ -//--------|--------|--------|--------|--------|--------|--------| -), - - - -[L_FUNC] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,M_LCLIK, M_RCLIK, M_MCLIK, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_LGUI, KC_LSFT, KC_LALT, KC_LCTL, M_WHLUP, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,M_LEFT, M_DOWN, M_UP ,M_RIGHT, M_WHLDN, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| - -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_VOLU, KC_F9, KC_F10, KC_F11, KC_F12, _______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_MUTE, KC_F5, KC_F6, KC_F7, KC_F8, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_VOLD, KC_F1, KC_F2, KC_F3, KC_F4, _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ -//--------|--------|--------|--------|--------|--------|--------| -), - - - [L_GAMING] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_ESC ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_R ,KC_S ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_LSFT, _______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,KC_LALT ,KC_LCTL , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - KC_SPC, KC_LSFT, _______ , -// |--------|--------|--------| + KC_GRV, _______,_______,_______,_______,_______,_______, + KC_TAB, _______,_______,_______,_______,_______,_______, + KC_ESC, KC_A, KC_R, KC_S, KC_T, _______, + KC_LSFT,_______,_______,KC_C, KC_D, _______,_______, + _______,_______,KC_TAB, KC_LALT,KC_LCTL, + KC_LOCK,_______, + _______, + KC_SPC, KC_LSFT,_______, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_E ,KC_I ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,KC_UP, KC_SLSH, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_LEFT, KC_DOWN, KC_RGHT, -//--------|--------|--------|--------|--------|--------|--------| - M_MCLIK ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - M_RCLIK , -//--------|--------|--------|--------|--------|--------|--------| - M_LCLIK ,KC_ENT ,KC_BSPC -//--------|--------|--------|--------|--------|--------|--------| -) -, + ooooooo,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,KC_N, KC_E, KC_I, KC_O, _______, + _______,_______,_______,_______,_______,_______,_______, + MO_FN, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, + KC_BTN3,_______, + KC_BTN2, + KC_BTN1,KC_ENT, KC_BSPC +), -// "Letter Layers" -[L_LL_R] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,ooooooo ,KC_AMPR ,KC_PIPE ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| +[L_NUMBERS] = LAYOUT_ergodox( + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,KC_LGUI,KC_LALT,KC_LSFT,KC_LCTL,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_COLN ,KC_P7 ,KC_P8 ,KC_P9 ,KC_PSLS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_HASH ,KC_P4 ,KC_P5 ,KC_P6 ,KC_PAST ,KC_TAB , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_BSPC ,KC_P1 ,KC_P2 ,KC_P3 ,KC_PMNS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - KC_P0 ,KC_PDOT ,KC_PEQL ,KC_PPLS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------| - _______ , -//--------|--------|--------| - _______ ,KC_PENT ,MO_FUNC -//--------|--------|--------| -) -, + _______,KC_NLCK,_______,_______,_______,_______,_______, + KC_NLCK,KC_HASH,KC_P7, KC_P8, KC_P9, KC_PSLS,SFT_TAB, + KC_PPLS,KC_P4, KC_P5, KC_P6, KC_PAST,KC_TAB, + _______,KC_PMNS,KC_P1, KC_P2, KC_P3, KC_BSLS,KC_EQL, + KC_P0, KC_P0, KC_PDOT,KC_PENT,_______, + _______,_______, + _______, + _______,_______,_______ +), -[L_LL_E] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - RJ_QMKV ,RJ_MAKE ,RJ_EQ ,RJ_LEQ ,RJ_GEQ ,RJ_GEQR ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,RJ_SELS ,RJ_DUND ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,ooooooo ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------| - _______ , -//--------|--------|--------| - _______ ,_______ ,_______ -//--------|--------|--------| -) -, +[L_SYMBOLS] = LAYOUT_ergodox( + _______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, + _______,KC_AT, KC_LT, KC_DLR, KC_GT, XXXXXXX,_______, + _______,KC_BSLS,KC_LPRN,KC_DQUO,KC_RPRN,KC_HASH, + _______,KC_EXLM,KC_COLN,KC_ASTR,KC_PLUS,XXXXXXX,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + ooooooo,_______,_______, -[L_LL_I] = LAYOUT_ergodox( -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_SLSH ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_PIPE, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_BSLS ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_AMPR ,KC_LABK ,KC_RABK, -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -// |--------|--------| - _______ , -// |--------|--------|--------| - _______ ,_______ ,_______ , -// |--------|--------|--------| + _______,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______,XXXXXXX,KC_LBRC,KC_UNDS,KC_RBRC,XXXXXXX,KC_F12, + KC_PERC,KC_LCBR,KC_EQL, KC_RCBR,KC_PIPE,_______, + _______,XXXXXXX,KC_AMPR,KC_CIRC,KC_TILD,KC_GRV, _______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,ooooooo +), -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_UNDS, KC_GRV ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,KC_MINS ,KC_QUOT ,ooooooo ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,KC_TILD, KC_DQT ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ ,_______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ , -//--------|--------|--------|--------|--------|--------|--------| - _______ ,_______ ,_______ -//--------|--------|--------|--------|--------|--------|--------| + +[L_NAVIGATION] = LAYOUT_ergodox( + _______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, + _______,OS_UNDO,OS_CUT, OS_PAST,OS_COPY,OS_SALL,_______, + _______,KC_LGUI,KC_LSFT,KC_LALT,KC_LCTL,_______, + _______,WIN_V, _______,_______,OS_FIND,SEARCH, _______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______, + + _______,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + _______,KC_PGUP,KC_HOME,KC_UP, KC_END, KC_DEL, KC_F12, + KC_PGDN,KC_LEFT,KC_DOWN,KC_RGHT,KC_BSPC,_______, + _______,_______,SFT_TAB,KC_TAB, KC_APP, KC_PSCR,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,ooooooo +), + + +[L_FN] = LAYOUT_ergodox( + _______,_______,_______,_______,_______,_______,_______, + _______,QK_VERS,_______,DM_REC2,DM_REC1,DM_RSTP,_______, + _______,QK_MAKE,_______,DM_PLY2,DM_PLY1,_______, + _______,QK_FLSH,K_SECR1,K_SECR2,K_SECR3,K_SECR4,_______, + _______,_______,_______,ooooooo,_______, + _______,_______, + _______, + KC_LCTL,_______,_______, + + _______,_______,_______,_______,_______,_______,_______, + _______,KC_VOLU,KC_F9, KC_F10, KC_F11, KC_F12, _______, + KC_MUTE,KC_F5, KC_F6, KC_F7, KC_F8, _______, + _______,KC_VOLD,KC_F1, KC_F2, KC_F3, KC_F4, _______, + _______,ooooooo,_______,_______,_______, + _______,RESET, + _______, + _______,_______,KC_LALT +), + + +[L_MACROS] = LAYOUT_ergodox( + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,DM_REC2,DM_REC1,_______,_______, + _______,_______,_______,DM_PLY2,DM_PLY1,DM_RSTP, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + ooooooo,_______,_______, + + _______,_______,_______,_______,_______,_______,_______, + _______,_______,SHEBANG,_______,_______,_______,_______, + PRG_NE, PRG_EQ, PRG_GEQ,PRG_LEQ,PRG_ARR,_______, + _______,_______,PS_ITEM,FS_PIPE,_______,FS_ARR, _______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,ooooooo +), + + + +[L_SYSLEDS] = LAYOUT_ergodox( + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______, + _______,_______, + _______, + _______,_______,_______, + + KC_NLCK,_______,_______,_______,_______,_______,_______, + KC_CAPS,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,_______,_______, + KC_SLCK,_______,_______,_______,_______,_______,_______, + _______,_______,_______,_______,ooooooo, + _______,_______, + _______, + _______,_______,_______ ) +// Template +// [_NUMBERS] = LAYOUT_ergodox( +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______, +// _______,_______, +// _______, +// _______,_______,_______, + +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______,_______,_______, +// _______,_______,_______,_______,_______, +// _______,_______, +// _______, +// _______,_______,_______ +// ), }; -// The normal QMK functions ending in _user are overridden in the -// replicaJunction userspace. Those functions handle my global -// settings, and redirect to these _keymap functions if something -// is unhandled. This allows me to keep most of my global preferences -// in one place while still allowing keyboard-specific code. +void keyboard_post_init_user_kb(void) { + ergodox_right_led_1_on(); +} -// The idea was shamelessly copied from the amazing Drashna. -// Nothing to do here, so I've commented it out. -// bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { -// return true; -// } +//////////////////////////////////////////////////////////// +// System LED code +//////////////////////////////////////////////////////////// -// void matrix_init_keymap(void) {}; +// We need to track both the layer state and the system LED state in +// order to update the LEDs appropriately when either one changes. +// These are both represented as a bitmask. +// +// There is a global 'layer_state' variable but it is set after the call +// to layer_state_set_user(), so it doesn't work properly for our +// purposes. +static uint32_t current_layer_state = 0; +static uint8_t sys_led_state = 0; -void matrix_scan_keymap(void) { +// Whether the given layer (one of the constant defined at the top) is active. +#define LAYER_ON(state, layer) (state & (1<. + */ + +#include "caps_word.h" + +static bool is_caps_word_on = false; + +bool is_caps_word_enabled(void) { + return is_caps_word_on; +} + +void enable_caps_word(void) { + if (is_caps_word_on) return; + is_caps_word_on = true; + tap_code(KC_CAPS); +} + +void disable_caps_word(void) { + if (!is_caps_word_on) return; + is_caps_word_on = false; + tap_code(KC_CAPS); +} + +void toggle_caps_word(void) { + if (is_caps_word_on) { + disable_caps_word(); + } + else { + enable_caps_word(); + } +} + +bool should_terminate_caps_word(uint16_t keycode, const keyrecord_t *record) { + switch (keycode) { + // Keycodes which should not disable caps word mode + case KC_A ... KC_Z: + case KC_1 ... KC_0: + case KC_MINS: + case KC_UNDS: + case KC_BSPC: + return false; + + default: + if (record->event.pressed) { + return true; + } + return false; + } + + // Should be unreachable + return false; +} + + +bool process_record_caps_word(uint16_t keycode, const keyrecord_t *record) { + // Nothing in this function acts on key release + if (!record->event.pressed) { + return true; + } + + // Handle the custom keycodes that go with this feature + if (keycode == CAPWORD) { + enable_caps_word(); + return false; + } + + // If the behavior isn't enabled and the keypress isn't a keycode to + // toggle the behavior, allow QMK to handle the keypress as usual + if (!is_caps_word_on) { + return true; + } + + // Get the base keycode of a mod or layer tap key + switch (keycode) { + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + // Earlier return if this has not been considered tapped yet + if (record->tap.count == 0) + return true; + keycode = keycode & 0xFF; + break; + default: + break; + } + + if (should_terminate_caps_word(keycode, record)) { + disable_caps_word(); + } + + return true; +} diff --git a/users/replicaJunction/features/caps_word.h b/users/replicaJunction/features/caps_word.h new file mode 100644 index 000000000..4182ce582 --- /dev/null +++ b/users/replicaJunction/features/caps_word.h @@ -0,0 +1,26 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H +#include "rj_keycodes.h" + +bool is_caps_word_enabled(void); +void enable_caps_word(void); +void disable_caps_word(void); +void toggle_caps_word(void); + +bool process_record_caps_word(uint16_t keycode, const keyrecord_t *record); diff --git a/users/replicaJunction/features/mouse_jiggle.c b/users/replicaJunction/features/mouse_jiggle.c new file mode 100644 index 000000000..b2c451d33 --- /dev/null +++ b/users/replicaJunction/features/mouse_jiggle.c @@ -0,0 +1,46 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include "mouse_jiggle.h" + +bool is_mouse_jiggle_active = false; + +void matrix_scan_mouse_jiggle(void) { + if (is_mouse_jiggle_active) { + tap_code(KC_MS_UP); + tap_code(KC_MS_DOWN); + } +} + +bool process_record_mouse_jiggle(uint16_t keycode, const keyrecord_t *record) { + if (!record->event.pressed) { + return true; + } + + if (is_mouse_jiggle_active) { + // If active, quit whenever another key is pressed + is_mouse_jiggle_active = false; + return true; + } + + if (keycode != MS_JIGL) { + return true; + } + + is_mouse_jiggle_active = true; + SEND_STRING("Mouse jiggler enabled"); + return false; +} diff --git a/users/replicaJunction/features/mouse_jiggle.h b/users/replicaJunction/features/mouse_jiggle.h new file mode 100644 index 000000000..ba2c6e757 --- /dev/null +++ b/users/replicaJunction/features/mouse_jiggle.h @@ -0,0 +1,23 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H +#include "rj_keycodes.h" + +void matrix_scan_mouse_jiggle(void); + +bool process_record_mouse_jiggle(uint16_t keycode, const keyrecord_t *record); diff --git a/users/replicaJunction/features/num_word.c b/users/replicaJunction/features/num_word.c new file mode 100644 index 000000000..4cca5c19a --- /dev/null +++ b/users/replicaJunction/features/num_word.c @@ -0,0 +1,129 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include "num_word.h" + +static uint16_t num_word_timer = 0; +static bool is_num_word_on = false; + +bool is_num_word_enabled(void) { + return is_num_word_on; +} + +void enable_num_word(void) { + if (is_num_word_on) return; + is_num_word_on = true; + layer_on(L_NUMBERS); +} + +void disable_num_word(void) { + if (!is_num_word_on) return; + is_num_word_on = false; + layer_off(L_NUMBERS); +} + +void toggle_num_word(void) { + if (is_num_word_on) { + disable_num_word(); + } + else { + enable_num_word(); + } +} + +bool should_terminate_num_word(uint16_t keycode, const keyrecord_t *record) { + switch (keycode) { + // Keycodes which should not disable num word mode. + // We could probably be more brief with these definitions by using + // a couple more ranges, but I believe "explicit is better than + // implicit" + case KC_1 ... KC_0: + case KC_EQL: + case KC_SCLN: + case KC_MINS: + case KC_DOT: + + // Numpad keycodes + case KC_P1 ... KC_P0: + case KC_PSLS ... KC_PPLS: + case KC_PDOT: + + // Misc + case KC_UNDS: + case KC_BSPC: + return false; + + default: + if (record->event.pressed) { + return true; + } + return false; + } + + // Should be unreachable + return false; +} + + +bool process_record_num_word(uint16_t keycode, const keyrecord_t *record) { + // Handle the custom keycodes that go with this feature + if (keycode == NUMWORD) { + if (record->event.pressed) { + enable_num_word(); + num_word_timer = timer_read(); + return false; + } + else { + if (timer_elapsed(num_word_timer) > TAPPING_TERM) { + // If the user held the key longer than TAPPING_TERM, + // consider it a hold, and disable the behavior on + // key release. + disable_num_word(); + return false; + } + } + } + + // Other than the custom keycodes, nothing else in this feature will + // activate if the behavior is not on, so allow QMK to handle the + // event as usual + if (!is_num_word_on) return true; + + // Nothing else acts on key release, either + if (!record->event.pressed) { + return true; + } + + // Get the base keycode of a mod or layer tap key + switch (keycode) { + case QK_MOD_TAP ... QK_MOD_TAP_MAX: + case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + // Earlier return if this has not been considered tapped yet + if (record->tap.count == 0) + return true; + keycode = keycode & 0xFF; + break; + default: + break; + } + + if (should_terminate_num_word(keycode, record)) { + disable_num_word(); + } + + return true; +} diff --git a/users/replicaJunction/features/num_word.h b/users/replicaJunction/features/num_word.h new file mode 100644 index 000000000..194c4e2e0 --- /dev/null +++ b/users/replicaJunction/features/num_word.h @@ -0,0 +1,27 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H +#include "rj_keycodes.h" +#include "rj_layers.h" + +bool is_num_word_enabled(void); +void enable_num_word(void); +void disable_num_word(void); +void toggle_num_word(void); + +bool process_record_num_word(uint16_t keycode, const keyrecord_t *record); diff --git a/users/replicaJunction/features/secrets.c b/users/replicaJunction/features/secrets.c new file mode 100644 index 000000000..3e1ea283d --- /dev/null +++ b/users/replicaJunction/features/secrets.c @@ -0,0 +1,51 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +// Before you can compile with this feature, you'll need to manually +// create a file in this directory called "secret_definitions.h" +// containing the data to be added. +// +// Example implementation: +// +// #pragma once +// static const char * const secrets[] = { +// "secret1", +// "secret2", +// "secret3", +// "secret4" +// } + +#include QMK_KEYBOARD_H +#include "replicaJunction.h" +#include "secrets.h" +#include "secret_definitions.h" + +#ifndef MACRO_TIMER +# define MACRO_TIMER 5 +#endif + +bool process_record_secrets(uint16_t keycode, const keyrecord_t *record) { + switch (keycode) { + case K_SECR1 ... K_SECR4: // Secrets! Externally defined strings, not stored in repo + if (!record->event.pressed) { + clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); + send_string_with_delay(secrets[keycode - K_SECR1], MACRO_TIMER); + } + return false; + } + + return true; +} diff --git a/users/replicaJunction/features/secrets.h b/users/replicaJunction/features/secrets.h new file mode 100644 index 000000000..ef4396227 --- /dev/null +++ b/users/replicaJunction/features/secrets.h @@ -0,0 +1,30 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H + +// NOTE: In some implementations of the "secrets" functionality, the +// secrets.h file is the file that actually contains secret text. +// +// This is not the case in my implementation. That file is called +// "secret_definitions.h", and it's in a local .gitignore file so it +// does not get committed. +// +// The inclusion of this file is not an error, and there is no sensitive +// text here. + +bool process_record_secrets(uint16_t keycode, const keyrecord_t *record); diff --git a/users/replicaJunction/features/super_alt_tab.c b/users/replicaJunction/features/super_alt_tab.c new file mode 100644 index 000000000..9759898c8 --- /dev/null +++ b/users/replicaJunction/features/super_alt_tab.c @@ -0,0 +1,52 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include "super_alt_tab.h" + +// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab + +bool is_alt_tab_active = false; +uint16_t alt_tab_timer = 0; + +void matrix_scan_super_alt_tab(void) { + if (is_alt_tab_active) { + if (timer_elapsed(alt_tab_timer) > USER_SUPER_ALT_TAB_TIMEOUT) { + unregister_code(KC_LALT); + is_alt_tab_active = false; + } + } +} + + +bool process_record_super_alt_tab(uint16_t keycode, const keyrecord_t *record) { + if (keycode != SALTTAB) { + return true; + } + + if (record->event.pressed) { + if (!is_alt_tab_active) { + is_alt_tab_active = true; + register_code(KC_LALT); + } + alt_tab_timer = timer_read(); + register_code(KC_TAB); + } + else { + unregister_code(KC_TAB); + } + + return false; +} diff --git a/users/replicaJunction/features/super_alt_tab.h b/users/replicaJunction/features/super_alt_tab.h new file mode 100644 index 000000000..8bdf2bc22 --- /dev/null +++ b/users/replicaJunction/features/super_alt_tab.h @@ -0,0 +1,27 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H +#include "rj_keycodes.h" + +#ifndef USER_SUPER_ALT_TAB_TIMEOUT +# define USER_SUPER_ALT_TAB_TIMEOUT 500 +#endif + +void matrix_scan_super_alt_tab(void); + +bool process_record_super_alt_tab(uint16_t keycode, const keyrecord_t *record); diff --git a/users/replicaJunction/keycode_aliases.h b/users/replicaJunction/keycode_aliases.h new file mode 100644 index 000000000..b1006a863 --- /dev/null +++ b/users/replicaJunction/keycode_aliases.h @@ -0,0 +1,85 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once + +#include QMK_KEYBOARD_H + +// Transparent, but indicates that this key must be blocked (for example, a layer shift key) +#define ooooooo KC_TRNS + + +#define SFT_TAB LSFT(KC_TAB) +#define WIN_TAB LGUI(KC_TAB) +#define WIN_L LGUI(KC_L) +#define WIN_V LGUI(KC_V) +#define ALT_F4 LALT(KC_F4) +#define CTL_DEL LCTL_T(KC_DEL) +#define CTL_ESC CTL_T(KC_ESC) +#define ALT_ENT ALT_T(KC_ENT) +#define ALT_TAB ALT_T(KC_TAB) + +#define OSM_LSF OSM(MOD_LSFT) +#define OSM_RSF OSM(MOD_RSFT) + +// OS shortcuts (Windows) +#define OS_COPY LCTL(KC_C) +#define OS_PAST LCTL(KC_V) +#define OS_CUT LCTL(KC_X) +#define OS_UNDO LCTL(KC_Z) +#define OS_SALL LCTL(KC_A) +#define OS_FIND LCTL(KC_F) + + +// Home row modifiers +#define GUI_A LGUI_T(KC_A) +#define ALT_R LALT_T(KC_R) +#define SFT_S LSFT_T(KC_S) +#define CRT_T LCTL_T(KC_T) // we can't call this CTL_T because that name is taken! + +#define CRT_N RCTL_T(KC_N) +#define SFT_E RSFT_T(KC_E) +#define ALT_I RALT_T(KC_I) +#define GUI_O RGUI_T(KC_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 + + +// Windows 10 shortcuts: change desktop to the left/right +#define DESKLFT LCTL(LGUI(KC_LEFT)) +#define DESKRGT LCTL(LGUI(KC_RGHT)) + + +// Application-specific shortcuts + +// Search: defined in Everything Search Engine as the keypress to show/hide the window +#define SEARCH HYPR(KC_S) + +// Microsoft PowerToys hotkeys +// https://github.com/microsoft/PowerToys +#define PTYRUN LALT(KC_SPC) // PowerToys Run +#define PTYZONE LGUI(KC_GRV) // PowerToys FancyZones +#define PTYCOLR LGUI(LSFT(KC_C)) // PowerToys ColorPicker diff --git a/users/replicaJunction/matrix_scan.c b/users/replicaJunction/matrix_scan.c new file mode 100644 index 000000000..969799550 --- /dev/null +++ b/users/replicaJunction/matrix_scan.c @@ -0,0 +1,35 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include QMK_KEYBOARD_H +#include "replicaJunction.h" + +__attribute__ ((weak)) +void matrix_scan_user_kb(void) { } + +// Runs on every matrix scan. Be careful what goes here - you can really impact the +// responsiveness of your keyboard if you add too much in this function. +void matrix_scan_user(void) { +#ifdef USER_MOUSE_JIGGLE_ENABLE + matrix_scan_mouse_jiggle(); +#endif + +#ifdef USER_SUPER_ALT_TAB_ENABLE + matrix_scan_super_alt_tab(); +#endif + + matrix_scan_user_kb(); +} diff --git a/users/replicaJunction/process_records.c b/users/replicaJunction/process_records.c new file mode 100644 index 000000000..abce21526 --- /dev/null +++ b/users/replicaJunction/process_records.c @@ -0,0 +1,149 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include QMK_KEYBOARD_H +#include "process_records.h" + +uint8_t mod_state; + + +__attribute__ ((weak)) +bool process_record_user_kb(uint16_t keycode, keyrecord_t *record) { + return true; +} + +// Runs for each key down or up event. +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // Returning true here will cause QMK to continue handling the key normally. + // Returning false indicates that we've handled everything the keycode should do, and QMK + // should not continue handling the keypress. + // + // NOTE: There is also a process_record_kb function that can be defined in the keyboard- + // specific code. This allows the keyboard to have its own process_record function. + // This is supposed to be "higher" than the user function, meaning the kb function + // is shared for all keymaps for the keyboard. + // + // For this reason, I add my own function, called process_record_user_kb, and at the end + // of this function, I defer to that one if it exists. + // return process_record_user(keycode, record); + + + // Custom keycode / function handling, based on the core function + // process_record_quantum + // https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c + + if (!( +#ifdef USER_CAPS_WORD_ENABLE + process_record_caps_word(keycode, record) && +#endif +#ifdef USER_MOUSE_JIGGLE_ENABLE + process_record_mouse_jiggle(keycode, record) && +#endif +#ifdef USER_NUM_WORD_ENABLE + process_record_num_word(keycode, record) && +#endif +#ifdef USER_SECRETS_ENABLE + process_record_secrets(keycode, record) && +#endif +#ifdef USER_SUPER_ALT_TAB_ENABLE + process_record_super_alt_tab(keycode, record) && +#endif + true)) { + return false; + } + + + // Miscellaneous keycode handling + mod_state = get_mods(); + + switch(keycode) + { + case QK_MAKE: { + if (record->event.pressed) + SEND_STRING("qmk compile --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP); + return false; + } + case QK_FLSH: { + if (record->event.pressed) { + SEND_STRING("qmk flash --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP); + } + return false; + } + case QK_VERS: { + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); + } + return false; + } + case PRG_EQ: { + if (record->event.pressed) { + SEND_STRING("=="); + } + return false; + } + case PRG_NE: { + if (record->event.pressed) { + SEND_STRING("!="); + } + return false; + } + case PRG_GEQ: { + if (record->event.pressed) { + SEND_STRING(">="); + } + return false; + } + case PRG_LEQ: { + if (record->event.pressed) { + SEND_STRING("<="); + } + return false; + } + case PRG_ARR: { + if (record->event.pressed) { + SEND_STRING("=>"); + } + return false; + } + + case PS_ITEM: { + if (record->event.pressed) { + SEND_STRING("$_"); + } + return false; + } + case FS_PIPE: { + if (record->event.pressed) { + SEND_STRING("|>"); + } + return false; + } + case FS_ARR: { + if (record->event.pressed) { + SEND_STRING("->"); + } + return false; + } + case SHEBANG: { + if (record->event.pressed) { + SEND_STRING("#!"); + } + return false; + } + } + + return process_record_user_kb(keycode, record); +} diff --git a/users/replicaJunction/process_records.h b/users/replicaJunction/process_records.h new file mode 100644 index 000000000..224bc6f4f --- /dev/null +++ b/users/replicaJunction/process_records.h @@ -0,0 +1,21 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H +#include "replicaJunction.h" + +bool process_record_user_kb(uint16_t keycode, keyrecord_t *record); diff --git a/users/replicaJunction/readme.md b/users/replicaJunction/readme.md index 2a9cad272..9d728f902 100644 --- a/users/replicaJunction/readme.md +++ b/users/replicaJunction/readme.md @@ -1,14 +1,93 @@ -Copyright 2018 @ +replicaJunction QMK Userspace +============================= -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. +# Overview +I alternate between a few keyboards, one of which is the 44-key Keyboardio Atreus. Small keyboards require a liberal use of layers. Even though larger keyboards don't rely on layers as heavily, my muscle memory adapted to my Atreus layout, so I've ended up building several of those features in my keymaps for larger boards as well. -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. +The result, I believe, is a good compromise between ergonomics and ease of use. -You should have received a copy of the GNU General Public License -along with this program. If not, see . \ No newline at end of file +The code in this userspace is designed to be very modular. I use a few different keyboards, and I'm constantly tweaking one or another, so I want the ability to add and remove features from the firmware at compile-time. While my endgame goal is to get all the layouts to be compatible, in practice, it's been years and I'm still not to that point... + +Modular code also means that it should be easy to identify and adapt specific pieces to your own firmware. + +## Keyboards and Keymaps + +The following keyboards use the files in this userspace: + +* [Atreus](../../keyboards/atreus/keymaps/replicaJunction/readme.md) (42-key) +* [Ergodox](../../layouts/community/ergodox/replicaJunction/readme.md) +* [Keyboardio Atreus](../../keyboards/keyboardio/atreus/keymaps/replicaJunction/readme.md) (44-key) +* [XD75](../../keyboards/xd75/keymaps/replicaJunction/readme.md) + +# Features + +* **Secrets**, as [explained by Drashna](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md) +* **CAPSWORD** and **NUMWORD** +* Mouse jiggler +* Super alt-tab + +## Secrets +My implementation of the "secrets" concept is very similar to Drashna's, but I've chosen to allow most of the supporting code to be committed to the repo. The only thing missing is a file called `secret_definitions.h`, which contains the actual text contained in those macros. + +To use my implementation, create a file of that name in the same directory. Make sure you've got a `.gitignore` file in place, and add these contents to the definitions file: + +```c +#pragma once +static const char * const secrets[] = { + "secret1", + "secret2", + "secret3", + "secret4" +} +``` + +Change the quoted text to the text you'd like and you're golden. If you need more (or fewer) items, you'll probably need to adjust the code in `secrets.c` as well, since it looks for up to four items in a switch case. + +## CAPSWORD and NUMWORD +The concept here is simple: more often than you'd think, you need to type a single word in ALL CAPS. An easy example for me, as a programmer, is a constant value; in most programming languages, constants are typed in all caps by convention. + +You typically have a few choices, but each one comes with a drawback. Here are the options I'm aware of: + +* Use proper typing technique and alternate which hand holds Shift for each keypress + * This can often end up requiring you to switch / re-press Shift again and again, making this a tedious process +* Hold a single Shift key down + * This can lead to uncomfortable finger gymnastics +* Hit the Caps Lock key, then hit it again when you're done + * Requires you to remember to hit it again, meaning a higher cognitive load + * In some layouts for smaller keyboards, Caps Lock is not easily accessible (sometimes not mapped at all) + +The solution to this problem is CAPSWORD. When enabled, it activates Caps Lock and begins running an additional callback on each keypress. If the keypress is an alphanumeric key or one of a specific few symbols (such as the underscore), nothing happens. Otherwise, before processing the keypress, Caps Lock is disabled again. + +NUMWORD is a similar concept, but has a slightly more elaborate implementation. There's a bit of extra logic in the NUMWORD code that allows the keycode to act as a tap/hold key as well. Tapping enables NUMWORD while number keys are in use, while holding the key enables a number layer for the duration of the key hold and disables it again afterwards. + +**Note:** The implementation of NUMWORD requires that the keyboard's layer definitions be accessible in a header file. In my case, since I use a fairly standard set of layers, I've declared it in my userspace. + +## Mouse Jiggler +This adds a keycode that will move the mouse cursor on each matrix scan. Used to prevent the screen from locking if you're temporarily doing something else (working on a different machine, reading / writing, etc.). + +When you press the keycode, the keyboard will write the text "Mouse jiggler enabled" to signify that the behavior is active. I suggest opening a Notepad window before pressing the key. + +Pressing any key will automatically disable the feature again. This is because it causes a huge hit to the reliability and performance of the keyboard while it's active (adding stuff to every matrix scan will do that). I kept forgetting to turn it off before trying to use the keyboard again, so I decided to make it automatically disable itself. + +Enable this by setting `USER_MOUSE_JIGGLE_ENABLE = yes` in your `rules.mk` file. The feature also depends on the Mouse Keys feature, so ensure you don't disable `MOUSEKEY_ENABLE`. + +## Super Alt-Tab +Taken [straight out of the QMK documentation](https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab), this is an easy way to shift between a couple different windows. I use it with a very low interval when I'm alternating back and forth between two known windows with no real need for the visual feedback and thought. If you want to be able to browse the open windows before the function releases Alt, I'd suggest raising `USER_SUPER_ALT_TAB_TIMEOUT` to a higher value. + +# Credits +I'm absolutely sure I've missed a few sources here. If you see something in my code that you think is yours and isn't credited here, I sincerely apologize. + +[bpruitt-goddard](https://github.com/qmk/qmk_firmware/blob/master/keyboards/ergodox_ez/keymaps/bpruitt-goddard/readme.md) +* Dynamic macro tap-dance (no longer used, but I did use this for a while) + +[Drashna](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme.md) +* Secrets concept and basic implementation +* "Wrappers" concept (no longer used, but I did use this for a while) + +[Treeman](https://github.com/treeman/qmk_firmware/blob/master/keyboards/kyria/keymaps/treeman) +* CAPSWORD and NUMBERWORD concept + * I re-implented some of the code based on my own prefences, but I did use some implementation code from here + * [Treeman's blog post](https://www.jonashietala.se/blog/2021/06/03/the-t-34-keyboard-layout/) provides more context on these features, and is a great read + +[QMK issue #452](https://github.com/qmk/qmk_firmware/issues/452) +* Helped clarify a good organizational structure for the individual features in this userspace diff --git a/users/replicaJunction/replicaJunction.c b/users/replicaJunction/replicaJunction.c index f0bc59d25..55d8b7716 100644 --- a/users/replicaJunction/replicaJunction.c +++ b/users/replicaJunction/replicaJunction.c @@ -1,149 +1,25 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#include QMK_KEYBOARD_H #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) {} +void keyboard_post_init_user_kb(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(); +void keyboard_post_init_user(void) { + keyboard_post_init_user_kb(); } - -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 index 9b5772543..f3b7bcea0 100644 --- a/users/replicaJunction/replicaJunction.h +++ b/users/replicaJunction/replicaJunction.h @@ -1,114 +1,42 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + #pragma once +#include QMK_KEYBOARD_H +#include "rj_keycodes.h" +#include "rj_layers.h" +#include "keycode_aliases.h" +#include "version.h" -#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 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 +#ifdef USER_CAPS_WORD_ENABLE +# include "features/caps_word.h" #endif -#ifdef L_LL_S - #define KC_S_LT LT(L_LL_S, KC_S) -#else - #define KC_S_LT KC_S +#ifdef USER_MOUSE_JIGGLE_ENABLE +# include "features/mouse_jiggle.h" #endif -#ifdef L_LL_E - #define KC_E_LT LT(L_LL_E, KC_E) -#else - #define KC_E_LT KC_E +#ifdef USER_NUM_WORD_ENABLE +# include "features/num_word.h" #endif -#ifdef L_LL_I - #define KC_I_LT LT(L_LL_I, KC_I) -#else - #define KC_I_LT KC_I +#ifdef USER_SECRETS_ENABLE +# include "features/secrets.h" #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 +#ifdef USER_SUPER_ALT_TAB_ENABLE +# include "features/super_alt_tab.h" +#endif diff --git a/users/replicaJunction/rj_keycodes.h b/users/replicaJunction/rj_keycodes.h new file mode 100644 index 000000000..fde2698df --- /dev/null +++ b/users/replicaJunction/rj_keycodes.h @@ -0,0 +1,63 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once +#include QMK_KEYBOARD_H + +// Custom keycodes and macros +enum userspace_custom_keycodes { + QK_MAKE = SAFE_RANGE, // QMK make command + QK_FLSH, // QMK flash command + QK_VERS, // QMK version + + // Programming macros + PRG_EQ, // == + PRG_NE, // != + PRG_GEQ, // >= + PRG_LEQ, // <= + PRG_ARR, // => + PS_ITEM, // $_ (PowerShell - $PSItem variable) + FS_PIPE, // |> (F# pipe operator) + FS_ARR, // -> (F# lambda / pattern matching) + SHEBANG, // #! + + // USER_CAPS_WORD_ENABLE + CAPWORD, + +#ifdef USER_NUM_WORD_ENABLE + NUMWORD, +#endif + + // USER_ENABLE_CUSTOM_SHIFT_CODES + // Custom characters that send different symbols than usual when shifted + KCC_COM, // , or ! + KCC_DOT, // . or @ + KCC_QUO, // ' or ~ + + // USER_MOUSE_JIGGLE_ENABLE + MS_JIGL, + + // USER_ENABLE_SUPER_ALT_TAB + SALTTAB, + + // USER_ENABLE_SECRETS + K_SECR1, + K_SECR2, + K_SECR3, + K_SECR4, + + DYNAMIC_MACRO_RANGE +}; diff --git a/users/replicaJunction/rj_layers.h b/users/replicaJunction/rj_layers.h new file mode 100644 index 000000000..f6296af05 --- /dev/null +++ b/users/replicaJunction/rj_layers.h @@ -0,0 +1,40 @@ +/* Copyright 2021 Joshua T. + * + * 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 . + */ + +#pragma once + +enum rj_layers { + L_BASE, + +#ifdef USER_INCLUDE_QWERTY + L_QWERTY, +#endif + +#ifdef USER_INCLUDE_GAMING_LAYER + L_GAMING, +#endif + + L_NUMBERS, + L_SYMBOLS, + L_NAVIGATION, + L_FN, + +#ifdef USER_INCLUDE_MACRO_LAYER + L_MACROS, +#endif + + _LAYER_SAFE_RANGE +}; diff --git a/users/replicaJunction/rules.mk b/users/replicaJunction/rules.mk index 30a330195..addaa04d9 100644 --- a/users/replicaJunction/rules.mk +++ b/users/replicaJunction/rules.mk @@ -1 +1,33 @@ SRC += replicaJunction.c + +# Only load these source files if the features are enabled. Keyboards can +# enable or disable these features in their own rules.mk files. + +ifeq ($(strip $(USER_CAPS_WORD_ENABLE)), yes) + SRC += features/caps_word.c + OPT_DEFS += -DUSER_CAPS_WORD_ENABLE +endif + +ifeq ($(strip $(USER_MOUSE_JIGGLE_ENABLE)), yes) + SRC += features/mouse_jiggle.c + OPT_DEFS += -DUSER_MOUSE_JIGGLE_ENABLE +endif + +ifeq ($(strip $(USER_NUM_WORD_ENABLE)), yes) + SRC += features/num_word.c + OPT_DEFS += -DUSER_NUM_WORD_ENABLE +endif + +ifeq ($(strip $(USER_SECRETS_ENABLE)), yes) + SRC += features/secrets.c + OPT_DEFS += -DUSER_SECRETS_ENABLE +endif + +ifeq ($(strip $(USER_SUPER_ALT_TAB_ENABLE)), yes) + SRC += features/super_alt_tab.c + OPT_DEFS += -DUSER_SUPER_ALT_TAB_ENABLE +endif + +# Define these last so any other logic can set up some defines first +SRC += matrix_scan.c \ + process_records.c