Skip to content

Commit

Permalink
symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
fride committed Jun 16, 2023
1 parent 3bb8ec4 commit 0894197
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/keymaps/totem/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{ R04, R03, R02, R01, R00 }, \
{ R14, R13, R12, R11, R10 }, \
{ R24, R23, R22, R21, R20 }, \
{ KC_NO, KC_NO, NUMWORD, R31, R30 }, \
{ KC_NO, KC_NO, OSL(NUM), R31, R30 }, \
}


Expand Down
72 changes: 58 additions & 14 deletions src/users/fride/combos.def
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@
// 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!
// Horizontal Combos
COMB( combo_canel, CANCEL, KC_S, KC_I)
COMB( CMB_BOOT, QK_BOOT, KC_V, KC_QUOT)
COMB( COMBO_Q, KC_Q, KC_V, KC_M)
COMB( combo_enter, KC_ENTER, HM_N, HM_E, HM_A)
COMB( COMBO_ESC, ESC_SYM, HM_R, HM_D)
COMB( combo_tab, KC_TAB, HM_T, HM_R, HM_D)
COMB( COMBO_COLON, CLN_NUM, HM_N, HM_E)
COMB( COMBO_SCOLON, KC_SCLN, HM_N, KC_COMM)


COMB( COMBO_LBRC, KC_LBRC, MAGIC, KC_U)
COMB( COMBO_RBRC, KC_RBRC, KC_U, KC_O)
COMB( COMBO_SLSH, KC_SLSH, KC_COMM, KC_DOT)
COMB( COMBO_MINS, KC_MINS, MAGIC, KC_O)
COMB( COMBO_EQL, KC_EQL, MAGIC, KC_O, KC_U)


// thumb combos
COMB (CMB_NUMWORD, NUMWORD, NAV_SPC, OS_LSFT)
Expand All @@ -17,11 +31,43 @@ 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)
COMB( COMBO_1, KC_1, OS_LSFT, HM_D)
COMB( COMBO_3, KC_3, OS_LSFT, HM_R)
COMB( COMBO_5, KC_5, OS_LSFT, HM_T)
COMB( COMBO_7, KC_7, OS_LSFT, HM_S)
COMB( COMBO_9, KC_9, OS_LSFT, KC_G)
// one shot symbols on thumbs

COMB( COMB_TILD, KC_TILD, OS_LSFT,KC_V)
COMB( COMB_PLUS, KC_PLUS, OS_LSFT,KC_M)
COMB( COMB_ASTR, KC_ASTR, OS_LSFT,KC_L)
COMB( COMB_EXLM, KC_EXLM, OS_LSFT,KC_C)

COMB( COMB_HASH, KC_HASH, NAV_SPC,MAGIC)
COMB( COMB_AT, KC_AT, NAV_SPC,KC_U)
COMB( COMB_CIRC, KC_CIRC, NAV_SPC,KC_O)

COMB( COMB_PIPE, KC_PIPE, OS_LSFT,HM_S)
COMB( COMB_LCBR, KC_LCBR, OS_LSFT,HM_T)
COMB( COMB_RCBR, KC_RCBR, OS_LSFT,HM_R)
COMB( COMB_MINS, KC_MINS, OS_LSFT,HM_D)
COMB( COMB_BSLS, KC_BSLS, OS_LSFT,KC_Y)

COMB( COMB_GRV, KC_GRV, NAV_SPC,KC_F)
COMB( COMB_QUES, KC_QUES, NAV_SPC,HM_N)
COMB( COMB_LBRC, KC_LBRC, NAV_SPC,HM_E)
COMB( COMB_RBRC, KC_RBRC, NAV_SPC,HM_A)

COMB( COMB_LT, KC_LT, OS_LSFT,KC_K)
COMB( COMB_GT, KC_GT, OS_LSFT,KC_J)
COMB( COMB_PERC, KC_PERC, OS_LSFT,KC_G)
COMB( COMB_NO, KC_NO, OS_LSFT,KC_W)

COMB( COMB_SLSH, KC_SLSH, NAV_SPC,KC_Z)
COMB( COMB_AMPR, KC_AMPR, NAV_SPC,KC_H)
COMB( COMB_LPRN, KC_LPRN, NAV_SPC,KC_COMM)
COMB( COMB_RPRN, KC_RPRN, NAV_SPC,KC_DOT)




Expand All @@ -30,18 +76,16 @@ COMB( COMBO_9, KC_9, NAV_SPC, KC_G)



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, HM_T, HM_R)
COMB( COMBO_RCTL, OS_LCTL, HM_E, HM_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)





// both primary thumbs. Because why not!?
Expand Down
49 changes: 49 additions & 0 deletions src/users/fride/features/layermodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,52 @@ void process_num_word(uint16_t keycode, const keyrecord_t *record) {
}
}
}



/*--------- Sym Mode ---------------*/
static bool _sym_mode_active = false;
static uint16_t sym_mode_timer;

// Turn sym mode on. To be called from a custom keycode.
void process_sym_word_activation(keyrecord_t *record) {
if (record->event.pressed) {
layer_on(SYM);
sym_mode_timer = timer_read();
} else {
if (timer_elapsed(sym_mode_timer) < TAPPING_TERM) {
// Tapping enables layer mode
_sym_mode_active = true;
} else {
// Holding treats as a normal LT
layer_off(SYM);
}
}
}

