aboutsummaryrefslogtreecommitdiff
path: root/users/ninjonas/tap_dances.c
diff options
context:
space:
mode:
authorJonas Avellana <14019120+ninjonas@users.noreply.github.com>2020-03-13 17:56:21 -0600
committerGitHub <noreply@github.com>2020-03-13 16:56:21 -0700
commit0fdd37ee19d07d6f15217074dd3291fda4c4cb2f (patch)
tree595a398a2977755695c1903cdf71b6fcf2ce03aa /users/ninjonas/tap_dances.c
parent40e8d60ecd68c1c43e1fc911e993626943930fd0 (diff)
downloadqmk_firmware-0fdd37ee19d07d6f15217074dd3291fda4c4cb2f.tar.gz
qmk_firmware-0fdd37ee19d07d6f15217074dd3291fda4c4cb2f.zip
[Keymap] ninjonas keymap updates (#8373)
* [keymap(ninjonas)] ninjonas keymap updates * [refactor] switching encoder rotation logic. recent pull seems to have flipped encoder stuff * [keymap(lily58)] added chrome change profile key on RAISE Co-authored-by: Jonas Avellana <jonas.avellana@workday.com>
Diffstat (limited to 'users/ninjonas/tap_dances.c')
-rw-r--r--users/ninjonas/tap_dances.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c
index ece95887a..63e4d3ba4 100644
--- a/users/ninjonas/tap_dances.c
+++ b/users/ninjonas/tap_dances.c
@@ -2,28 +2,41 @@
2 2
3//// BEGIN: Advanced Tap Dances 3//// BEGIN: Advanced Tap Dances
4int cur_dance (qk_tap_dance_state_t *state) { 4int cur_dance (qk_tap_dance_state_t *state) {
5 if (state->count == 1) { 5 if (state->count == 1) {
6 if (!state->pressed) { 6 if (state->interrupted || !state->pressed) return SINGLE_TAP;
7 return SINGLE_TAP; 7 //key has not been interrupted, but they key is still held. Means you want to send a 'HOLD'.
8 } else { 8 else return SINGLE_HOLD;
9 return SINGLE_HOLD;
10 }
11 } else if (state->count == 2) {
12 return DOUBLE_TAP;
13 } 9 }
14 else return 8; 10 else if (state->count == 2) {
11 /*
12 * DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap
13 * action when hitting 'pp'. Suggested use case for this return value is when you want to send two
14 * keystrokes of the key, and not the 'double tap' action/macro.
15 */
16 if (state->interrupted) return DOUBLE_SINGLE_TAP;
17 else if (state->pressed) return DOUBLE_HOLD;
18 else return DOUBLE_TAP;
19 }
20 //Assumes no one is trying to type the same letter three times (at least not quickly).
21 //If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add
22 //an exception here to return a 'TRIPLE_SINGLE_TAP', and define that enum just like 'DOUBLE_SINGLE_TAP'
23 if (state->count == 3) {
24 if (state->interrupted || !state->pressed) return TRIPLE_TAP;
25 else return TRIPLE_HOLD;
26 }
27 else return 8; //magic number. At some point this method will expand to work for more presses
15} 28}
16 29
17// BEGIN: Copy, Paste, NUMPAD 30// BEGIN: Copy, Paste, Apps
18// https://beta.docs.qmk.fm/features/feature_tap_dance#example-6-using-tap-dance-for-momentary-layer-switch-and-layer-toggle-keys 31// https://beta.docs.qmk.fm/features/feature_tap_dance#example-6-using-tap-dance-for-momentary-layer-switch-and-layer-toggle-keys
19static tap copy_paste_numpad_tap_state = { 32static tap copy_paste_app_tap_state = {
20 .is_press_action = true, 33 .is_press_action = true,
21 .state = 0 34 .state = 0
22}; 35};
23 36
24void copy_paste_numpad_finished (qk_tap_dance_state_t *state, void *user_data) { 37void copy_paste_app_finished (qk_tap_dance_state_t *state, void *user_data) {
25 copy_paste_numpad_tap_state.state = cur_dance(state); 38 copy_paste_app_tap_state.state = cur_dance(state);
26 switch (copy_paste_numpad_tap_state.state) { 39 switch (copy_paste_app_tap_state.state) {
27 case SINGLE_TAP: 40 case SINGLE_TAP:
28 tap_code16(LGUI(KC_V)); // Tap Cmd + V 41 tap_code16(LGUI(KC_V)); // Tap Cmd + V
29 break; 42 break;
@@ -31,19 +44,22 @@ void copy_paste_numpad_finished (qk_tap_dance_state_t *state, void *user_data) {
31 tap_code16(LGUI(KC_C)); // Hold Cmd + C 44 tap_code16(LGUI(KC_C)); // Hold Cmd + C
32 break; 45 break;
33 case DOUBLE_TAP: 46 case DOUBLE_TAP:
34 if (layer_state_is(_NUMPAD)) { 47 SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI));
35 layer_off(_NUMPAD); 48 wait_ms(250);
36 } else { 49 SEND_STRING("line\n");
37 layer_on(_NUMPAD); 50 break;
38 } 51 case TRIPLE_TAP:
52 SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI));
53 wait_ms(250);
54 SEND_STRING("itunes\n");
39 break; 55 break;
40 } 56 }
41} 57}
42 58
43void copy_paste_numpad_reset (qk_tap_dance_state_t *state, void *user_data) { 59void copy_paste_app_reset (qk_tap_dance_state_t *state, void *user_data) {
44 copy_paste_numpad_tap_state.state = 0; 60 copy_paste_app_tap_state.state = 0;
45} 61}
46// END: Copy, Paste, NUMPAD 62// END: Copy, Paste, Apps
47 63
48// BEGIN: Y, NUMPAD 64// BEGIN: Y, NUMPAD
49static tap y_numpad_tap_state = { 65static tap y_numpad_tap_state = {
@@ -89,10 +105,8 @@ qk_tap_dance_action_t tap_dance_actions[] = {
89 [TD_TAB_CTRLTAB] = ACTION_TAP_DANCE_DOUBLE(KC_TAB, LCTL(KC_TAB)), 105 [TD_TAB_CTRLTAB] = ACTION_TAP_DANCE_DOUBLE(KC_TAB, LCTL(KC_TAB)),
90 [TD_GRV_CTRLGRV] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, LGUI(KC_GRV)), 106 [TD_GRV_CTRLGRV] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, LGUI(KC_GRV)),
91 [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), 107 [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)),
92 [TD_W_CTRLW] = ACTION_TAP_DANCE_DOUBLE(KC_W, LGUI(KC_W)),
93 [TD_Q_GUIQ] = ACTION_TAP_DANCE_DOUBLE(KC_Q, LGUI(KC_Q)),
94 108
95 // Advanced Tap Dances 109 // Advanced Tap Dances
96 [TD_COPY_PASTE_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_numpad_finished, copy_paste_numpad_reset), 110 [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, copy_paste_app_finished, copy_paste_app_reset, 300),
97 [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset), 111 [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, y_numpad_finished, y_numpad_reset, 300),
98}; \ No newline at end of file 112}; \ No newline at end of file