diff options
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c')
| -rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c | 66 |
1 files changed, 6 insertions, 60 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c index 8c1e4e9..65e4e01 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c @@ -40,75 +40,22 @@ td_state_t cur_dance(tap_dance_state_t *state) { // key is still pressed. // if (!state->pressed) return TD_SINGLE_TAP; - // Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'. + // Key has not been interrupted, but the key is still held. + // Means you want to send a 'HOLD'. else return TD_SINGLE_HOLD; } else if (state->count == 2) { - // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap - // action when hitting 'pp'. Suggested use case for this return value is when you want to send two + // TD_DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", + // and actually wanting a double tap + // action when hitting 'pp'. Suggested use case for this return value + // is when you want to send two // keystrokes of the key, and not the 'double tap' action/macro. if (state->interrupted) return TD_DOUBLE_SINGLE_TAP; else if (state->pressed) return TD_DOUBLE_HOLD; else return TD_DOUBLE_TAP; - } - - // Assumes no one is trying to type the same letter three times (at least not quickly). - // If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add - // an exception here to return a 'TD_TRIPLE_SINGLE_TAP', and define that enum just like 'TD_DOUBLE_SINGLE_TAP' - if (state->count == 3) { - if (state->interrupted || !state->pressed) return TD_TRIPLE_TAP; - else return TD_TRIPLE_HOLD; } else return TD_UNKNOWN; } // -// Definition for the key W. -// -// The main usage is to send the letter W when pressed, but the key is also -// used to activate the SHIFT mode when pressed. -// -// If the key is double tapped, it will also switch into the caps_word mode. -// - -static td_tap_t w_tap_state = { - .is_press_action = true, - .state = TD_NONE -}; - -void w_finished(tap_dance_state_t *state, void *user_data) { - w_tap_state.state = cur_dance(state); - switch (w_tap_state.state) { - case TD_SINGLE_TAP: - register_code(BP_W); break; - case TD_DOUBLE_TAP: - caps_word_on(); - break; - case TD_DOUBLE_SINGLE_TAP: - register_code(BP_W); - register_code(BP_W); - break; - case TD_SINGLE_HOLD: - case TD_DOUBLE_HOLD: - caps_word_off(); - register_code(KC_RIGHT_SHIFT); - break; - default: break; - } -} - -void w_reset(tap_dance_state_t *state, void *user_data) { - switch (w_tap_state.state) { - case TD_SINGLE_TAP: unregister_code(BP_W); break; - case TD_SINGLE_HOLD: unregister_code(KC_RIGHT_SHIFT); break; - case TD_DOUBLE_SINGLE_TAP: - unregister_code(BP_W); - unregister_code(BP_W); - break; - default: break; - } - w_tap_state.state = TD_NONE; -} - -// // Definition for the layer key // // The only one usage is to activate the layer over the keyboard, but there is @@ -120,7 +67,6 @@ void w_reset(tap_dance_state_t *state, void *user_data) { // you can go back into the normal layer by a single press on the key. // static td_tap_t ql_tap_state = { - .is_press_action = true, .state = TD_NONE }; |
