QMK/keymaps/default/tapdance/wmlayout.c

53 lines
1.1 KiB
C
Raw Normal View History

2022-02-06 19:47:50 -08:00
#include "keymap.h"
#include "tapdance.h"
typedef struct {
bool is_press_action;
uint8_t step;
} tap;
static tap dance_state[1];
void td_wmlayout_dance(qk_tap_dance_state_t *state, void *user_data) {
if(state->count == 3) {
tap_code16(LGUI(KC_L));
tap_code16(LGUI(KC_L));
tap_code16(LGUI(KC_L));
}
if(state->count > 3) {
tap_code16(LGUI(KC_L));
}
}
void td_wmlayout_finished(qk_tap_dance_state_t *state, void *user_data) {
dance_state[0].step = dance_step(state);
switch (dance_state[0].step) {
case SINGLE_TAP:
register_code16(LGUI(KC_L));
break;
case DOUBLE_TAP:
register_code16(LGUI(KC_K));
break;
case DOUBLE_SINGLE_TAP:
tap_code16(LGUI(KC_L));
register_code16(LGUI(KC_L));
break;
}
}
void td_wmlayout_reset(qk_tap_dance_state_t *state, void *user_data) {
wait_ms(10);
switch (dance_state[0].step) {
case SINGLE_TAP:
unregister_code16(LGUI(KC_L));
break;
case DOUBLE_TAP:
unregister_code16(LGUI(KC_K));
break;
case DOUBLE_SINGLE_TAP:
unregister_code16(LGUI(KC_L));
break;
}
dance_state[0].step = 0;
}