summaryrefslogtreecommitdiff
path: root/users/klackygears/tap_dances.c
blob: af4f187fccdcb39b1b3cbbd0f464fcd5af7d0eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include "tap_dances.h"

/*
void macroTogKey(qk_tap_dance_state_t *state, void *user_data) {
  keyrecord_t kr;

  if (state->count == 1)
  {
    kr.event.pressed = false;
    process_record_dynamic_macro( DYN_MACRO_PLAY1, &kr );
  }
  else if (state->count == 2)
  {
    kr.event.pressed = true;
    process_record_dynamic_macro( DYN_REC_STOP, &kr );
  }
  else if (state->count == 3)
  {
    kr.event.pressed = false;
    process_record_dynamic_macro( DYN_REC_START1, &kr );
  }
}

void macroTogKey2(qk_tap_dance_state_t *state, void *user_data) {
  keyrecord_t kr;

  if (state->count == 1)
  {
    kr.event.pressed = false;
    process_record_dynamic_macro( DYN_MACRO_PLAY2, &kr );
  }
  else if (state->count == 2)
  {
    kr.event.pressed = true;
    process_record_dynamic_macro( DYN_REC_STOP, &kr );
  }
  else if (state->count == 3)
  {
    kr.event.pressed = false;
    process_record_dynamic_macro( DYN_REC_START2, &kr );
  }
}
*/

void pstinsrt(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        register_code(KC_LALT);
        tap_code(KC_I);
        tap_code(KC_E);
        unregister_code(KC_LALT);
    } else {
        tap_code16(C(KC_V));
    }
    reset_tap_dance(state);
}

void ccopy(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(C(KC_X));

        // SEND_STRING( SS_DOWN(KC_LCTL) SS_TAP(KC_X) SS_UP(KC_LCTL));
    } else {
        tap_code16(C(KC_C));
    }
    reset_tap_dance(state);
}

void pstspecial(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        register_code(KC_LALT);
        tap_code(KC_E);
        tap_code(KC_S);
        unregister_code(KC_LALT);
        tap_code(KC_V);
    } else {
        register_code(KC_LALT);
        tap_code(KC_E);
        tap_code(KC_S);
        unregister_code(KC_LALT);
        tap_code(KC_T);
    }
    reset_tap_dance(state);
}

void deldel(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        register_code(KC_LALT);
        tap_code(KC_E);
        tap_code(KC_D);
        unregister_code(KC_LALT);
    } else {
        tap_code(KC_DEL);
    }
    reset_tap_dance(state);
}

void findreplace(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(C(KC_H));
    } else {
        tap_code16(C(KC_F));
    }
    reset_tap_dance(state);
}

void cyclawin(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(C(S(KC_F6)));
    } else {
        tap_code16(C(KC_F6));
    }
    reset_tap_dance(state);
}

void SCRNSNP(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(A(KC_PSCR));
    } else {
        tap_code(KC_LGUI);
        tap_code(KC_S);
        tap_code(KC_N);
        tap_code16(C(KC_N));
    }
    reset_tap_dance(state);
}

void mcccpy(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(G(KC_X));
    } else {
        tap_code16(G(KC_C));
    }
    reset_tap_dance(state);
}

void mcpstin(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code16(G(KC_I));
    } else {
        tap_code16(G(KC_V));
    }
    reset_tap_dance(state);
}

void enttab(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count > 1) {
        tap_code(KC_ENT);
    } else {
        tap_code(KC_TAB);
    }
    reset_tap_dance(state);
}

void rgb_toggle(qk_tap_dance_state_t *state, void *user_data) {
#ifdef RGBLIGHT_ENABLE
    if (state->count == 1) {
        rgblight_step();
    } else {
        rgblight_increase_hue();
    }
#endif
}

// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
    [TD_PSTI] = ACTION_TAP_DANCE_FN(pstinsrt),
    [TD_PTSP] = ACTION_TAP_DANCE_FN(pstspecial),
    [TD_FNDR] = ACTION_TAP_DANCE_FN(findreplace),
    [TD_CCPY] = ACTION_TAP_DANCE_FN(ccopy),
    [TD_DDEL] = ACTION_TAP_DANCE_FN(deldel),
    [TD_ACCW] = ACTION_TAP_DANCE_FN(cyclawin),
    [TD_CAPESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS),
    [TD_DTEX] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_EXLM),
    [TD_COMQUES] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUES),
    [TD_MINPLS] = ACTION_TAP_DANCE_DOUBLE(KC_PMNS, KC_PPLS),
    [TD_DIVMLT] = ACTION_TAP_DANCE_DOUBLE(KC_PSLS, KC_PAST),
    [TD_DOTEQL] = ACTION_TAP_DANCE_DOUBLE(KC_DOT, KC_EQL),
    [TD_SCNSP] = ACTION_TAP_DANCE_FN(SCRNSNP),
    [TD_MCCCPY] = ACTION_TAP_DANCE_FN(mcccpy),
    [TD_MCPSTIN] = ACTION_TAP_DANCE_FN(mcpstin),
    [TD_ENTAB] = ACTION_TAP_DANCE_FN(enttab),
    [TD_XSPC] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_X),
    [TD_RGB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rgb_toggle, NULL)
};