6 SINGLE_TAP, SINGLE_HOLD, DOUBLE
7 } tap_dance_state_enum;
9 static tap_dance_state_enum tap_dance_state;
10 static bool tap_dance_active = false;
12 void tap_dance_layer_finished(qk_tap_dance_state_t *state, void *user_data) {
13 // Determine the current state
14 if (state->count == 1) {
15 if (state->interrupted || state->pressed == 0) tap_dance_state = SINGLE_TAP;
16 else tap_dance_state = SINGLE_HOLD;
18 // Handle any number of other taps as a VIM movement hold
19 tap_dance_state = DOUBLE;
22 switch (tap_dance_state) {
24 if (tap_dance_active) {
25 reset_oneshot_layer();
26 tap_dance_active = false;
28 set_oneshot_layer(SYMB, ONESHOT_START);
29 tap_dance_active = true;
42 void tap_dance_layer_reset(qk_tap_dance_state_t *state, void *user_data) {
43 switch(tap_dance_state) {
45 clear_oneshot_layer_state(ONESHOT_PRESSED);
56 qk_tap_dance_action_t tap_dance_actions[] = {
57 [TD_SYM_VIM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_layer_finished, tap_dance_layer_reset)
60 void tap_dance_process_record(uint16_t keycode) {
61 if (tap_dance_state == SINGLE_TAP && keycode != TD(TD_SYM_VIM)) {
62 tap_dance_active = false;
66 __attribute__ ((weak))
67 void matrix_init_rgb(void) {}
69 __attribute__ ((weak))
70 void layer_state_set_rgb(uint32_t state) {}
72 __attribute__ ((weak))
73 void matrix_scan_user_keyboard(void) {}
75 void matrix_scan_user() {
76 static bool first_run = true;
81 matrix_scan_user_keyboard();
84 uint32_t layer_state_set_user(uint32_t state) {
85 layer_state_set_rgb(state);