diff options
author | ridingqwerty <george.g.koenig@gmail.com> | 2020-02-04 14:17:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-04 20:17:10 +0100 |
commit | 964ed177165072572112abfbdbba3317ed13170c (patch) | |
tree | 676b31e86c0daa5dc64eed2c50241b84d43c904e /users/ridingqwerty/tapdances.c | |
parent | 50554ca270ae4c58dfa156ae4960e06a7ec6ef31 (diff) | |
download | qmk_firmware-964ed177165072572112abfbdbba3317ed13170c.tar.gz qmk_firmware-964ed177165072572112abfbdbba3317ed13170c.zip |
ridingqwerty: userspace update (#8076)
* Userspace overhaul
* Remove testing directory
* Minorca keymap tweaks
Diffstat (limited to 'users/ridingqwerty/tapdances.c')
-rw-r--r-- | users/ridingqwerty/tapdances.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/users/ridingqwerty/tapdances.c b/users/ridingqwerty/tapdances.c new file mode 100644 index 0000000000..644166cb45 --- /dev/null +++ b/users/ridingqwerty/tapdances.c @@ -0,0 +1,33 @@ +#include "ridingqwerty.h" +#include "tapdances.h" + +void braces_finished (qk_tap_dance_state_t *state, void *user_data) { + if ((state->count == 1) || (state->count == 3)) { + register_code(KC_LSFT); + } +} + +void braces_reset (qk_tap_dance_state_t *state, void *user_data) { + // two or three taps for "[]"/"{}" + if ((state->count == 2) || (state->count == 3)) { + tap_code(KC_LBRC); + tap_code(KC_RBRC); + } + // one tap for "()" + else if (state->count == 1) { + tap_code(KC_9); + tap_code(KC_0); + } + + // unregister the shift unconditionally + unregister_code(KC_LSFT); + + // move back one space, inside the braces + if (state->count <= 3) { + tap_code(KC_LEFT); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_BRACES] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, braces_finished, braces_reset) +}; |