Skip to content

Commit

Permalink
Homerows with Archordion (getreuer#4)
Browse files Browse the repository at this point in the history
* home row mods

* home row mods, better than I thought.

* Number layout.
  • Loading branch information
fride authored Jun 15, 2023
1 parent d0d8d84 commit 3bb8ec4
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 74 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# totem-qmk
Keymap for the wired Totem


## Inspiration
- https://github.com/pixelbreaker/qmk_userspace

# Old Combos:

```
Expand Down
57 changes: 27 additions & 30 deletions src/keymaps/redox/keymap.c
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
#include QMK_KEYBOARD_H
#include "keycodes.h"
#include "layers.h"
#include "layout.h"
#include "g/keymap_combo.h"

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_ALPHA] = LAYOUT(
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
KC_NO ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,KC_NO ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_TAB ,ALPHA_00,ALPHA_01,ALPHA_02,ALPHA_03,ALPHA_04,KC_NO , KC_NO ,ALPHA_05,ALPHA_06,ALPHA_07,ALPHA_08,ALPHA_09,KC_EQL ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_ESC ,ALPHA_10,ALPHA_11,ALPHA_12,ALPHA_13,ALPHA_14,KC_LBRC , KC_RBRC ,ALPHA_15,ALPHA_16,ALPHA_17,ALPHA_18,ALPHA_19,KC_NO ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_LSFT ,ALPHA_20,ALPHA_21,ALPHA_22,ALPHA_23,ALPHA_24,KC_NO , KC_NO , KC_NO , KC_NO , ALPHA_25,ALPHA_26,ALPHA_27,ALPHA_28,ALPHA_29 ,KC_RSFT ,
//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤
KC_LGUI ,OS_LCTL, OS_LALT ,OS_LGUI , ALPHA_31, ALPHA_32,KC_NO, KC_NO, KC_NO, ALPHA_34, ALPHA_35 ,OS_LALT ,OS_LCTL ,KC_RGHT
//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘
),
[_NAV]= LAYOUT(
//┌────────┬────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┬────────┐
KC_NO ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_NO ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_TAB ,NAV_00, NAV_01, NAV_02, NAV_03, NAV_04, KC_F11 , KC_F12 , NAV_05, NAV_06, NAV_07, NAV_08, NAV_09, KC_EQL ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_ESC ,NAV_10, NAV_11, NAV_12, NAV_13, NAV_14, KC_LBRC , KC_RBRC ,NAV_15, NAV_16, NAV_17, NAV_18, NAV_19, KC_NO ,
//├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┐ ┌────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤
KC_LSFT ,NAV_20, NAV_21, NAV_22, NAV_23, NAV_24, KC_NO , KC_NO , KC_NO , KC_NO , NAV_25, NAV_26, NAV_27, NAV_28, NAV_29 ,KC_RSFT ,
//├────────┼────────┼────────┼────────┼────┬───┴────┬───┼────────┼────────┤ ├────────┼────────┼───┬────┴───┬────┼────────┼────────┼────────┼────────┤
KC_LGUI ,OS_LCTL, OS_LALT ,OS_LGUI , ALPHA_30, ALPHA_31,ALPHA_32, ALPHA_33,ALPHA_34, ALPHA_35, OS_LGUI ,OS_LALT ,OS_LCTL ,KC_RGHT
//└────────┴────────┴────────┴────────┘ └────────┘ └────────┴────────┘ └────────┴────────┘ └────────┘ └────────┴────────┴────────┴────────┘
)
};
#define REDOX(k) CONV_REDOX(k)
#define CONV_REDOX( \
k15, k16, k17, k18, k19, k22, k23, k24, k25, k26, \
k29, k30, k31, k32, k33, k36, k37, k38, k39, k40, \
k43, k44, k45, k46, k47, k50, k51, k52, k53, k54, \
k60, k61, k64, k65 \
) \
{ \
{ KC_GRV, KC_7, KC_5, KC_3, KC_1, KC_9, KC_NO }, \
{ KC_TAB, k15, k16, k17, k18, k19, KC_NO }, \
{ KC_ESC, k29, k30, k31, k32, k33, KC_NO }, \
{ OS_LSFT, k43, k44, k45, k46, k47, KC_NO }, \
{ OS_LCTL, KC_NO, KC_NO, KC_NO, k60, k61, OS_LSFT }, \
{ KC_SLSH, KC_6, KC_4, KC_2, KC_0, KC_8, KC_NO }, \
{ KC_MINS, k26, k25, k24, k23, k22, KC_NO }, \
{ KC_BSPC, k40, k39, k38, k37, k36, KC_NO }, \
{ KC_ENTER, k54, k53, k52, k51, k50, KC_NO }, \
{ OS_LCTL, KC_NO, KC_NO, KC_NO, k65, k64, OS_LSFT } \
}

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[ALPHA] = REDOX(_BASE),
[NAV] = REDOX(_NAV),
[NUM] = REDOX(_NUM),
[SYM] = REDOX(_SYM1)
};
6 changes: 3 additions & 3 deletions src/keymaps/totem/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
{ L00, L01, L02, L03, L04 }, \
{ L10, L11, L12, L13, L14 }, \
{ L20, L21, L22, L23, L24 }, \
{ KC_NO, KC_NO, KC_NO, L33, L34 }, \
{ KC_NO, KC_NO, OSL(SYM), 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 }, \
{ KC_NO, KC_NO, NUMWORD, R31, R30 }, \
}


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[ALPHA] = TOTEM(_BASE),
[NAV] = TOTEM(_NAV),
[NUM] = TOTEM(_NUM),
[SYM1] = TOTEM(_SYM1)
[SYM] = TOTEM(_SYM1)
};
39 changes: 20 additions & 19 deletions src/users/fride/combos.def
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Layout key reference
// 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
// HM_S, HM_T, HM_R, HM_D, KC_Y, KC_F HM_N, HM_E, HM_A, HM_I
// KC_X, KC_K, KC_J, KC_G, KC_W, KC_Z KC_H, KC_COMM, KC_DOT, KC_UNDS
// NAV_SPC, ____, ___, REPEAT

Expand All @@ -9,18 +9,19 @@ 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)
COMB (CMB_NUMWORD, NUMWORD, NAV_SPC, 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_0, KC_0, OS_LSFT, HM_N)
COMB( COMBO_2, KC_2, OS_LSFT, HM_E)
COMB( COMBO_4, KC_4, OS_LSFT, HM_A)
COMB( COMBO_6, KC_6, OS_LSFT, HM_I)
COMB( COMBO_8, KC_8, OS_LSFT, KC_H)

COMB( COMBO_1, KC_1, NAV_SPC, HM_D)
COMB( COMBO_3, KC_3, NAV_SPC, HM_R)
COMB( COMBO_5, KC_5, NAV_SPC, HM_T)
COMB( COMBO_7, KC_7, NAV_SPC, HM_S)
COMB( COMBO_9, KC_9, NAV_SPC, KC_G)



Expand All @@ -29,15 +30,15 @@ COMB( COMBO_9, KC_9, KC_A, KC_C)



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)
COMB( combo_enter, KC_ENTER, HM_N, HM_E, HM_A)
COMB( COMBO_ESC, KC_ESC, HM_R, HM_D)
COMB( combo_tab, KC_TAB, HM_T, HM_R, HM_D)
COMB( COMBO_COLON, KC_COLON, HM_N, HM_E)
COMB( COMBO_SCOLON, KC_SCLN, HM_N, KC_COMM)

// ctrl and shift
COMB( COMBO_LCTL, OS_LCTL, KC_T, KC_R)
COMB( COMBO_RCTL, OS_LCTL, KC_E, KC_A)
COMB( COMBO_LCTL, OS_LCTL, HM_T, HM_R)
COMB( COMBO_RCTL, OS_LCTL, HM_E, HM_A)

// Letters
COMB( COMBO_Q, KC_Q, KC_V, KC_M)
Expand Down
58 changes: 43 additions & 15 deletions src/users/fride/fride.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "features/repeat_key.h"
#include "features/swapper.h"
#include "features/tap_hold.h"
#include "features/achordion.h"
#include "layout.h"

const custom_shift_key_t custom_shift_keys[] = {
Expand Down Expand Up @@ -36,23 +37,23 @@ 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 KC_A:
case HM_A:
return KC_O;
case KC_B:
return KC_N; // TODO BEFORE
case KC_C: // C
return KC_Y;
case KC_D:
case HM_D:
return KC_Y;
case KC_E:
case HM_E:
return KC_U;
case KC_F:
return KC_N;
case KC_N:
case HM_N:
return KC_F; // Fuenf!
case KC_G:
return KC_Y;
case KC_I:
case HM_I:
return MG_ION;
case KC_J:
return MG_UST;
Expand All @@ -66,11 +67,11 @@ uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) {
return KC_A;
case KC_P:
return KC_Y;
case KC_R:
case HM_R:
return KC_L;
case KC_S:
case HM_S:
return KC_K;
case KC_T:
case HM_T:
return KC_M; //ment does not work that well with german
case KC_U:
return KC_E;
Expand Down Expand Up @@ -120,7 +121,8 @@ bool get_repeat_key_eligible_user(uint16_t keycode, keyrecord_t *record,
}

bool process_record_user(uint16_t keycode, keyrecord_t* record) {
if (!process_repeat_key_with_alt(keycode, record, REPEAT, ALTREP)) {
if (!process_achordion(keycode, record)) { return false; }
if (!process_repeat_key_with_alt(keycode, record, REPEAT, ALTREP)) {
return false;
}

Expand Down Expand Up @@ -202,17 +204,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
// stop_leading();
layer_off(NAV);
layer_off(NUM);
layer_off(SYM1);
layer_off(SYM);
//disable_caps_word();
disable_num_word();
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;
Expand Down Expand Up @@ -364,4 +362,34 @@ uint16_t get_combo_term(uint16_t index, combo_t *combo) {
bool get_combo_must_tap(uint16_t index, combo_t *combo) {

return false;
}

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 in Magic Sturdy.
switch (tap_hold_keycode) {
case NAV_SPC:
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;
}

// Otherwise, follow the opposite hands rule.
return achordion_opposite_hands(tap_hold_record, other_record);
}
uint16_t achordion_timeout(uint16_t tap_hold_keycode) {
switch (tap_hold_keycode) {
case KC_X:
// case HOME_SC:
// case QHOME_Z:
//case QHOME_SL:
return 0; // Bypass Achordion for these keys.
}

return 1000; // Otherwise use a timeout of 1 second
}
28 changes: 22 additions & 6 deletions src/users/fride/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ enum layers {
ALPHA,
ALPHA2,
NUM,
SYM1,
SYM2,
SYM,
MODS,
FUN,
NAV
Expand Down Expand Up @@ -113,6 +112,18 @@ enum custom_keycodes {
#define OS_SYM OSL(SYM)
#define OS_MEH OSM(MOD_MEH)

// Mod tap macros
#define HM_S LSFT_T(KC_S)
#define HM_T LCTL_T(KC_T)
#define HM_R LALT_T(KC_R)
#define HM_D LGUI_T(KC_D)
#define HM_N RGUI_T(KC_N)
#define HM_E RALT_T(KC_E)
#define HM_A LCTL_T(KC_A)
#define HM_I RSFT_T(KC_I)
// does not work with the totem ;)
// #define HRML(k1, k2, k3, k4) LT(SYM,k1), LCTL_T(k2), LALT_T(k3), LGUI_T(k4)
// #define HRMR(k1, k2, k3, k4) RGUI_T(k1), RALT_T(k2), LCTL_T(k3), LT(SYM, k4)

#define _______ KC_NO
#define ___________________________________________ _______, _______, _______, _______, _______
Expand All @@ -121,7 +132,7 @@ enum custom_keycodes {
// 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, \
HM_S, HM_T, HM_R, HM_D, KC_Y, KC_F, HM_N, HM_E, HM_A, HM_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

Expand All @@ -134,10 +145,15 @@ enum custom_keycodes {

// 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, _______, _______, _______, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
KC_7, KC_5, KC_3, KC_1, _______, _______, KC_0, KC_2, KC_4, KC_6, \
_______, _______, _______, KC_9, _______, _______, KC_8, KC_COMM,KC_DOT, KC_UNDS, \
NAV_SPC, OS_MEH, REPEAT, OS_LSFT
// #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 \
Expand Down
2 changes: 1 addition & 1 deletion src/users/fride/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3bb8ec4

Please sign in to comment.