summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/m_chords_hyper.c
blob: e7df3aef14c2b27dece1b2a8d0fa39557ab2c0d6 (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
//instanalize an instance of 'tap' for the M - Chords - Hyper tap dance.
static tap m_chords_hyper_state = {
    .is_press_action = true,
    .state           = 0
};

void m_chords_hyper_finished(qk_tap_dance_state_t *state, void *user_data) {
    m_chords_hyper_state.state = current_dance(state);
    switch (m_chords_hyper_state.state) {
        case SINGLE_TAP:
            register_code(KC_M);
            break;

        case SINGLE_HOLD:
            layer_on(CHORD);
            break;

        case DOUBLE_HOLD:
            register_code(KC_LCTL);
            register_code(KC_LSFT);
            register_code(KC_LALT);
            register_code(KC_LGUI);
            break;
    }
}

void m_chords_hyper_reset(qk_tap_dance_state_t *state, void *user_data) {
    switch (m_chords_hyper_state.state) {
        case SINGLE_TAP:
            unregister_code(KC_M);
            break;

        case SINGLE_HOLD:
            layer_off(CHORD);
            break;

        case DOUBLE_HOLD:
            unregister_code(KC_LCTL);
            unregister_code(KC_LSFT);
            unregister_code(KC_LALT);
            unregister_code(KC_LGUI);
            break;
    }
    m_chords_hyper_state.state = 0;
}