summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/h_mouse_gui.c
blob: 76dda6eb32067795a1ad1024924fc343b4f3173a (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
//instanalize an instance of 'tap' for the H - Mouse - Gui tap dance.
static tap h_mouse_gui_state = {
    .is_press_action = true,
    .state           = 0
};

void h_mouse_gui_finished(qk_tap_dance_state_t *state, void *user_data) {
    h_mouse_gui_state.state = current_dance(state);
    switch (h_mouse_gui_state.state) {
        case SINGLE_TAP:
            register_code(KC_H);
            break;

        case SINGLE_HOLD:
            layer_on(MOUSE);
            break;

        case DOUBLE_HOLD:
            register_code(KC_LGUI);
            break;
    }
}

void h_mouse_gui_reset(qk_tap_dance_state_t *state, void *user_data) {
    switch (h_mouse_gui_state.state) {
        case SINGLE_TAP:
            unregister_code(KC_H);
            break;

        case SINGLE_HOLD:
            layer_off(MOUSE);
            break;

        case DOUBLE_HOLD:
            unregister_code(KC_LGUI);
            break;
    }
    h_mouse_gui_state.state = 0;
}