9 DOUBLE_SINGLE_TAP = 5, //send two single taps
20 int cur_dance (qk_tap_dance_state_t *state) {
21 if (state->count == 1) {
22 //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP
23 if (state->interrupted) {
24 // if (!state->pressed) return SINGLE_TAP;
25 //need "permissive hold" here.
26 // else return SINGLE_HOLD;
27 //If the interrupting key is released before the tap-dance key, then it is a single HOLD
28 //However, if the tap-dance key is released first, then it is a single TAP
29 //But how to get access to the state of the interrupting key????
33 if (!state->pressed) return SINGLE_TAP;
34 else return SINGLE_HOLD;
37 //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
39 else if (state->count == 2) {
40 if (state->interrupted) return DOUBLE_SINGLE_TAP;
41 else if (state->pressed) return DOUBLE_HOLD;
42 else return DOUBLE_TAP;
44 else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) return TRIPLE_TAP;
45 else if (state->count == 3) return TRIPLE_HOLD;
49 int hold_cur_dance (qk_tap_dance_state_t *state) {
50 if (state->count == 1) {
51 if (state->interrupted) {
52 if (!state->pressed) return SINGLE_TAP;
53 else return SINGLE_HOLD;
56 if (!state->pressed) return SINGLE_TAP;
57 else return SINGLE_HOLD;
60 //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
62 else if (state->count == 2) {
63 if (state->pressed) return DOUBLE_HOLD;
64 else return DOUBLE_TAP;
66 else if (state->count == 3) {
67 if (!state->pressed) return TRIPLE_TAP;
68 else return TRIPLE_HOLD;
73 // Send semi-colon + enter on two taps
74 void tap_dance_semicolon_finished(qk_tap_dance_state_t *state, void *user_data) {
75 tap_state.semicolon = hold_cur_dance(state);
76 switch (tap_state.semicolon) {
77 case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_SCLN); break;
78 case SINGLE_HOLD: layer_on(_NUM); break;
82 void tap_dance_semicolon_reset(qk_tap_dance_state_t *state, void *user_data) {
83 switch (tap_state.semicolon) {
84 case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_SCLN); break;
87 SEND_STRING(";;"); // send normal when mods are pressed
97 case SPECIAL: layer_invert(_NUM); break;
98 case SINGLE_HOLD: layer_off(_NUM); break;
100 tap_state.semicolon = 0;
104 void tap_dance_grave_finished(qk_tap_dance_state_t *state, void *user_data) {
105 switch(state->count) {
115 void tap_dance_grave_each(qk_tap_dance_state_t *state, void *user_data) {
116 if(state->count == 3) {
118 } else if (state->count > 3) {
124 void tap_dance_quote_finished(qk_tap_dance_state_t *state, void *user_data) {
125 tap_state.quote = hold_cur_dance(state);
126 switch (tap_state.quote) {
127 case SINGLE_TAP: case DOUBLE_HOLD: register_code(KC_QUOT); break;
128 case SINGLE_HOLD: layer_on(_NAV); break;
132 void tap_dance_quote_reset(qk_tap_dance_state_t *state, void *user_data) {
133 switch (tap_state.quote) {
134 case SINGLE_TAP: case DOUBLE_HOLD: unregister_code(KC_QUOTE); break;
135 case DOUBLE_TAP: SEND_STRING("\""); break;
136 case TRIPLE_TAP: layer_invert(_NAV); break;
137 case SINGLE_HOLD: layer_off(_NAV); break;
142 qk_tap_dance_action_t tap_dance_actions[] = {
143 [TD_SEMICOLON] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_semicolon_finished, tap_dance_semicolon_reset),
144 [TD_GRAVE] = ACTION_TAP_DANCE_FN_ADVANCED(tap_dance_grave_each, tap_dance_grave_finished, NULL),
145 [TD_QUOTE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_quote_finished, tap_dance_quote_reset),