aboutsummaryrefslogtreecommitdiffstats
path: root/users/stanrc85/stanrc85.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/stanrc85/stanrc85.c')
-rw-r--r--users/stanrc85/stanrc85.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/users/stanrc85/stanrc85.c b/users/stanrc85/stanrc85.c
index e8fc5c1df..3838f33ef 100644
--- a/users/stanrc85/stanrc85.c
+++ b/users/stanrc85/stanrc85.c
@@ -1,13 +1,53 @@
#include "stanrc85.h"
+static td_state_t td_state;
+
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
+// determine the tapdance state to return
+int cur_dance (qk_tap_dance_state_t *state) {
+ if (state->count == 1) {
+ if (state->interrupted || !state->pressed) { return SINGLE_TAP; }
+ else { return SINGLE_HOLD; }
+ }
+ if (state->count == 2) { return DOUBLE_TAP; }
+ else { return 3; } // any number higher than the maximum state value you return above
+}
+
+// handle the possible states for each tapdance keycode you define:
+void ctl_copy_finished (qk_tap_dance_state_t *state, void *user_data) {
+ td_state = cur_dance(state);
+ switch (td_state) {
+ case SINGLE_TAP:
+ SEND_STRING(SS_LCTRL("c"));
+ break;
+ case SINGLE_HOLD:
+ register_mods(MOD_BIT(KC_RCTL));
+ break;
+ case DOUBLE_TAP:
+ SEND_STRING(SS_LCTRL("v"));
+ }
+}
+
+void ctl_copy_reset (qk_tap_dance_state_t *state, void *user_data) {
+ switch (td_state) {
+ case SINGLE_TAP:
+ break;
+ case SINGLE_HOLD:
+ unregister_mods(MOD_BIT(KC_RCTL));
+ break;
+ case DOUBLE_TAP:
+ break;
+ }
+}
+
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_WIN] = ACTION_TAP_DANCE_DOUBLE(KC_CAD, KC_LOCK),
- [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV)
+ [TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_GRV),
+ [TD_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_copy_finished, ctl_copy_reset)
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {