aboutsummaryrefslogtreecommitdiffstats
path: root/users/hvp/tap_dances.c
blob: 1269d5f27289e3e6b61ffefa7c374040344bc124 (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
#include "tap_dances.h"

// Tap dance function for enable swedish characters on first layer. Unregister to not let tap bleed over to next keypress.
// Tap dance 1
void dance_1_finished(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        tap_code(KC_SCLN);
    } else {
        tap_code16(ALGR(KC_A));
    }
}

void dance_1_reset(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        unregister_code(KC_SCLN);
    } else {
        unregister_code16(ALGR(KC_A));
    }
}

// Tap dance 2
void dance_2_finished(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        tap_code(KC_QUOT);
    } else {
        tap_code16(ALGR(KC_W));
    }
}

void dance_2_reset(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        unregister_code(KC_QUOT);
    } else {
        unregister_code16(ALGR(KC_W));
    }
}

// Tap dance 3
void dance_3_finished(qk_tap_dance_state_t *state, void *user_data) {
    // if (state->count == 2)
    if (state->count == 2) {
        tap_code(KC_SLSH);
    } else {
        tap_code16(ALGR(KC_O));
    }
}

void dance_3_reset(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        unregister_code(KC_SLSH);
    } else {
        unregister_code16(ALGR(KC_O));
    }
}

// Tap dance 4
void dance_4_finished(qk_tap_dance_state_t *state, void *user_data) {
    // if (state->count == 2)
    if (state->count == 2) {
        tap_code(KC_DOT);
    } else {
        tap_code16(ALGR(KC_W));
    }
}

void dance_4_reset(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        unregister_code(KC_DOT);
    } else {
        unregister_code16(ALGR(KC_W));
    }
}

// Tap dance 5
void dance_5_finished(qk_tap_dance_state_t *state, void *user_data) {
    // if (state->count == 2)
    if (state->count == 2) {
        tap_code(KC_DOT);
    } else {
        tap_code16(ALGR(KC_O));
    }
}

void dance_5_reset(qk_tap_dance_state_t *state, void *user_data) {
    if (state->count == 2) {
        unregister_code(KC_DOT);
    } else {
        unregister_code16(ALGR(KC_O));
    }
}

// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
    // simple tap dance
    [TD1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_1_finished, dance_1_reset),

    [TD2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_2_finished, dance_2_reset),

    [TD3] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_3_finished, dance_3_reset),

    [TD4] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_4_finished, dance_4_reset),

    [TD5] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_5_finished, dance_5_reset)};