diff options
author | Danilo Vulicevic <danilo.vulicevic@yahoo.com> | 2019-02-14 21:09:27 +0100 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-02-14 21:09:27 +0100 |
commit | 1e6797b4e7d888f0c0449e3cd577dc83eb4c4525 (patch) | |
tree | 054868cb8b176df99abdb91b3893e241727eaaf5 /users/billypython/tap_dance.c | |
parent | ce465c084bfdfb3dbd24414397b2542176da423d (diff) | |
download | qmk_firmware-1e6797b4e7d888f0c0449e3cd577dc83eb4c4525.tar.gz qmk_firmware-1e6797b4e7d888f0c0449e3cd577dc83eb4c4525.tar.xz |
[Keymap] Add my personal userspace and update my keymaps (#5128)
* Add billypython userspace and dz60 keymap
* Disable Bootmagic in dz60:billypython keymap
* Update whitefox:billypython keymap with userspace changes
Also remove numpad layer
Diffstat (limited to 'users/billypython/tap_dance.c')
-rw-r--r-- | users/billypython/tap_dance.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/users/billypython/tap_dance.c b/users/billypython/tap_dance.c new file mode 100644 index 000000000..74ae16639 --- /dev/null +++ b/users/billypython/tap_dance.c @@ -0,0 +1,33 @@ +#include "tap_dance.h" + +#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \ + .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \ + .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \ + } + +void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data; + // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2 + if (state->count == 1 || state->count == 3) { + register_code(mods->kc1); + } else if (state->count == 2) { + unregister_code(mods->kc1); + register_code(mods->kc2); + } + // Prevent tap dance from sending kc1 and kc2 as weak mods + state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2)); +} + +void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) { + qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data; + if (state->count == 1 || state->count >= 3) { + unregister_code(mods->kc1); + } + if (state->count >= 2) { + unregister_code(mods->kc2); + } +} + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_RSF_RCT] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RSFT, KC_RCTL), +}; |