From 92e5361fc5637a61754d0e63e7634c867b389fd7 Mon Sep 17 00:00:00 2001 From: nathanvercaemert <50712356+nathanvercaemert@users.noreply.github.com> Date: Sun, 6 Sep 2020 20:55:39 -0400 Subject: [PATCH] [Keymap] Personal Keymap (nathanvercaemert) Update (#10107) * updates to incorporate combined mouse key acceleration functionality * tab switching in chrome works, updated readme * updated keymap image * updated keymap image Co-authored-by: Nathan Vercaemert --- .../keymaps/nathanvercaemert/config.h | 3 + .../keymaps/nathanvercaemert/keymap.c | 123 +++++++++++++++--- .../keymaps/nathanvercaemert/readme.md | 7 +- .../keymaps/nathanvercaemert/rules.mk | 3 +- 4 files changed, 111 insertions(+), 25 deletions(-) diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h b/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h index 6d69b00112..06c50e0a96 100644 --- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h +++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/config.h @@ -18,6 +18,9 @@ #undef MOUSEKEY_WHEEL_INTERVAL #define MOUSEKEY_WHEEL_INTERVAL 50 +#undef MK_COMBINED +#define MK_COMBINED + // /* Temporarily defining a tapping term that is ridiculous to see if i can tell if lt is working. */ // #undef TAPPING_TERM // #define TAPPING_TERM 499 diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c index c2960cfa16..e06d0b769f 100644 --- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c +++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/keymap.c @@ -28,13 +28,17 @@ enum custom_keycodes { RGB_SLD = EZ_SAFE_RANGE, + MS_WH_UP, + MS_WH_DOWN, + MS_WH_RIGHT, + MS_WH_LEFT, }; // tapdance keycodes enum td_keycodes { CTRL_TO12, SHIFT_TO13, - ALT_TO11 + ALT_TO11, }; // define a type containing as many tapdance states as you need @@ -59,6 +63,7 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data); void shiftto13_finished (qk_tap_dance_state_t *state, void *user_data); void shiftto13_reset (qk_tap_dance_state_t *state, void *user_data); + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_ergodox_pretty( 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, @@ -162,9 +167,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [10] = LAYOUT_ergodox_pretty( KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, - KC_TRANSPARENT, KC_NO, KC_LGUI, KC_MS_BTN2, KC_NO, KC_NO, KC_TRANSPARENT, MT(MOD_RCTL, KC_A), KC_NO, KC_NO, KC_MS_UP, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, KC_LGUI, KC_MS_BTN2, KC_ACL2, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_UP, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, TD(SHIFT_TO13), TD(CTRL_TO12), TD(ALT_TO11), KC_MS_BTN1, KC_NO, KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_NO, KC_TRANSPARENT, - KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_ACL0, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, @@ -182,9 +187,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [12] = LAYOUT_ergodox_pretty( KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, - KC_TRANSPARENT, KC_NO, KC_LGUI, KC_HYPR, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, KC_LGUI, KC_HYPR, KC_ACL2, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_LSHIFT, KC_LCTRL, KC_LALT, KC_NO, KC_NO, KC_NO, KC_MS_WH_LEFT, KC_MS_WH_DOWN, KC_MS_WH_RIGHT, KC_NO, KC_TRANSPARENT, - KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, MT(MOD_LGUI | MOD_LCTL,KC_NO), MO(14), KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, @@ -200,16 +205,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, TO(0) ), + [14] = LAYOUT_ergodox_pretty( + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, MS_WH_UP, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, MS_WH_LEFT, MS_WH_DOWN, MS_WH_RIGHT, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_NO, KC_NO, KC_TRANSPARENT, KC_NO, KC_NO, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + ), }; - -/* Commenting out for debug purposes */ -// bool process_record_user(uint16_t keycode, keyrecord_t *record) { -// switch (keycode) { -// } -// return true; -// } - uint32_t layer_state_set_user(uint32_t state) { uint8_t layer = biton32(state); ergodox_board_led_off(); @@ -252,11 +259,31 @@ uint32_t layer_state_set_user(uint32_t state) { // 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; } + if (state->interrupted && state->pressed && state->interrupting_keycode == KC_MS_BTN1) {return SINGLE_HOLD;} + if (state->interrupted && state->pressed && state->interrupting_keycode == 22273) {return SINGLE_HOLD;} + if (state->interrupted && state->pressed && state->interrupting_keycode == 22272) {return SINGLE_HOLD;} + if (state->interrupted && state->pressed && state->interrupting_keycode == KC_TAB) {return SINGLE_HOLD;} + else if (state->interrupted || !state->pressed) { + // if (state->interrupted) { + // print("interrupted\n"); + // uprintf("Shift: %u\n", KC_LSHIFT); + // uprintf("Control: %u\n", KC_LCTRL); + // uprintf("%u\n",state->interrupting_keycode); + // } + return SINGLE_TAP; + } else { return SINGLE_HOLD; } } else { return 2; } // any number higher than the maximum state value you return above } +// /* Backup in case previous code is hard to piece together. */ +// 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; } +// } +// else { return 2; } // any number higher than the maximum state value you return above +// } void ctrlto12_finished (qk_tap_dance_state_t *state, void *user_data) { td_state = cur_dance(state); @@ -265,7 +292,14 @@ void ctrlto12_finished (qk_tap_dance_state_t *state, void *user_data) { layer_on(12); break; case SINGLE_HOLD: + if (state->interrupted && (state->interrupting_keycode == 22273 || state->interrupting_keycode == 43)) { + register_mods(MOD_BIT(KC_LCTRL)); + break; + } register_mods(MOD_BIT(KC_LCTRL)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + register_code16(LCTL(KC_MS_BTN1)); + } break; } } @@ -275,7 +309,14 @@ void ctrlto12_reset (qk_tap_dance_state_t *state, void *user_data) { case SINGLE_TAP: break; case SINGLE_HOLD: + if (state->interrupted && (state->interrupting_keycode == 22273 || state->interrupting_keycode == 43) ) { + unregister_mods(MOD_BIT(KC_LCTRL)); + break; + } unregister_mods(MOD_BIT(KC_LCTRL)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + unregister_code16(LCTL(KC_MS_BTN1)); + } break; } } @@ -287,7 +328,14 @@ void shiftto13_finished (qk_tap_dance_state_t *state, void *user_data) { layer_on(13); break; case SINGLE_HOLD: + if (state->interrupted && (state->interrupting_keycode == 22272 || state->interrupting_keycode == 43) ) { + register_mods(MOD_BIT(KC_LSHIFT)); + break; + } register_mods(MOD_BIT(KC_LSHIFT)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + register_code16(LSFT(KC_MS_BTN1)); + } break; } } @@ -297,7 +345,14 @@ void shiftto13_reset (qk_tap_dance_state_t *state, void *user_data) { case SINGLE_TAP: break; case SINGLE_HOLD: + if (state->interrupted && (state->interrupting_keycode == 22272 || state->interrupting_keycode == 43) ) { + unregister_mods(MOD_BIT(KC_LSHIFT)); + break; + } unregister_mods(MOD_BIT(KC_LSHIFT)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + unregister_code16(LSFT(KC_MS_BTN1)); + } break; } } @@ -310,6 +365,9 @@ void altto11_finished (qk_tap_dance_state_t *state, void *user_data) { break; case SINGLE_HOLD: register_mods(MOD_BIT(KC_LALT)); // for a layer-tap key, use `layer_on(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + register_code16(LALT(KC_MS_BTN1)); + } break; } } @@ -320,6 +378,9 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data) { break; case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_LALT)); // for a layer-tap key, use `layer_off(_MY_LAYER)` here + if (state->interrupted && state->interrupting_keycode == KC_MS_BTN1) { + unregister_code16(LALT(KC_MS_BTN1)); + } break; } } @@ -328,7 +389,7 @@ void altto11_reset (qk_tap_dance_state_t *state, void *user_data) { qk_tap_dance_action_t tap_dance_actions[] = { [CTRL_TO12] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctrlto12_finished, ctrlto12_reset), [SHIFT_TO13] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shiftto13_finished, shiftto13_reset), - [ALT_TO11] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altto11_finished, altto11_reset) + [ALT_TO11] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altto11_finished, altto11_reset), }; /* Debugging functions */ @@ -342,10 +403,32 @@ void keyboard_post_init_user(void) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { - // If console is enabled, it will print the matrix position and status of each key pressed -// #ifdef CONSOLE_ENABLE -// uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); -// #endif - return true; + // If console is enabled, it will print the matrix position and status of each key pressed + // #ifdef CONSOLE_ENABLE + // uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); + // #endif + switch (keycode) { + case MS_WH_DOWN: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_MS_WH_DOWN)); + } + break; + case MS_WH_UP: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_MS_WH_UP)); + } + break; + case MS_WH_LEFT: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_MS_WH_LEFT)); + } + break; + case MS_WH_RIGHT: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_MS_WH_RIGHT)); + } + break; + } + return true; } diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md b/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md index 5570d9881c..ff3c8d142c 100644 --- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md +++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/readme.md @@ -1,7 +1,6 @@ # The nathanvercaemert ErgoDox EZ configuration -Centered around the home row and the use of mouse keys, this configuration focuses -on minimal finger movement. No key is more than one unit away from a finger on the home row. +Centered around the home row and the use of mouse keys, this configuration focuses on minimal finger movement. No key is more than one unit away from the home row. ## Layers @@ -20,7 +19,9 @@ on minimal finger movement. No key is more than one unit away from a finger on t navigation layers. * Navigation Layers * From the Mouse Layer, taps to the left home row navigate to scroll keys, arrow keys, and page keys. +* Notes on Acceleration + * Designated as "Slow" and "Fast" on the mouse layers (movement and scroll,) these keys can be held to allow for slow/precise or fast/efficient control. Here is the image of my keymap: -![Default](https://i.imgur.com/kXywQIq.png) \ No newline at end of file +![Imgur Image](https://i.imgur.com/x6VgH9Z.png) \ No newline at end of file diff --git a/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk b/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk index 31c3fe3c74..0dadd4371f 100644 --- a/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk +++ b/keyboards/ergodox_ez/keymaps/nathanvercaemert/rules.mk @@ -5,6 +5,5 @@ COMMAND_ENABLE = no RGBLIGHT_ENABLE = no TAP_DANCE_ENABLE=yes - -#Beginning debugging process for LT() and permissive hold +# Debugging CONSOLE_ENABLE = yes