diff options
-rw-r--r-- | keyboards/planck/keymaps/roguepullrequest/keymap.c | 87 |
1 files changed, 77 insertions, 10 deletions
diff --git a/keyboards/planck/keymaps/roguepullrequest/keymap.c b/keyboards/planck/keymaps/roguepullrequest/keymap.c index 64d9cfb2b7..51c740dc4b 100644 --- a/keyboards/planck/keymaps/roguepullrequest/keymap.c +++ b/keyboards/planck/keymaps/roguepullrequest/keymap.c @@ -24,14 +24,18 @@ enum { // Tap dance enums enum { X_AT_FUN = 0, - SH_M_LPAREN, - SH_M_RPAREN + RSHIFT, + LSHIFT, + TD_S }; int cur_dance (qk_tap_dance_state_t *state); void x_finished (qk_tap_dance_state_t *state, void *user_data); void x_reset (qk_tap_dance_state_t *state, void *user_data); +void lshift_finished (qk_tap_dance_state_t *state, void *user_data); +void lshift_reset(qk_tap_dance_state_t *state, void *user_data); + bool is_alt_tab_active = false; uint16_t alt_tab_timer = 0; @@ -102,17 +106,18 @@ void matrix_scan_user(void) { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Programmer Dvorak */ + + /* Programmer Dvorak */ [_PDVORAK] = LAYOUT_planck_grid( - KC_GESC, KC_SCOLON, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, - KC_LAST, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLASH, - KC_LSPO, KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC, - TD(X_AT_FUN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, ALT_TAB, KC_SPACE, KC_ENTER, MT(MOD_LCTL | MOD_LSFT, KC_LGUI), KC_PGUP, KC_PGDN, LT(_LOWER, KC_PLUS) + KC_GESC, KC_SCOLON, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, + KC_LAST, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, TD(TD_S), KC_SLASH, + TD(LSHIFT), KC_QUOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, TD(RSHIFT), + TD(X_AT_FUN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, ALT_TAB, KC_SPACE, KC_ENTER, MT(MOD_LCTL | MOD_LSFT, KC_LGUI), KC_PGUP, KC_PGDN, LT(_LOWER, KC_PLUS) ), [_UPPER] = LAYOUT_planck_grid( - KC_GRAVE, KC_AMPR, KC_PERC, KC_LBRC, KC_LCBR, KC_EQL, KC_ASTR, KC_RCBR, KC_RBRC, KC_EXLM, KC_HASH, KC_TRNS, - KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MINUS, KC_BSLASH, + KC_GRAVE, KC_AMPR, KC_PERC, KC_NO, KC_NO, KC_EQL, KC_ASTR, KC_NO, KC_NO, KC_EXLM, KC_HASH, KC_TRNS, + KC_PLUS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS ), @@ -145,6 +150,10 @@ int cur_dance (qk_tap_dance_state_t *state) { if (state->interrupted || !state->pressed) return DOUBLE_TAP; else return DOUBLE_HOLD; } + else if (state->count == 3) { + if (state->interrupted || !state->pressed)return TRIPLE_TAP; + else return TRIPLE_HOLD; + } else return 8; // magic number that i dont believe works. } @@ -164,6 +173,35 @@ void x_finished (qk_tap_dance_state_t *state, void *user_data) { case DOUBLE_HOLD: reset_keyboard(); break; } } + +void lshift_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_LSFT); register_code16(KC_9); break; + case SINGLE_HOLD: register_code16(KC_LSFT); break; + case DOUBLE_TAP: register_code16(KC_LBRC); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_LBRC); break; + } +} +void s_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_S); break; + case DOUBLE_TAP: register_code16(KC_MINUS); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_MINUS); break; + } +} + +void rshift_finished (qk_tap_dance_state_t *state, void *user_data) { + xtap_state.state = cur_dance(state); + switch (xtap_state.state) { + case SINGLE_TAP: register_code16(KC_LSFT); register_code16(KC_0); break; + case SINGLE_HOLD: register_code16(KC_RSFT); break; + case DOUBLE_TAP: register_code16(KC_RBRC); break; + case TRIPLE_TAP: register_code16(KC_LSFT); register_code16(KC_RBRC); break; + } +} + // forgetting keypresses void x_reset (qk_tap_dance_state_t *state, void *user_data) { @@ -175,9 +213,38 @@ void x_reset (qk_tap_dance_state_t *state, void *user_data) { } xtap_state.state = 0; } +void lshift_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_9); unregister_code16(KC_LSFT); break; + case SINGLE_HOLD: unregister_code16(KC_LSFT); break; + case DOUBLE_TAP: unregister_code16(KC_LBRC); break; + case TRIPLE_TAP: unregister_code16(KC_LBRC); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} +void rshift_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_0); unregister_code16(KC_LSFT); break; + case SINGLE_HOLD: unregister_code16(KC_RSFT); break; + case DOUBLE_TAP: unregister_code16(KC_RBRC); break; + case TRIPLE_TAP: unregister_code16(KC_RBRC); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} +void s_reset (qk_tap_dance_state_t *state, void *user_data) { + switch (xtap_state.state) { + case SINGLE_TAP: unregister_code16(KC_S); break; + case DOUBLE_TAP: unregister_code16(KC_MINUS); break; + case TRIPLE_TAP: unregister_code16(KC_MINUS); unregister_code16(KC_LSFT); break; + } + xtap_state.state = 0; +} qk_tap_dance_action_t tap_dance_actions[] = { - [X_AT_FUN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset) + [X_AT_FUN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset), + [LSHIFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lshift_finished, lshift_reset), + [RSHIFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rshift_finished, rshift_reset), + [TD_S] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, s_finished, s_reset), }; void shutdown_user(void) { clear_keyboard(); } |