tapdance.c 689 B

12345678910111213141516171819202122232425262728293031323334
  1. //Tap Dance
  2. #include "talljoe.h"
  3. // Send semin-colon + enter on two taps
  4. void tap_dance_semicolon(qk_tap_dance_state_t *state, void *user_data) {
  5. switch(state->count) {
  6. case 1:
  7. register_code(KC_SCLN);
  8. unregister_code(KC_SCLN);
  9. break;
  10. case 2:
  11. register_code(KC_SCLN);
  12. unregister_code(KC_SCLN);
  13. uint8_t mods = get_mods();
  14. if (mods) {
  15. clear_mods();
  16. }
  17. register_code(KC_ENT);
  18. unregister_code(KC_ENT);
  19. if (mods) {
  20. set_mods(mods);
  21. }
  22. reset_tap_dance(state);
  23. break;
  24. }
  25. }
  26. qk_tap_dance_action_t tap_dance_actions[] = {
  27. [TD_SEMICOLON] = ACTION_TAP_DANCE_FN(tap_dance_semicolon),
  28. };