summaryrefslogtreecommitdiffstats
path: root/users/talljoe/tapdance.c
blob: 3198fc67f0577b0f7f85b6c8375c756086066288 (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
//Tap Dance
#include "talljoe.h"

// Send semin-colon + enter on two taps
void tap_dance_semicolon(qk_tap_dance_state_t *state, void *user_data) {
  switch(state->count) {
    case 1:
      register_code(KC_SCLN);
      unregister_code(KC_SCLN);
      break;
    case 2:
      register_code(KC_SCLN);
      unregister_code(KC_SCLN);

      uint8_t mods = get_mods();
      if (mods) {
        clear_mods();
      }

      register_code(KC_ENT);
      unregister_code(KC_ENT);

      if (mods) {
        set_mods(mods);
      }

      reset_tap_dance(state);
      break;
  }
}

qk_tap_dance_action_t tap_dance_actions[] = {
  [TD_SEMICOLON]  = ACTION_TAP_DANCE_FN(tap_dance_semicolon),
};