fix tapdance

This commit is contained in:
♥ Minnie ♥ 2023-02-04 20:40:25 +08:00
parent 8eb6ff36a7
commit f84f3e9172
No known key found for this signature in database
GPG key ID: 3FF749264D02B336
2 changed files with 24 additions and 18 deletions

View file

@ -26,6 +26,10 @@
#define OS_RALT OSM(MOD_RALT)
#define OS_RGUI OSM(MOD_RGUI)
// Tap Dance
#define TD_YANK TD(YANK)
#define TD_PSTE TD(PSTE)
// Left-hand home row mods
#define HOME_C LGUI_T(KC_C)
#define HOME_R LALT_T(KC_R)

View file

@ -42,8 +42,8 @@ enum custom_keycodes {
};
enum td_keycodes {
TD_YANK,
TD_PSTE
YANK,
PSTE
};
enum combos {
@ -409,12 +409,12 @@ void yank_finished(qk_tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case TD_SINGLE_TAP:
register_code(KC_LCTL);
register_mods(MOD_BIT(KC_LCTL));
register_code(KC_C);
break;
case TD_DOUBLE_TAP:
register_code(KC_LCTL);
register_code(KC_LSFT);
register_mods(MOD_BIT(KC_LCTL));
register_mods(MOD_BIT(KC_LSFT));
register_code(KC_C);
break;
default:
@ -425,12 +425,12 @@ void yank_finished(qk_tap_dance_state_t *state, void *user_data) {
void yank_reset(qk_tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case TD_SINGLE_TAP:
unregister_code(KC_LCTL);
unregister_mods(MOD_BIT(KC_LCTL));
unregister_code(KC_C);
break;
case TD_DOUBLE_TAP:
unregister_code(KC_LCTL);
unregister_code(KC_LSFT);
unregister_mods(MOD_BIT(KC_LCTL));
unregister_mods(MOD_BIT(KC_LSFT));
unregister_code(KC_C);
break;
default:
@ -442,12 +442,12 @@ void pste_finished(qk_tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case TD_SINGLE_TAP:
register_code(KC_LCTL);
register_mods(MOD_BIT(KC_LCTL));
register_code(KC_V);
break;
case TD_DOUBLE_TAP:
register_code(KC_LCTL);
register_code(KC_LSFT);
register_mods(MOD_BIT(KC_LCTL));
register_mods(MOD_BIT(KC_LSFT));
register_code(KC_V);
break;
default:
@ -458,12 +458,12 @@ void pste_finished(qk_tap_dance_state_t *state, void *user_data) {
void pste_reset(qk_tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case TD_SINGLE_TAP:
unregister_code(KC_LCTL);
unregister_mods(MOD_BIT(KC_LCTL));
unregister_code(KC_V);
break;
case TD_DOUBLE_TAP:
unregister_code(KC_LCTL);
unregister_code(KC_LSFT);
unregister_mods(MOD_BIT(KC_LCTL));
unregister_mods(MOD_BIT(KC_LSFT));
unregister_code(KC_V);
break;
default:
@ -473,8 +473,8 @@ void pste_reset(qk_tap_dance_state_t *state, void *user_data) {
// Define `ACTION_TAP_DANCE_FN_ADVANCED()` for each tapdance keycode, passing in `finished` and `reset` functions
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_YANK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, yank_finished, yank_reset),
[TD_PSTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, pste_finished, pste_reset)
[YANK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, yank_finished, yank_reset),
[PSTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, pste_finished, pste_reset)
};
@ -511,7 +511,9 @@ bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
/* Layer Change */
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, L_LOWER, L_RAISE, L_ADJUST);
state = update_tri_layer_state(state, L_NUMBERS, L_SYMBOLS, L_OPERATORS);
state = update_tri_layer_state(state, L_LOWER, L_RAISE, L_ADJUST);
return state;
}