diff options
Diffstat (limited to 'users/hvp/tap_dances.c')
| -rw-r--r-- | users/hvp/tap_dances.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/users/hvp/tap_dances.c b/users/hvp/tap_dances.c new file mode 100644 index 000000000..bb102b30a --- /dev/null +++ b/users/hvp/tap_dances.c | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | #include "tap_dances.h" | ||
| 2 | |||
| 3 | // Tap dance function for enable swedish characters on first layer. Unregister to not let tap bleed over to next keypress. | ||
| 4 | // Tap dance 1 | ||
| 5 | void dance_1_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 6 | if (state->count == 2) { | ||
| 7 | tap_code(KC_SCLN); | ||
| 8 | } else { | ||
| 9 | register_code(KC_RALT); | ||
| 10 | register_code(KC_O); | ||
| 11 | unregister_code(KC_RALT); | ||
| 12 | unregister_code(KC_O); | ||
| 13 | } | ||
| 14 | } | ||
| 15 | |||
| 16 | void dance_1_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 17 | if (state->count == 2) { | ||
| 18 | unregister_code(KC_SCLN); | ||
| 19 | } else { | ||
| 20 | unregister_code(KC_RALT); | ||
| 21 | unregister_code(KC_O); | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | // Tap dance 2 | ||
| 26 | void dance_2_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 27 | if (state->count == 2) { | ||
| 28 | tap_code(KC_QUOT); | ||
| 29 | } else { | ||
| 30 | register_code(KC_RALT); | ||
| 31 | register_code(KC_A); | ||
| 32 | unregister_code(KC_RALT); | ||
| 33 | unregister_code(KC_A); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | void dance_2_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 38 | if (state->count == 2) { | ||
| 39 | unregister_code(KC_QUOT); | ||
| 40 | } else { | ||
| 41 | unregister_code(KC_RALT); | ||
| 42 | unregister_code(KC_A); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | // Tap dance 3 | ||
| 47 | void dance_3_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 48 | // if (state->count == 2) | ||
| 49 | if (state->count == 2) { | ||
| 50 | tap_code(KC_SLSH); | ||
| 51 | } else { | ||
| 52 | register_code(KC_RALT); | ||
| 53 | register_code(KC_W); | ||
| 54 | unregister_code(KC_RALT); | ||
| 55 | unregister_code(KC_W); | ||
| 56 | } | ||
| 57 | } | ||
| 58 | |||
| 59 | void dance_3_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 60 | if (state->count == 2) { | ||
| 61 | unregister_code(KC_SLSH); | ||
| 62 | } else { | ||
| 63 | unregister_code(KC_RALT); | ||
| 64 | unregister_code(KC_W); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | // Tap Dance Definitions | ||
| 69 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 70 | // simple tap dance | ||
| 71 | [TD1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_1_finished, dance_1_reset), | ||
| 72 | |||
| 73 | [TD2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_2_finished, dance_2_reset), | ||
| 74 | |||
| 75 | [TD3] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_3_finished, dance_3_reset)}; \ No newline at end of file | ||
