From d0d8d84566dbb22356761fc900846512c5450b99 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 15 Jun 2023 07:56:16 +0200 Subject: [PATCH] Better structure. (#3) --- README.md | 34 +++++- src/keymaps/ferris/combos.def | 16 --- src/keymaps/totem/keymap.c | 168 ++++---------------------- src/users/fride/combos.def | 93 +++++++------- src/users/fride/features/layermodes.c | 12 +- src/users/fride/features/nshot_mod.c | 9 +- src/users/fride/fride.c | 145 ++++++++++------------ src/users/fride/keycodes.h | 138 --------------------- src/users/fride/layers.h | 105 ---------------- src/users/fride/layout.h | 151 +++++++++++++++++++++++ src/users/fride/rules.mk | 4 +- 11 files changed, 330 insertions(+), 545 deletions(-) delete mode 100644 src/keymaps/ferris/combos.def delete mode 100644 src/users/fride/keycodes.h delete mode 100644 src/users/fride/layers.h create mode 100644 src/users/fride/layout.h diff --git a/README.md b/README.md index a0f860e..4d4635e 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,36 @@ COMB( CMB_BSLS, KC_BSLS, KC_R, KC_O) -``` \ No newline at end of file + +/// + +```COMB( CMB_AT, KC_AT, OS_LSFT, KC_V) +COMB( CMB_UNDS, KC_UNDS, OS_LSFT, KC_M) +COMB( CMB_LBRC, KC_LBRC, OS_LSFT, KC_L) +COMB( CMB_RBRC, KC_RBRC, OS_LSFT, KC_C) +COMB( CMB_CIRC, KC_CIRC, OS_LSFT, KC_P) +COMB( CMB_EXLM, KC_EXLM, OS_LSFT, KC_B) +COMB( CMB_LT, KC_LT, OS_LSFT, MAGIC) +COMB( CMB_GT, KC_GT, OS_LSFT, KC_U) +COMB( CMB_EQL, KC_EQL, OS_LSFT, KC_O) +COMB( CMB_AMPR, KC_AMPR, OS_LSFT, KC_QUOT) +COMB( CMB_BSLS, KC_BSLS, OS_LSFT, KC_S) +COMB( CMB_SLSH, KC_SLSH, OS_LSFT, KC_T) +COMB( CMB_LCBR, KC_LCBR, OS_LSFT, KC_R) +COMB( CMB_RCBR, KC_RCBR, OS_LSFT, KC_D) +COMB( CMB_ASTR, KC_ASTR, OS_LSFT, KC_Y) +COMB( CMB_QUES, KC_QUES, OS_LSFT, KC_F) +COMB( CMB_LPRN, KC_LPRN, OS_LSFT, KC_N) +COMB( CMB_RPRN, KC_RPRN, OS_LSFT, KC_E) +COMB( CMB_MINS, KC_MINS, OS_LSFT, KC_A) +COMB( CMB_COLN, KC_COLN, OS_LSFT, KC_I) +COMB( CMB_HASH, KC_HASH, OS_LSFT, KC_X) +COMB( CMB_DLR, KC_DLR, OS_LSFT, KC_K) +COMB( CMB_PIPE, KC_PIPE, OS_LSFT, KC_J) +COMB( CMB_TILD, KC_TILD, OS_LSFT, KC_G) +COMB( CMB_GRV, KC_GRV, OS_LSFT, KC_W) +COMB( CMB_PLUS, KC_PLUS, OS_LSFT, KC_Z) +COMB( CMB_PERC, KC_PERC, OS_LSFT, KC_H) +COMB( CMB_DQUO, KC_DQUO, OS_LSFT, KC_COMM) +COMB( CMB_QUOT, KC_QUOT, OS_LSFT, KC_DOT) +COMB( CMB_SCLN, KC_SCLN, OS_LSFT, KC_UNDS) \ No newline at end of file diff --git a/src/keymaps/ferris/combos.def b/src/keymaps/ferris/combos.def deleted file mode 100644 index e8d15a8..0000000 --- a/src/keymaps/ferris/combos.def +++ /dev/null @@ -1,16 +0,0 @@ -// COMB( combo_caps, CAPSWORD, KC_T, KC_A) -COMB( combo_canel, CANCEL, HOME_A, HOME_I) -COMB( combo_enter, KC_ENTER, HOME_N, HOME_E, HOME_A) -COMB( COMBO_ESC, KC_ESC, HOME_R, HOME_D) -COMB( combo_tab, KC_TAB, HOME_T, HOME_R, HOME_D) -COMB( combo_q, KC_Q, KC_V, KC_M) - -COMB(combo_numword, NUMWORD, REPEAT, HOME_N) - -COMB(CMB_BOOT, QK_BOOT, KC_V, KC_COMM) - -COMB( CMB_EQL, KC_EQL, MAGIC, KC_O) -COMB( CMB_MINS, KC_MINS, KC_M, KC_C) -COMB( CMB_ESC, LT(_SYM, KC_ESC), KC_R, KC_D) -COMB( CMB_COLON, COLON_SYMB, KC_N, KC_E) -// TODO this must be a colon \ No newline at end of file diff --git a/src/keymaps/totem/keymap.c b/src/keymaps/totem/keymap.c index 217712e..cb4aa36 100644 --- a/src/keymaps/totem/keymap.c +++ b/src/keymaps/totem/keymap.c @@ -12,152 +12,32 @@ */ #include QMK_KEYBOARD_H -#include -#include "totem.h" -#include "keycodes.h" -#include "layers.h" +#include "layout.h" #include "g/keymap_combo.h" -#include "features/tap_hold.h" -// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -// │ D E F I N I T I O N S │ -// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ - - -// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -// │ K E Y M A P S │ -// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - /* - ┌─────────────────────────────────────────────────┐ - │ │ ╭╮╭╮╭╮╭╮ - └─────────────────────────────────────────────────┘ │╰╯╰╯╰╯│ - ┌─────────┬─────────┬─────────┬─────────┬──────╨──┐┌──╨──────┬─────────┬─────────┬─────────┬─────────┐ - ╌┄┈┈───═╡ Q │ W │ E │ R │ T ││ Y │ U │ I │ O │ P │ - ├─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┤ - │ A │ S │ D │ F │ G ││ H │ J │ K │ L │ ; │ - ┌─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┐ - │ Q │ Z │ X │ C │ V │ B ││ N │ M │ , │ . │ / │ P │ - └─────────┴─────────┴─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┴─────────┴─────────┘ - │ CTRL │ LOWER │ SPACE ││ ENTER │ RAISE │ BSPC │ - └─────────┴─────────┴─────────┘└─────────┴─────────┴─────────┘*/ - - [_ALPHA] = LAYOUT( - ALPHA_00, ALPHA_01,ALPHA_02, ALPHA_03, ALPHA_04, ALPHA_05, ALPHA_06, ALPHA_07, ALPHA_08, ALPHA_09, - ALPHA_10, ALPHA_11,ALPHA_12, ALPHA_13, ALPHA_14, ALPHA_15, ALPHA_16, ALPHA_17, ALPHA_18, ALPHA_19, - KC_NO, ALPHA_20, ALPHA_21,ALPHA_22, ALPHA_23, ALPHA_24, ALPHA_25, ALPHA_26, ALPHA_27, ALPHA_28, ALPHA_29, KC_NO, - ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35 - ), - [_ALPHA2] = LAYOUT( - KC_NO, ALPHA_00,ALPHA_02, ALPHA_04, KC_NO, KC_NO, ALPHA_05, ALPHA_07, ALPHA_08, ALPHA_09, - ALPHA_10, ALPHA_11,ALPHA_12, ALPHA_14, KC_NO, KC_NO, ALPHA_15, KC_LPRN, KC_LCBR, ALPHA_19, - KC_NO, KC_NO, ALPHA_20,ALPHA_22, ALPHA_24, KC_NO, KC_NO, ALPHA_25, A(KC_O), A(KC_O), A(KC_U), KC_NO, - ALPHA_30, TO(_ALPHA), KC_NO, KC_NO, ALPHA_34, ALPHA_35 - ), - [_NAV] = LAYOUT( - NAV_00, NAV_01, NAV_02, NAV_03, NAV_04, NAV_05, NAV_06, NAV_07, NAV_08, NAV_09, - NAV_10, NAV_11, NAV_12, NAV_13, NAV_14, NAV_15, NAV_16, NAV_17, NAV_18, NAV_19, - KC_NO, NAV_20, NAV_21, NAV_22, NAV_23, NAV_24, NAV_25, NAV_26, NAV_27, NAV_28, NAV_29, KC_NO, - ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35 - ), - [_NUM] = LAYOUT( - NUM_00, NUM_01, NUM_02, NUM_03, NUM_04, NUM_05, NUM_06, NUM_07, NUM_08, NUM_09, - NUM_10, NUM_11, NUM_12, NUM_13, NUM_14, NUM_15, NUM_16, NUM_17, NUM_18, NUM_19, - KC_NO, NUM_20, NUM_21, NUM_22, NUM_23, NUM_24, NUM_25, NUM_26, NUM_27, NUM_28, NUM_29, KC_NO, - ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35 - ), - -// see https://neo-layout.org/ - [_SYM] = LAYOUT( -//╷ ╷ ╷ ╷ ╷ ╷ ╷╷ ╷ ╷ ╷ ╷ ╷ ╷ - KC_NO, KC_AT, KC_LBRC, KC_RBRC, KC_CIRC, KC_EXLM, KC_LT, KC_GT, KC_EQL, KC_AMPR, - KC_BSLS, KC_SLASH, KC_LCBR, KC_RCBR, KC_PAST, KC_QUES, KC_LPRN, KC_RPRN, KC_MINS, KC_AT, - KC_NO, KC_HASH, KC_DLR, KC_PIPE, KC_TILDE, KC_GRV, KC_PLUS, KC_PERC, KC_QUOTE, KC_QUOT, KC_UNDS, KC_NO, - ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35 - ), - - -/* - ╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ - - ┌─────────────────────────────────────────────────┐ - │ t e m p l a t e │ ╭╮╭╮╭╮╭╮ - └─────────────────────────────────────────────────┘ │╰╯╰╯╰╯│ - ┌─────────┬─────────┬─────────┬─────────┬──────╨──┐┌──╨──────┬─────────┬─────────┬─────────┬─────────┐ - ╌┄┈┈───═╡ │ │ │ │ ││ │ │ │ │ │ - ├─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┤ - │ │ │ │ │ ││ │ │ │ │ │ - ┌─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┐ - │ │ │ │ │ │ ││ │ │ │ │ │ │ - └─────────┴─────────┴─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┴─────────┴─────────┘ - │ │ │ ││ │ │ │ - └─────────┴─────────┴─────────┘└─────────┴─────────┴─────────┘ - - [_TEMPLATE] = LAYOUT( - //╷ ╷ ╷ ╷ ╷ ╷ ╷╷ ╷ ╷ ╷ ╷ ╷ ╷ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, - ), -*/ -}; - - -uint16_t get_combo_term(uint16_t index, combo_t *combo) { - switch (index ) - { - default: - return COMBO_TERM; +// Convert 3x5_2 to Charybdis Nano 3x5_3+2 +#define TOTEM(k) CONV_TOTEM(k) +#define CONV_TOTEM( \ + L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \ + L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \ + L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \ + L33, L34, R30, R31 \ + ) \ + { \ + { L00, L01, L02, L03, L04 }, \ + { L10, L11, L12, L13, L14 }, \ + { L20, L21, L22, L23, L24 }, \ + { KC_NO, KC_NO, KC_NO, L33, L34 }, \ + { R04, R03, R02, R01, R00 }, \ + { R14, R13, R12, R11, R10 }, \ + { R24, R23, R22, R21, R20 }, \ + { KC_NO, KC_NO, KC_NO, R31, R30 }, \ } -} - -// TODO https://github.com/qmk/qmk_firmware/blob/master/docs/feature_combo.md -bool get_combo_must_tap(uint16_t index, combo_t *combo) { - // switch (index) - // { - // case CMB_LCTRL: - // case CMB_RCTRL: - // case CMB_EQL: - // case CMB_MINS: - // case CMB_NUM: - // case CMB_Q: - // case CMB_W: - // case CMB_X: - // case CMB_EXCL: - // case CMB_LPAREN: - // case CMB_RPAREN: - // case CMB_RPAREN: - // return false; - // } - // return true; - return false; -} -/* - ╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ - - - ██████ - ██ ▄▄▄▄ - ██ ██▀▀██ - ▀▀ ██▄▄██ - ██████ ▀▀▀▀ - ██ ▄▄▄▄▄▄ - ██ ██▀▀▀▀ - ██ ██████ - ██▄▄▄▄ - ▀▀▀▀▀▀ - ████████ - ██ ██ ██ - ██ ██ ██ - ▀▀ ▀▀ ▀▀ - ████████ - -*/ - +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [ALPHA] = TOTEM(_BASE), + [NAV] = TOTEM(_NAV), + [NUM] = TOTEM(_NUM), + [SYM1] = TOTEM(_SYM1) +}; \ No newline at end of file diff --git a/src/users/fride/combos.def b/src/users/fride/combos.def index 53eca1c..2ac6378 100644 --- a/src/users/fride/combos.def +++ b/src/users/fride/combos.def @@ -1,57 +1,56 @@ // Layout key reference // KC_V, KC_M, KC_L, KC_C, KC_P, KC_B MAGIC, KC_U, KC_O, KC_QUOT -// HM_S, HM_T, HM_R, HM_D, KC_Y, KC_F HM_N, HM_E, HM_A, HM_I +// KC_S, KC_T, KC_R, KC_D, KC_Y, KC_F KC_N, KC_E, KC_A, KC_I // KC_X, KC_K, KC_J, KC_G, KC_W, KC_Z KC_H, KC_COMM, KC_DOT, KC_UNDS // NAV_SPC, ____, ___, REPEAT +// cancel anymods and layers, please! The PANIC BUTTON! +COMB( combo_canel, CANCEL, KC_S, KC_I) +COMB( CMB_BOOT, QK_BOOT, KC_V, KC_QUOT) + +// thumb combos +COMB (CMB_NUMWORD, NUMWORD, KC_A, OS_LSFT) +// One shot numbers +COMB( COMBO_0, KC_0, KC_A, KC_S) +COMB( COMBO_1, KC_1, KC_A, KC_T) +COMB( COMBO_2, KC_2, KC_A, KC_R) +COMB( COMBO_3, KC_3, KC_A, KC_D) +COMB( COMBO_4, KC_4, KC_A, KC_K) +COMB( COMBO_5, KC_5, KC_A, KC_J) +COMB( COMBO_6, KC_6, KC_A, KC_G) +COMB( COMBO_7, KC_7, KC_A, KC_M) +COMB( COMBO_8, KC_8, KC_A, KC_L) +COMB( COMBO_9, KC_9, KC_A, KC_C) + + + // COMB( combo_caps, CAPSWORD, KC_T, KC_A) -// cancel anymods and layers, please! The PANIC BUTTON! -COMB( combo_canel, CANCEL, ALPHA_10, ALPHA_19) -COMB( CMB_BOOT, QK_BOOT, ALPHA_00, ALPHA_09) -// COMB (CMB_TG_NAV, TG(_NAV), ALPHA_01,ALPHA_02, ALPHA_03) -// COMB (CMB_TG_NUM, TG(_NUM), ALPHA_06, ALPHA_07, ALPHA_08) + + +COMB( combo_enter, KC_ENTER, KC_N, KC_E, KC_A) +COMB( COMBO_ESC, KC_ESC, KC_R, KC_D) +COMB( combo_tab, KC_TAB, KC_T, KC_R, KC_D) +COMB( COMBO_COLON, KC_COLON, KC_N, KC_E) +COMB( COMBO_SCOLON, KC_SCLN, KC_N, KC_COMM) + +// ctrl and shift +COMB( COMBO_LCTL, OS_LCTL, KC_T, KC_R) +COMB( COMBO_RCTL, OS_LCTL, KC_E, KC_A) + +// Letters +COMB( COMBO_Q, KC_Q, KC_V, KC_M) + // both primary thumbs. Because why not!? -COMB (CMB_NUMWORD, NUMWORD, ALPHA_34, ALPHA_31) - -COMB( combo_enter, KC_ENTER, ALPHA_16, ALPHA_17, ALPHA_18) -COMB( COMBO_ESC, ESC_SYM, ALPHA_12, ALPHA_13) -COMB( combo_tab, KC_TAB, ALPHA_11, ALPHA_12, ALPHA_13) -COMB( COMBO_COLON, CLN_SYM, ALPHA_16, ALPHA_17) -COMB( COMBO_SCOLON, KC_SCLN, ALPHA_16, ALPHA_27) - -COMB( COMBO_Q, KC_Q, ALPHA_00, ALPHA_01) - -COMB( COMBO_LSFT, OS_LSFT, ALPHA_23, ALPHA_24) -COMB( COMBO_RSFT, OS_LSFT, ALPHA_25, ALPHA_26) -COMB( COMBO_LCTL, OS_LCTL, ALPHA_11, ALPHA_12) -COMB( COMBO_RCTL, OS_LCTL, ALPHA_17, ALPHA_18) - -COMB( COMBO_NEXTSEN, NEXTSEN, ALPHA_31, ALPHA_28) - -// COMB( COMBO_LPAREN, KC_LPRN, ALPHA_13, ALPHA_16) -// COMB( COMBO_MINS, KC_MINS, ALPHA_01, ALPHA_03) -// COMB( COMBO_EQL, KC_EQL, ALPHA_06, ALPHA_08) - - -// COMB( left_parenthesis, KC_LPRN, ALPHA_13, ALPHA_16) -// COMB( left_brace, KC_LCBRC, ALPHA_13, ALPHA_17) -// COMB( left_bracket, KC_BRKT, ALPHA_13, ALPHA_18) -// COMB( less_than, KC_LT, ALPHA_13, ALPHA_19) -// COMB( right_parenthesis, KC_RPRN, ALPHA_13, ALPHA_6) -// COMB( right_brace, KC_RCBR, ALPHA_13, ALPHA_7) -// COMB( right_bracket, KC_RBCT, ALPHA_13, ALPHA_8) -// COMB( more_than, KC_GT, ALPHA_13, ALPHA_9) - -// COMB( TILDE, KC_TILDE, ALPHA_12, ALPHA_15) -// COMB( COLON, KC_COLON, ALPHA_12, ALPHA_16) -// COMB( SEMICOLON, KC_SEMICOLON, ALPHA_12, ALPHA_17) -// COMB( HASH, KC_HASH, ALPHA_12, ALPHA_18) -// COMB( PERCENT, KC_PERCENT, ALPHA_12, ALPHA_19) -// COMB( CARET, KC_CIRC, ALPHA_12, ALPHA_5) -// COMB( PIPE, KC_PIPE, ALPHA_12, ALPHA_6) -// COMB( BACKSLASH, KC_BACKSLASH, ALPHA_12, ALPHA_7) -// COMB( AT, KC_AT, ALPHA_12, ALPHA_8) -// COMB( DOLLAR, KC_DOLLAR, ALPHA_12, ALPHA_9) \ No newline at end of file + + +// COMB( COMBO_UUML, U_UML, MAGIC, KC_QUOTE) +// COMB( COMBO_AUML, A_UML, MAGIC, KC_I) +// COMB( COMBO_OUML, O_UML, MAGIC, KC_A) + +// see https://github.com/digver/zmk-config-urob/blob/main/img/keymap.png?raw=true + + + diff --git a/src/users/fride/features/layermodes.c b/src/users/fride/features/layermodes.c index ec33ac6..908668c 100644 --- a/src/users/fride/features/layermodes.c +++ b/src/users/fride/features/layermodes.c @@ -1,6 +1,5 @@ #include "layermodes.h" - -#include "keycodes.h" +#include "layout.h" static uint16_t num_word_timer; static bool _num_word_enabled = false; @@ -9,17 +8,17 @@ bool num_word_enabled(void) { return _num_word_enabled; } void enable_num_word(void) { _num_word_enabled = true; - layer_on(_NUM); + layer_on(NUM); } void disable_num_word(void) { _num_word_enabled = false; - layer_off(_NUM); + layer_off(NUM); } void process_num_word_activation(const keyrecord_t *record) { if (record->event.pressed) { - layer_on(_NUM); + layer_on(NUM); num_word_timer = timer_read(); } else { if (timer_elapsed(num_word_timer) < TAPPING_TERM) { @@ -27,12 +26,11 @@ void process_num_word_activation(const keyrecord_t *record) { _num_word_enabled = true; } else { // Holding turns off NUM when released - layer_off(_NUM); + layer_off(NUM); } } } -// TODO DAS IST KAPUTT!? void process_num_word(uint16_t keycode, const keyrecord_t *record) { if (_num_word_enabled) { // keycode = keycode & 0xFF; diff --git a/src/users/fride/features/nshot_mod.c b/src/users/fride/features/nshot_mod.c index 7f8ef5e..57e93ab 100644 --- a/src/users/fride/features/nshot_mod.c +++ b/src/users/fride/features/nshot_mod.c @@ -1,5 +1,5 @@ #include "nshot_mod.h" -#include "keycodes.h" +#include "layout.h" #define modbit_lclg (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LGUI)) @@ -125,8 +125,8 @@ bool is_nshot_cancel_key(uint16_t keycode) { switch (keycode) { case CLEAR: case CANCEL: - case SPACE: - if (layer_state_is(_NAV)) { + case NAV_SPC: + if (layer_state_is(NAV)) { return true; } else { return false; @@ -139,7 +139,8 @@ bool is_nshot_cancel_key(uint16_t keycode) { bool is_nshot_ignored_key(uint16_t keycode) { switch (keycode) { //case NAVMODE: - case SPACE: + case NAV_SPC: + case NUMWORD: case OS_LSFT: case OS_LCTL: case OS_LALT: diff --git a/src/users/fride/fride.c b/src/users/fride/fride.c index 780487d..e083f7a 100644 --- a/src/users/fride/fride.c +++ b/src/users/fride/fride.c @@ -5,8 +5,7 @@ #include "features/repeat_key.h" #include "features/swapper.h" #include "features/tap_hold.h" -#include "keycodes.h" -#include "layers.h" +#include "layout.h" const custom_shift_key_t custom_shift_keys[] = { {KC_DOT, KC_QUES}, // Shift . is ? @@ -37,48 +36,47 @@ bool wap_app_cancel(uint16_t keycode) { uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) { if ((mods & ~MOD_MASK_SHIFT) == 0) { switch (keycode) { - case ALPHA_18: + case KC_A: return KC_O; case KC_B: return KC_N; // TODO BEFORE - case ALPHA_03: // C + case KC_C: // C return KC_Y; - case ALPHA_13: + case KC_D: return KC_Y; - case ALPHA_17: + case KC_E: return KC_U; - case ALPHA_15: + case KC_F: return KC_N; - case ALPHA_16: + case KC_N: return KC_F; // Fuenf! - case ALPHA_23: + case KC_G: return KC_Y; - case ALPHA_19: + case KC_I: return MG_ION; - case ALPHA_22: + case KC_J: return MG_UST; - case ALPHA_21: + case KC_K: return KC_S; - case ALPHA_02: + case KC_L: return KC_K; - case ALPHA_01: + case KC_M: return KC_T; // AMT and co in Germann ;) - // N makes no sense! - case ALPHA_08: + case KC_O: return KC_A; - case ALPHA_04: + case KC_P: return KC_Y; - case ALPHA_12: + case KC_R: return KC_L; - case ALPHA_10: + case KC_S: return KC_K; - case ALPHA_11: + case KC_T: return KC_M; //ment does not work that well with german - case ALPHA_07: + case KC_U: return KC_E; - case ALPHA_00: + case KC_V: return MG_VER; - case ALPHA_14: + case KC_Y: return KC_P; case KC_EQL: return KC_GT; @@ -86,8 +84,8 @@ uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) { return KC_RPRN; case KC_MINS: return KC_GT; - case SPACE: - return MG_THE; +//case NAV_SPC: +// return MG_THE; case KC_ESC: return KC_COLON; case KC_1 ... KC_0: @@ -97,7 +95,7 @@ uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) { } } else if ((mods & MOD_MASK_CTRL)) { switch (keycode) { - case HOME_A: // Ctrl+A -> Ctrl+K + case KC_A: // Ctrl+A -> Ctrl+K return C(KC_C); case KC_C: // Ctrl+C -> Ctrl+C return C(KC_C); @@ -121,11 +119,7 @@ bool get_repeat_key_eligible_user(uint16_t keycode, keyrecord_t *record, return true; } -// clang-format off -bool process_record_user(uint16_t keycode, keyrecord_t* record) { - - if (!process_achordion(keycode, record)) { return false; } - +bool process_record_user(uint16_t keycode, keyrecord_t* record) { if (!process_repeat_key_with_alt(keycode, record, REPEAT, ALTREP)) { return false; } @@ -164,15 +158,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { } if (rep_count > 0) { switch (keycode) { - case ALPHA_16: + case KC_N: unregister_weak_mods(MOD_MASK_CSAG); send_char('f'); return false; // one time shift after space? - case ALPHA_31: + case NAV_SPC: set_oneshot_mods(MOD_BIT(KC_LSFT)); return false; - case ALPHA_19: // i -> ng + case KC_I: SEND_STRING("ng"); return false; } @@ -180,6 +174,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { } switch (keycode) { + case LPAREN: + if (record->event.pressed) { + if (shifted) {tap_code16(KC_LT);} + else {tap_code16(KC_LPRN);} + return false; + } + case RPAREN: + if (record->event.pressed) { + if (shifted) {tap_code16(KC_GT);} + else {tap_code16(KC_LPRN);} + return false; + } case ALFRED: if (record->event.pressed) { SEND_STRING( SS_DOWN(X_LALT) SS_TAP(X_SPACE) SS_UP(X_LALT)); @@ -194,25 +200,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { case CANCEL: if (record->event.pressed) { // stop_leading(); - layer_off(_NAV); - layer_off(_NUM); - layer_off(_SYM); + layer_off(NAV); + layer_off(NUM); + layer_off(SYM1); //disable_caps_word(); disable_num_word(); - layer_move(_ALPHA); + layer_move(ALPHA); return false; } + /// TODO TEST TEST TEST + case LT(NUM,REPEAT): + if (record->event.pressed) { + return alt_repeat_key_tap(); + } case NUMWORD: process_num_word_activation(record); return false; - case CLN_SYM: { - if (record->tap.count && record->event.pressed) { - tap_code16(KC_COLON); - return false; - } else { - return true; - } - } case MAGIC: { if (record->tap.count > 0) { tap_code16(ALTREP); @@ -220,15 +223,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { } else { return true; } - } - case ESC_SYM: { - if (record->tap.count && record->event.pressed) { - tap_code16(KC_ESC); - return false; - } else { - return true; - } - } + } case A_UML: if (record->event.pressed) { // TODO SHIFT! @@ -302,6 +297,7 @@ bool tap_hold(uint16_t keycode) { case KC_UP: case KC_DOWN: case KC_RIGHT: + case CPYPASTE: return true; } @@ -352,33 +348,20 @@ void tap_hold_send_hold(uint16_t keycode) { } } -// // Select Shift hold immediately with a nested key -// bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { -// return IS_QK_MOD_TAP(keycode) && IS_MT_SHIFT(keycode) && !IS_TYPING(); -// } - -bool achordion_chord(uint16_t tap_hold_keycode, - keyrecord_t* tap_hold_record, - uint16_t other_keycode, - keyrecord_t* other_record) { - - // Exceptionally consider the following chords as holds, even though they - // are on the same hand. - switch (tap_hold_keycode) { - case ALPHA_31: - case NUMWORD: - return true; - } - - // Also allow same-hand holds when the other key is in the rows below the - // alphas. I need the `% (MATRIX_ROWS / 2)` because my keyboard is split. - if (other_record->event.key.row % (MATRIX_ROWS / 2) >= 4) { return true; } +void matrix_scan_user(void) { + tap_hold_matrix_scan(); +} - // Otherwise, follow the opposite hands rule. - return achordion_opposite_hands(tap_hold_record, other_record); +uint16_t get_combo_term(uint16_t index, combo_t *combo) { + switch (index ) + { + default: + return COMBO_TERM; + } } -void matrix_scan_user(void) { - tap_hold_matrix_scan(); - accordion_task(); +// TODO https://github.com/qmk/qmk_firmware/blob/master/docs/feature_combo.md +bool get_combo_must_tap(uint16_t index, combo_t *combo) { + + return false; } \ No newline at end of file diff --git a/src/users/fride/keycodes.h b/src/users/fride/keycodes.h deleted file mode 100644 index 5ec1cfa..0000000 --- a/src/users/fride/keycodes.h +++ /dev/null @@ -1,138 +0,0 @@ -#pragma once - -#include QMK_KEYBOARD_H - -enum layers { - _ALPHA, - _ALPHA2, - _NUM, - _SYM, - _MODS, - _FUN, - _NAV -}; - - -// Tap dance codes -enum { - SCL_END, -}; - -enum custom_keycodes { - QUOTE = SAFE_RANGE, - REPEAT, - ALTREP, - LEADER, - LLOCK, - CIRC, - GRV, - TILD, - DELIM, // on the NUM word layer - - // Smart caps lock and layers that turn off on certain keys - CAPSWORD, - MINS, - NUMWORD, - SENTENCE, - CAMEL, - KEBAB, - - // Layer management - CANCEL, // Cancel SYMWORD and NUMWORD - CLEAR, // Clear all WORD, one-shots and reset to BASE - MG_THE, - MG_ION, - MG_ON, - MG_ENT, - MG_UST, - MG_MENT, - MG_VER, - - // N-Shot Mods - OS_LSFT, // OS Mods - OS_LCTL, // OS Mods - OS_LALT, // OS Mods - OS_LGUI, // OS Mods - TS_LCTL, // Two-shot ctrl - - // used below in the thumb - NEXTSEN, - - // German special nonsense - A_UML, - O_UML, - U_UML, - SZ, - - ARROW_L, - ARROW_R, - QU, - - COPY_PASTE, - SP_MOD, // oneshot modifier and tap, nav layer on hold. See 'NAV_MOD' - SP_SFT, - CPYPASTE, - - SW_APP, - SW_WIN, - MOUSE_TGL, - SLASH, - UNDER, - ALFRED -}; - - // The MAGIC NUMBER! -#define MAGIC ALTREP -#define REPEAT_SYM LT(_SYM, REPEAT) -#define SPACE LT(_NAV, KC_SPC) - -#define HOME_S KC_S -#define HOME_T KC_T -#define HOME_R KC_R -#define HOME_D KC_D - -#define HOME_N KC_N -#define HOME_E KC_E -#define HOME_A KC_A -#define HOME_I KC_I - - -#define MY_G KC_G -#define MY_J KC_J -#define MY_K KC_K - -#define MY_H KC_H -#define MY_QUOT KC_QUOT -#define MY_SCLN KC_SCLN - -// #define HOME_S KC_S -// #define HOME_T LT(_NUM, KC_T) -// #define HOME_R LT(_SYM, KC_R) -// #define HOME_D LT(_NAV,KC_D) - -// #define HOME_N LT(_NAV,KC_N) -// #define HOME_E LT(_SYM,KC_E) -// #define HOME_A LT(_NUM,KC_A) -// #define HOME_I KC_I - - -// #define MY_G LGUI_T(KC_G) -// #define MY_J LALT_T(KC_J) -// #define MY_K LCTL_T(KC_K) - -// #define MY_H RGUI_T(KC_H) -// #define MY_QUOT RALT_T(KC_QUOT) -// #define MY_SCLN RCTL_T(KC_SCLN) - -// Semantic Keys -#define FWD G(KC_RBRC) -#define BACK G(KC_LBRC) -#define TAB_L G(S(KC_LBRC)) -#define TAB_R G(S(KC_RBRC)) -#define SPACE_L A(G(KC_LEFT)) -#define SPACE_R A(G(KC_RGHT)) - -#define EURO S(A(KC_2)) - -#define CLN_SYM LT(_SYM, KC_COLON) -#define ESC_SYM LT(_SYM, KC_ESC) \ No newline at end of file diff --git a/src/users/fride/layers.h b/src/users/fride/layers.h deleted file mode 100644 index 2351871..0000000 --- a/src/users/fride/layers.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -// Layers -// https://github.com/Ikcelaks/keyboard_layouts/blob/main/magic_sturdy/magic_sturdy.md -#define ALPHA_00 KC_V -#define ALPHA_01 KC_M -#define ALPHA_02 KC_L -#define ALPHA_03 KC_C -#define ALPHA_04 KC_P -#define ALPHA_05 KC_B -#define ALPHA_06 MAGIC -#define ALPHA_07 KC_U -#define ALPHA_08 KC_O -#define ALPHA_09 KC_QUOT -#define ALPHA_10 KC_S -#define ALPHA_11 LSFT_T(KC_T) -#define ALPHA_12 LCTL_T(KC_R) -#define ALPHA_13 LGUI_T(KC_D) -#define ALPHA_14 KC_Y -#define ALPHA_15 KC_F -#define ALPHA_16 LGUI_T(KC_N) -#define ALPHA_17 LCTL_T(KC_E) -#define ALPHA_18 LSFT_T(KC_A) -#define ALPHA_19 KC_I -#define ALPHA_20 KC_X -#define ALPHA_21 LCTL_T(KC_K) -#define ALPHA_22 LALT_T(KC_J) -#define ALPHA_23 LALT_T(KC_G) -#define ALPHA_24 KC_W -#define ALPHA_25 KC_Z -#define ALPHA_26 RALT_T(KC_H) -#define ALPHA_27 RALT_T(KC_COMM) -#define ALPHA_28 RCTL_T(KC_DOT) -#define ALPHA_29 KC_UNDS - -#define ALPHA_30 KC_NO -#define ALPHA_31 LT(_NAV,KC_SPACE) -#define ALPHA_32 OS_LSFT -#define ALPHA_33 OS_LSFT -#define ALPHA_34 REPEAT -#define ALPHA_35 KC_NO - - -#define NAV_00 SW_APP -#define NAV_01 KC_ESC -#define NAV_02 TAB_L -#define NAV_03 TAB_R -#define NAV_04 KC_NO -#define NAV_05 KC_NO -#define NAV_06 KC_BSPC -#define NAV_07 KC_UP -#define NAV_08 KC_DEL -#define NAV_09 KC_Q -#define NAV_10 OS_LSFT -#define NAV_11 OS_LCTL -#define NAV_12 OS_LALT -#define NAV_13 OS_LGUI -#define NAV_14 OSM(MOD_MEH) -#define NAV_15 FWD -#define NAV_16 KC_LEFT -#define NAV_17 KC_DOWN -#define NAV_18 KC_RIGHT -#define NAV_19 BACK -#define NAV_20 KC_NO -#define NAV_21 KC_NO -#define NAV_22 KC_NO -#define NAV_23 CPYPASTE -#define NAV_24 ALFRED -#define NAV_25 KC_NO -#define NAV_26 KC_NO -#define NAV_27 KC_NO -#define NAV_28 KC_NO -#define NAV_29 KC_NO - - -#define NUM_00 KC_NO -#define NUM_01 KC_NO -#define NUM_02 KC_NO -#define NUM_03 KC_9 -#define NUM_04 KC_NO -#define NUM_05 KC_NO -#define NUM_06 KC_0 -#define NUM_07 KC_NO -#define NUM_08 KC_NO -#define NUM_09 KC_NO -#define NUM_10 KC_7 -#define NUM_11 KC_5 -#define NUM_12 KC_3 -#define NUM_13 KC_1 -#define NUM_14 KC_NO -#define NUM_15 KC_NO -#define NUM_16 KC_2 -#define NUM_17 KC_4 -#define NUM_18 KC_6 -#define NUM_19 KC_8 -#define NUM_20 KC_NO -#define NUM_21 KC_NO -#define NUM_22 KC_NO -#define NUM_23 KC_9 -#define NUM_24 KC_NO -#define NUM_25 KC_NO -#define NUM_26 KC_0 -#define NUM_27 KC_COMM -#define NUM_28 KC_DOT -#define NUM_29 KC_UNDS diff --git a/src/users/fride/layout.h b/src/users/fride/layout.h new file mode 100644 index 0000000..922491d --- /dev/null +++ b/src/users/fride/layout.h @@ -0,0 +1,151 @@ +#pragma once +#include QMK_KEYBOARD_H + +enum layers { + ALPHA, + ALPHA2, + NUM, + SYM1, + SYM2, + MODS, + FUN, + NAV +}; + +enum custom_keycodes { + QUOTE = SAFE_RANGE, + REPEAT, + ALTREP, + LEADER, + LLOCK, + CIRC, + GRV, + TILD, + DELIM, // on the NUM word layer + + + LPAREN, + RPAREN, + + + // Smart caps lock and layers that turn off on certain keys + CAPSWORD, + MINS, + NUMWORD, + SENTENCE, + CAMEL, + KEBAB, + + // Layer management + CANCEL, // Cancel SYMWORD and NUMWORD + CLEAR, // Clear all WORD, one-shots and reset to BASE + MG_THE, + MG_ION, + MG_ON, + MG_ENT, + MG_UST, + MG_MENT, + MG_VER, + + // N-Shot Mods + OS_LSFT, // OS Mods + OS_LCTL, // OS Mods + OS_LALT, // OS Mods + OS_LGUI, // OS Mods + TS_LCTL, // Two-shot ctrl + + // used below in the thumb + NEXTSEN, + + // German special nonsense + A_UML, + O_UML, + U_UML, + SZ, + + ARROW_L, + ARROW_R, + QU, + + COPY_PASTE, + SP_MOD, // oneshot modifier and tap, nav layer on hold. See 'NAV_MOD' + SP_SFT, + CPYPASTE, + + SW_APP, + SW_WIN, + MOUSE_TGL, + SLASH, + UNDER, + ALFRED +}; + +// macOS shortcuts +#define Z_UND G(KC_Z) +#define Z_CUT G(KC_X) +#define Z_CPY G(KC_C) +#define Z_PST G(KC_V) +#define Z_RDO S(G(KC_Z)) +#define Z_LOCK C(G(KC_Q)) +#define Z_SLEEP S(C(KC_EJCT)) +#define Z_SHUT C(A(G(KC_PWR))) +#define Z_SSHT G(S(KC_4)) +#define Z_SRCD G(S(KC_5)) +#define Z_VSML A(KC_LSFT) +#define Z_HASH A(KC_3) +#define Z_AT S(KC_2) +#define EURO S(A(KC_2)) +#define FWD G(KC_RBRC) +#define BACK G(KC_LBRC) +#define TAB_L G(S(KC_LBRC)) +#define TAB_R G(S(KC_RBRC)) +#define SPACE_L A(G(KC_LEFT)) +#define SPACE_R A(G(KC_RGHT)) + + +// special keys +#define MAGIC ALTREP +#define REPEAT_SYM LT(SYM, REPEAT) +#define NAV_SPC LT(NAV, KC_SPC) +// how to arrange this!?s +// #define ESC_SYM LT(SYM,KC_COLON) +// #define CLN_NUM LT(NUM, KC_COLON) +#define OS_SYM OSL(SYM) +#define OS_MEH OSM(MOD_MEH) + + +#define _______ KC_NO +#define ___________________________________________ _______, _______, _______, _______, _______ + + +// clang-format off +#define _BASE \ + KC_V, KC_M, KC_L, KC_C, KC_P, KC_B, MAGIC, KC_U, KC_O, KC_QUOT, \ + KC_S, KC_T, KC_R, KC_D, KC_Y, KC_F, KC_N, KC_E, KC_A, KC_I, \ + KC_X, KC_K, KC_J, KC_G, KC_W, KC_Z, KC_H, KC_COMM, KC_DOT, KC_UNDS, \ + NAV_SPC, OS_MEH, REPEAT, OS_LSFT + +// clang-format off +#define _NAV \ + SW_APP, KC_ESC, TAB_L, TAB_R, _______, _______, KC_BSPC, KC_UP, KC_DEL, KC_Q, \ + OS_LSFT, OS_LCTL, OS_LALT, OS_LGUI, OS_MEH, FWD, KC_LEFT, KC_DOWN, KC_RIGHT,BACK, \ + _______, _______, _______, CPYPASTE,ALFRED, _______, _______, _______, _______, _______, \ + NAV_SPC, OS_MEH, REPEAT, OS_LSFT + +// clang-format off +#define _NUM \ + KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, _______, _______, _______, _______, _______, \ + KC_0, KC_1, KC_2, KC_3, KC_EQL, _______, OS_LGUI, OS_LALT, OS_LCTL, OS_LSFT, \ + KC_GRV, KC_4, KC_5, KC_6, KC_PIPE, _______, _______, _______, _______, _______, \ + NAV_SPC, OS_MEH, REPEAT, OS_LSFT + +// clang-format off +#define _SYM1 \ + KC_AT, KC_UNDS, KC_LBRC, KC_RBRC, KC_CIRC, KC_EXLM, KC_LT, KC_GT, KC_EQL, KC_AMPR, \ + KC_BSLS, KC_SLSH, KC_LCBR, KC_RCBR, KC_ASTR, KC_QUES, KC_LPRN, KC_RPRN, KC_MINS, KC_COLN, \ + KC_HASH, KC_DLR, KC_PIPE, KC_TILD, KC_GRV, KC_PLUS, KC_PERC, KC_DQUO, KC_QUOT, KC_SCLN, \ + NAV_SPC, OS_MEH, REPEAT, OS_LSFT + + +#define LAYOUT_FERRIS(...) LAYOUT(__VA_ARGS__) + diff --git a/src/users/fride/rules.mk b/src/users/fride/rules.mk index 3f4badf..951f029 100644 --- a/src/users/fride/rules.mk +++ b/src/users/fride/rules.mk @@ -1,4 +1,4 @@ -AUTO_SHIFT_ENABLE = yes +AUTO_SHIFT_ENABLE = no COMBO_ENABLE = yes MOUSEKEY_ENABLE = yes TAP_DANCE_ENABLE = no @@ -36,5 +36,5 @@ SRC += features/nshot_mod.c SRC += features/repeat_key.c SRC += features/custom_shift_keys.c SRC += features/tap_hold.c -SRC += features/achordion.c +# SRC += features/achordion.c SRC += fride.c