This commit is contained in:
Drew Whitney 2025-11-15 23:08:09 -07:00
commit 455a63f75d
4 changed files with 36 additions and 19 deletions

View file

@ -11,6 +11,7 @@ enum CustomKeycodes {
}; };
#define TD_CLS TD(TD_CAD_LOCK_SLEEP) #define TD_CLS TD(TD_CAD_LOCK_SLEEP)
#define GAME TD(TD_GAMER_MODE)
#define COMPOSE KC_SCRL #define COMPOSE KC_SCRL
// keys // keys
#define CAD C(A(KC_DEL)) #define CAD C(A(KC_DEL))
@ -25,7 +26,6 @@ enum CustomKeycodes {
#define SYM_ENT LT(_SYM, KC_ENT) #define SYM_ENT LT(_SYM, KC_ENT)
#define NAV_CANCEL LT(_NAV, KC_NO) // have to implement this functionality #define NAV_CANCEL LT(_NAV, KC_NO) // have to implement this functionality
#define NUM MO(_NUM) #define NUM MO(_NUM)
#define GAME MO(_GAME)
#define LAUNCH_NUM LT(_SH_NUM, LAUNCH) #define LAUNCH_NUM LT(_SH_NUM, LAUNCH)
#define COMP_ARROW LT(_SH_ARROW, COMPOSE) #define COMP_ARROW LT(_SH_ARROW, COMPOSE)

View file

@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ ├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ //├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ ├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
KC_TRNS, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_TRNS, KC_TRNS, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_TRNS,
//├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┐ ┌───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤ //├───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┐ ┌───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
KC_TRNS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, KC_TRNS, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_TRNS, KC_TRNS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAME), KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_TRNS,
//└───────────┴───────────┴───────────┴─────┬─────┴─────┬─────┴─────┬─────┴────┬──────┘ └─────┬─────┴─────┬─────┴─────┬─────┴─────┬─────┴───────────┴───────────┴───────────┘ //└───────────┴───────────┴───────────┴─────┬─────┴─────┬─────┴─────┬─────┴────┬──────┘ └─────┬─────┴─────┬─────┴─────┬─────┴─────┬─────┴───────────┴───────────┴───────────┘
KC_ESC, KC_I, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS KC_ESC, KC_I, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS
// └───────────┴───────────┴──────────┘ └───────────┴───────────┴───────────┘ // └───────────┴───────────┴──────────┘ └───────────┴───────────┴───────────┘
@ -112,6 +112,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
tap_dance_action_t tap_dance_actions[] = { tap_dance_action_t tap_dance_actions[] = {
[TD_CAD_LOCK_SLEEP] = ACTION_TAP_DANCE_FN(CAD_lock_sleep), [TD_CAD_LOCK_SLEEP] = ACTION_TAP_DANCE_FN(CAD_lock_sleep),
[TD_GAMER_MODE] = ACTION_TAP_DANCE_FN(enter_gamer_mode),
}; };
const uint16_t PROGMEM num_layer_combo[] = {NAV_CANCEL, SYM_ENT, COMBO_END}; const uint16_t PROGMEM num_layer_combo[] = {NAV_CANCEL, SYM_ENT, COMBO_END};
@ -123,30 +124,31 @@ combo_t key_combos[] = {
}; };
bool process_record_user(uint16_t keycode, keyrecord_t* record) { bool process_record_user(uint16_t keycode, keyrecord_t* record) {
static bool NAV_is_on = false; // static bool NAV_is_on = false;
switch (keycode) { switch (keycode) {
// allow the SYM and NAV layers to override each other // allow the SYM and NAV layers to override each other
case SYM_ENT: // case SYM_ENT:
if (!record->tap.count) { // if (!record->tap.count) {
// if NAV is on, turn it off when SYM is turned on, then restore it when SYM // // if NAV is on, turn it off when SYM is turned on, then restore it when SYM
// is turned off // // is turned off
// if we're NUM-latched, don't interfere with the states // // if we're NUM-latched, don't interfere with the states
if (NAV_is_on) { // if (NAV_is_on) {
record->event.pressed && !NUM_latched ? layer_off(_NAV) : layer_on(_NAV); // record->event.pressed && !NUM_latched ? layer_off(_NAV) : layer_on(_NAV);
} // }
} // }
break; // break;
case NAV_CANCEL: // allow oneshot mods to be canceled by pressing this key case NAV_CANCEL: // allow oneshot mods to be canceled by pressing this key
if (!record->tap.count) { if (record->tap.count) {
NAV_is_on = record->event.pressed; // track NAV's state for SYM
} else {
if (record->event.pressed) { if (record->event.pressed) {
clear_oneshot_mods(); clear_oneshot_mods();
} }
return false; return false;
} }
// else {
// NAV_is_on = record->event.pressed; // track NAV's state for SYM
// }
break; break;
case WIN_SWAP: // easy Alt-Tab case WIN_SWAP: // easy Alt-Tab
@ -169,7 +171,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
case OSO_SHIFT: // make thumb shift oneshot-only case OSO_SHIFT: // make thumb shift oneshot-only
if (record->event.pressed) { if (record->event.pressed) {
set_oneshot_mods(MOD_BIT(KC_LSFT)); (!get_oneshot_mods() && MOD_BIT(KC_LSFT) ? add_oneshot_mods
: del_oneshot_mods)(MOD_BIT(KC_LSFT));
} }
break; break;
} }

View file

@ -11,8 +11,20 @@ void CAD_lock_sleep(tap_dance_state_t* state, void*) {
break; break;
case 3: case 3:
tap_code16(KC_SLEP); tap_code16(KC_SLEP);
default:
reset_tap_dance(state); reset_tap_dance(state);
break; break;
} }
} }
void enter_gamer_mode(tap_dance_state_t* state, void*) {
switch (state->count) {
case 1:
break;
case 2:
break;
case 3:
layer_on(_GAME);
reset_tap_dance(state);
break;
}
}

View file

@ -4,6 +4,8 @@
enum { enum {
TD_CAD_LOCK_SLEEP, TD_CAD_LOCK_SLEEP,
TD_GAMER_MODE,
}; };
void CAD_lock_sleep(tap_dance_state_t* state, void*); void CAD_lock_sleep(tap_dance_state_t* state, void*);
void enter_gamer_mode(tap_dance_state_t* state, void*);