// Turn sym mode off.
void sym_mode_disable(void) {
_sym_mode_active = false;
layer_off(SYM);
}

void sym_mode_process(uint16_t keycode, keyrecord_t *record){
// todo possum strip keycode from lt/modtaps if needed

// Assess if we should exit layermode or continue processing normally.
if(_sym_mode_active) {

switch (keycode) {
case NAV_SPC:
case KC_ENTER:
case KC_RETURN:
case KC_TAB:
if (!record->event.pressed) {
sym_mode_disable();
}
break;
default:
break;
}
}
}
11 changes: 11 additions & 0 deletions src/users/fride/features/layermodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ void disable_num_word(void);
void process_num_word_activation(const keyrecord_t *record);
// Process numword, to be placed in process user
void process_num_word(uint16_t keycode, const keyrecord_t *record);


/* -------- Sym Mode -------- */
// Turn Sym mode on. To be called from a custom keycode.
void process_sym_word_activation(keyrecord_t *record);

// Turn sym mode off.
void sym_mode_disable(void);

// Handle each key for sym mode.
void sym_mode_process(uint16_t keycode, keyrecord_t *record);
27 changes: 22 additions & 5 deletions src/users/fride/fride.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include "layout.h"

const custom_shift_key_t custom_shift_keys[] = {
{KC_DOT, KC_QUES}, // Shift . is ?
{KC_COMM, KC_EXLM},
{KC_EQL, KC_EQL}, // Don't shift =
{KC_SLSH, KC_SLSH}, // Don't shift /
{KC_DOT, KC_EXLM},
{KC_COMM, KC_QUES},
// {KC_EQL, KC_EQL}, // Don't shift =
// {KC_SLSH, KC_SLSH}, // Don't shift /
};
uint8_t NUM_CUSTOM_SHIFT_KEYS =
sizeof(custom_shift_keys) / sizeof(*custom_shift_keys);
Expand Down Expand Up @@ -127,6 +127,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
}

process_num_word(keycode, record);
sym_mode_process(keycode, record);

update_swapper(&sw_app_active, KC_LGUI, KC_TAB, SW_APP, keycode, record,
wap_app_cancel);
Expand Down Expand Up @@ -214,6 +215,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
case NUMWORD:
process_num_word_activation(record);
return false;
case SYMWORD:
process_sym_word_activation(record);
return false;
case MAGIC: {
if (record->tap.count > 0) {
tap_code16(ALTREP);
Expand All @@ -222,6 +226,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
return true;
}
}
case CLN_NUM: {
if (record->event.pressed && record->tap.count > 0) {
tap_code16(KC_COLON);
return false;
}
break;
}
case ESC_SYM: {
if (record->event.pressed && record->tap.count > 0) {
tap_code16(KC_ESC);
return false;
}
break;
}
case A_UML:
if (record->event.pressed) {
// TODO SHIFT!
Expand Down Expand Up @@ -295,7 +313,6 @@ bool tap_hold(uint16_t keycode) {
case KC_UP:
case KC_DOWN:
case KC_RIGHT:

case CPYPASTE:
return true;
}
Expand Down
27 changes: 12 additions & 15 deletions src/users/fride/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum custom_keycodes {
CAPSWORD,
MINS,
NUMWORD,
SYMWORD,
SENTENCE,
CAMEL,
KEBAB,
Expand Down Expand Up @@ -106,9 +107,9 @@ enum custom_keycodes {
#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 ESC_SYM LT(SYM, KC_ESC)
#define CLN_NUM LT(SYM, KC_COLON)

#define OS_SYM OSL(SYM)
#define OS_MEH OSM(MOD_MEH)

Expand All @@ -134,7 +135,7 @@ enum custom_keycodes {
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_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
NAV_SPC, OSL(SYM), NUMWORD, OS_LSFT

// clang-format off
#define _NAV \
Expand All @@ -145,21 +146,17 @@ enum custom_keycodes {

// clang-format off
#define _NUM \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
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, \
KC_7, KC_5, KC_3, KC_1, KC_9, KC_8, KC_0, KC_2, KC_4, KC_6, \
KC_NO, KC_LT, KC_GT, KC_NO, KC_PIPE, KC_BSLS, KC_LCBR, KC_LPRN,KC_RPRN, KC_RCBR, \
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_PAST,KC_EQL, KC_PLUS, \
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 \
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, \
KC_TILD, KC_PLUS, KC_ASTR, KC_EXLM, KC_NO, KC_NO, KC_HASH, KC_AT, KC_CIRC, KC_NO, \
KC_PIPE, KC_LCBR, KC_RCBR, KC_MINS, KC_PIPE, KC_GRV, KC_QUES, KC_LBRC, KC_RBRC, KC_NO, \
KC_NO, KC_LT, KC_GT, KC_PERC, KC_NO, KC_SLSH, KC_AMPR, KC_LPRN, KC_RPRN, KC_UNDS, \
NAV_SPC, OS_MEH, REPEAT, OS_LSFT


Expand Down

0 comments on commit 0894197

Please sign in to comment.