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 | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c index 4a30d75..8c1e4e9 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c @@ -34,7 +34,7 @@ td_state_t cur_dance(tap_dance_state_t *state) { if (state->count == 1) { // The function can be called when the delay is over, or because of - // another tap. + // another tap. // I do not check here if the delay is over, as soon as another tap // occurs, I check the state of the key and switch in hold mode if the // key is still pressed. @@ -77,16 +77,19 @@ static td_tap_t w_tap_state = { 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: + case TD_SINGLE_TAP: register_code(BP_W); break; case TD_DOUBLE_TAP: + caps_word_on(); + break; case TD_DOUBLE_SINGLE_TAP: - caps_word_on(); + 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); + case TD_SINGLE_HOLD: + case TD_DOUBLE_HOLD: + caps_word_off(); + register_code(KC_RIGHT_SHIFT); break; default: break; } @@ -96,7 +99,10 @@ 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); break; + case TD_DOUBLE_SINGLE_TAP: + unregister_code(BP_W); + unregister_code(BP_W); + break; default: break; } w_tap_state.state = TD_NONE; @@ -108,9 +114,10 @@ void w_reset(tap_dance_state_t *state, void *user_data) { // The only one usage is to activate the layer over the keyboard, but there is // two way of doing it: // -// The first mode, when hold, is to activate the layer as long as the key is pressed. -// The second one is to switch in the layer mode when double tapped, in this -// mode, you can go back into the normal layer by a single press on the key. +// The first mode, when hold, is to activate the layer as long as the key is +// pressed. +// The second one is to switch in the layer mode when tapped, in this mode, +// 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, @@ -121,11 +128,10 @@ static td_tap_t ql_tap_state = { void ql_finished(tap_dance_state_t *state, void *user_data) { ql_tap_state.state = cur_dance(state); switch (ql_tap_state.state) { - // Remove the layer with a single tap, this way I always have a key to remove the - // the layer, without knowing the previous state I had. - case TD_SINGLE_TAP: layer_off(LAYER_SYMBOLS); break; + // Remove the layer with a single tap, this way I always have a key to + // remove the the layer, without knowing the previous state I had. + case TD_SINGLE_TAP: layer_invert(LAYER_SYMBOLS); break; case TD_SINGLE_HOLD: layer_on(LAYER_SYMBOLS); break; - case TD_DOUBLE_TAP: layer_invert(LAYER_SYMBOLS); break; default: break; } } @@ -137,6 +143,3 @@ void ql_reset(tap_dance_state_t *state, void *user_data) { } ql_tap_state.state = TD_NONE; } - -// -// |