2019-10-16 10:44:43 -07:00
|
|
|
#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
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_1_finished(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
if (state->count == 2) {
|
|
|
|
tap_code(KC_SCLN);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
tap_code16(ALGR(KC_A));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_1_reset(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
if (state->count == 2) {
|
|
|
|
unregister_code(KC_SCLN);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
unregister_code16(ALGR(KC_A));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tap dance 2
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_2_finished(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
if (state->count == 2) {
|
|
|
|
tap_code(KC_QUOT);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
tap_code16(ALGR(KC_W));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_2_reset(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
if (state->count == 2) {
|
|
|
|
unregister_code(KC_QUOT);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
unregister_code16(ALGR(KC_W));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tap dance 3
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_3_finished(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
// if (state->count == 2)
|
|
|
|
if (state->count == 2) {
|
|
|
|
tap_code(KC_SLSH);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
tap_code16(ALGR(KC_O));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_3_reset(tap_dance_state_t *state, void *user_data) {
|
2019-10-16 10:44:43 -07:00
|
|
|
if (state->count == 2) {
|
|
|
|
unregister_code(KC_SLSH);
|
|
|
|
} else {
|
2020-01-02 11:31:54 -08:00
|
|
|
unregister_code16(ALGR(KC_O));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tap dance 4
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_4_finished(tap_dance_state_t *state, void *user_data) {
|
2020-01-02 11:31:54 -08:00
|
|
|
// if (state->count == 2)
|
|
|
|
if (state->count == 2) {
|
|
|
|
tap_code(KC_DOT);
|
|
|
|
} else {
|
|
|
|
tap_code16(ALGR(KC_W));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_4_reset(tap_dance_state_t *state, void *user_data) {
|
2020-01-02 11:31:54 -08:00
|
|
|
if (state->count == 2) {
|
|
|
|
unregister_code(KC_DOT);
|
|
|
|
} else {
|
|
|
|
unregister_code16(ALGR(KC_W));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tap dance 5
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_5_finished(tap_dance_state_t *state, void *user_data) {
|
2020-01-02 11:31:54 -08:00
|
|
|
// if (state->count == 2)
|
|
|
|
if (state->count == 2) {
|
|
|
|
tap_code(KC_DOT);
|
|
|
|
} else {
|
|
|
|
tap_code16(ALGR(KC_O));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-14 12:40:25 -08:00
|
|
|
void dance_5_reset(tap_dance_state_t *state, void *user_data) {
|
2020-01-02 11:31:54 -08:00
|
|
|
if (state->count == 2) {
|
|
|
|
unregister_code(KC_DOT);
|
|
|
|
} else {
|
|
|
|
unregister_code16(ALGR(KC_O));
|
2019-10-16 10:44:43 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tap Dance Definitions
|
2022-12-14 12:40:25 -08:00
|
|
|
tap_dance_action_t tap_dance_actions[] = {
|
2019-10-16 10:44:43 -07:00
|
|
|
// 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),
|
|
|
|
|
2020-01-02 11:31:54 -08:00
|
|
|
[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)};
|