4 ///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION START /////
5 ///// (no need to edit this section) /////
6 //Enums used to clearly convey the state of the tap dance
12 DOUBLE_SINGLE_TAP = 5 //send SINGLE_TAP twice - NOT DOUBLE_TAP
13 // Add more enums here if you want for triple, quadruple, etc.
21 int cur_dance (qk_tap_dance_state_t *state) {
22 if (state->count == 1) {
23 //If count = 1, and it has been interrupted - it doesn't matter if it is pressed or not: Send SINGLE_TAP
24 if (state->interrupted || !state->pressed) return SINGLE_TAP;
25 if (state->interrupted) return SINGLE_TAP;
26 else return SINGLE_HOLD;
28 //If count = 2, and it has been interrupted - assume that user is trying to type the letter associated
30 else if (state->count == 2) {
31 if (state->interrupted) return DOUBLE_SINGLE_TAP;
32 else if (state->pressed) return DOUBLE_HOLD;
33 else return DOUBLE_TAP;
35 else return 6; //magic number. At some point this method will expand to work for more presses
37 ///// QUAD FUNCTION TAP DANCE GENERAL SETUP SECTION END /////
38 ///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION START /////
39 //instantialize an instance of 'tap' for the 'ENT' tap dance.
40 static tap ENTtap_state = {
41 .is_press_action = true,
45 void ENT_finished (qk_tap_dance_state_t *state, void *user_data) {
46 ENTtap_state.state = cur_dance(state);
47 switch (ENTtap_state.state) {
48 case SINGLE_TAP: register_code(KC_SPC); break;
49 case SINGLE_HOLD: register_code(KC_LSFT); break;
50 case DOUBLE_TAP: register_code(KC_ENT); break;
51 case DOUBLE_HOLD: register_code(KC_NO); break; // setting double hold to do nothing (change this if you want)
52 case DOUBLE_SINGLE_TAP: register_code(KC_SPC); unregister_code(KC_SPC); register_code(KC_SPC);
53 //Last case is for fast typing. Assuming your key is `f`:
54 //For example, when typing the word `buffer`, and you want to make sure that you send `ff` and not `Esc`.
55 //In order to type `ff` when typing fast, the next character will have to be hit within the `TAPPING_TERM`, which by default is 200ms.
59 void ENT_reset (qk_tap_dance_state_t *state, void *user_data) {
60 switch (ENTtap_state.state) {
61 case SINGLE_TAP: unregister_code(KC_SPC); break;
62 case SINGLE_HOLD: unregister_code(KC_LSFT); break;
63 case DOUBLE_TAP: unregister_code(KC_ENT); break;
64 case DOUBLE_HOLD: unregister_code(KC_NO);
65 case DOUBLE_SINGLE_TAP: unregister_code(KC_SPC);
67 ENTtap_state.state = 0;
70 //instanalize an instance of 'tap' for the 'DEL' tap dance.
71 static tap DELtap_state = {
72 .is_press_action = true,
76 void DEL_finished (qk_tap_dance_state_t *state, void *user_data) {
77 DELtap_state.state = cur_dance(state);
78 switch (DELtap_state.state) {
79 case SINGLE_TAP: register_code(KC_BSPC); break;
80 case SINGLE_HOLD: register_code(KC_LCTL); break;
81 case DOUBLE_TAP: register_code(KC_DEL); break;
82 case DOUBLE_HOLD: register_code(KC_NO); break;
83 case DOUBLE_SINGLE_TAP: register_code(KC_BSPC); unregister_code(KC_BSPC); register_code(KC_BSPC);
87 void DEL_reset (qk_tap_dance_state_t *state, void *user_data) {
88 switch (DELtap_state.state) {
89 case SINGLE_TAP: unregister_code(KC_BSPC); break;
90 case SINGLE_HOLD: unregister_code(KC_LCTL); break;
91 case DOUBLE_TAP: unregister_code(KC_DEL); break;
92 case DOUBLE_HOLD: unregister_code(KC_NO);
93 case DOUBLE_SINGLE_TAP: unregister_code(KC_BSPC);
95 DELtap_state.state = 0;
97 ///// QUAD FUNCTION TAP DANCE PERSONALIZATION SECTION END /////
99 //Tap Dance Definitions
100 //THIS SECTION HAS TO BE AT THE END OF THE TAP DANCE SECTION
101 qk_tap_dance_action_t tap_dance_actions[] = {
102 [TD_SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS)
103 // Other declarations would go here, separated by commas, if you have them
104 ,[TD_Q_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC)
105 ,[ENT_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ENT_finished, ENT_reset)
106 ,[DEL_TAP_DANCE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, DEL_finished, DEL_reset)
109 //In Layer declaration, add tap dance item in place of a key code