diff options
author | Pavlos Vinieratos <pvinis@gmail.com> | 2016-12-09 16:01:11 +0100 |
---|---|---|
committer | Pavlos Vinieratos <pvinis@gmail.com> | 2016-12-09 16:01:11 +0100 |
commit | 9a59fee6677a51c5a15ecf9807a1e3962f606b50 (patch) | |
tree | 873a5846a78a36c0c6a16db788dbb4dd5422c3ed /keyboards/ergodox/keymaps/pvinis | |
parent | 063ade6bb5963d21b1f466f3cad33fa72f1f06a8 (diff) |
tap dance for some layers. one tap sysctl, two taps mouse.
Diffstat (limited to 'keyboards/ergodox/keymaps/pvinis')
-rw-r--r-- | keyboards/ergodox/keymaps/pvinis/keymap.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/keyboards/ergodox/keymaps/pvinis/keymap.c b/keyboards/ergodox/keymaps/pvinis/keymap.c index 52283a51e2..87ad70c919 100644 --- a/keyboards/ergodox/keymaps/pvinis/keymap.c +++ b/keyboards/ergodox/keymaps/pvinis/keymap.c @@ -22,6 +22,7 @@ enum { // tap dance TD_FLSH, // flash keyboard + TD_LAYR, // SYSCTL and MOUSE layer switch }; // application selection @@ -61,9 +62,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO - ,TG(BEGIN) ,TG(QWERTY) - ,TG(CARPALX) - ,KC_BSPC ,KC_LSFT ,TG(SYSCTL) + ,TG(BEGIN) ,TD(TD_LAYR) + ,TG(MOUSE) + ,KC_BSPC ,KC_LSFT ,TD(TD_LAYR) ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO @@ -444,6 +445,31 @@ void flash_dance_reset(qk_tap_dance_state_t *state, void *user_data) { ergodox_right_led_3_off(); } +// SYSCTL on first tap, MOUSE ON second tap +void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) { + uint8_t layer = biton32(layer_state); + + switch(state->count) { + case 1: + switch(layer) { + case SYSCTL: + layer_off(SYSCTL); + break; + case MOUSE: + layer_off(MOUSE); + break; + default: + layer_on(SYSCTL); + break; + } + break; + case 2: + layer_on(MOUSE); + break; + } +} + qk_tap_dance_action_t tap_dance_actions[] = { [TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED( flash_each_tap, flash_dance_finished, flash_dance_reset ), + [TD_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, layers_dance_finished, NULL ), }; |