summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez/keymaps/hacker_dvorak/tap_dance/mod_tap_layer_dances/u_arrows_gui.c
blob: b9a213ef0838409d4ff03f93ffa715938cffdfde (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 U - Arrows - Gui tap dance.
static tap u_arrows_gui_state = {
    .is_press_action = true,
    .state           = 0
};

void u_arrows_gui_finished(tap_dance_state_t *state, void *user_data) {
    u_arrows_gui_state.state = current_dance(state);
    switch (u_arrows_gui_state.state) {
        case SINGLE_TAP:
            register_code(KC_U);
            break;

        case SINGLE_HOLD:
            layer_on(ARROWS);
            break;

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

void u_arrows_gui_reset(tap_dance_state_t *state, void *user_data) {
    switch (u_arrows_gui_state.state) {
        case SINGLE_TAP:
            unregister_code(KC_U);
            break;

        case SINGLE_HOLD:
            layer_off(ARROWS);
            break;

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