diff options
Diffstat (limited to 'keyboard/ergodox_ez/keymaps/townk_osx/keymap.c')
-rw-r--r-- | keyboard/ergodox_ez/keymaps/townk_osx/keymap.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/keyboard/ergodox_ez/keymaps/townk_osx/keymap.c b/keyboard/ergodox_ez/keymaps/townk_osx/keymap.c index 9f16bc8636..eb7700b7ff 100644 --- a/keyboard/ergodox_ez/keymaps/townk_osx/keymap.c +++ b/keyboard/ergodox_ez/keymaps/townk_osx/keymap.c @@ -55,16 +55,22 @@ This is used to make the keyboard behave mostly like a **num pad keyboard**. #define FN 2 #define MACRO_TMUX_ESC 10 -#define MACRO_SHIFT_OR_LPAREN 11 -#define MACRO_SHIFT_OR_RPAREN 12 +#define MACRO_TMUX_PASTE 11 +#define MACRO_OSX_COPY 12 +#define MACRO_OSX_PASTE 13 + +#define M_TESC M(MACRO_TMUX_ESC) +#define M_TPASTE M(MACRO_TMUX_PASTE) +#define M_OSXCPY M(MACRO_OSX_COPY) +#define M_OSXPST M(MACRO_OSX_PASTE) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap 0: Base Layer * * ,-----------------------------------------------------. ,-----------------------------------------------------. - * | `~ | 1 | 2 | 3 | 4 | 5 | ESC | | Macro| 6 | 7 | 8 | 9 | 0 | + = | + * | `~ | 1 | 2 | 3 | 4 | 5 | ESC | | Pwr | 6 | 7 | 8 | 9 | 0 | - _ | * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| - * | Tab | Q | W | E | R | T | F16 | | F17 | Y | U | I | O | P | - _ | + * | Tab | Q | W | E | R | T | F16 | | F17 | Y | U | I | O | P | = + | * |-----------+------+------+------+------+------| Meh | | Meh |------+------+------+------+------+-----------| * | \ (Ctrl) | A | S | D | F | G |------| |------| H | J | K | L | ; | ' " (Ctrl)| * |-----------+------+------+------+------+------| F18 | | F19 |------+------+------+------+------+-----------| @@ -73,74 +79,78 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * | FN | KPAD |LCtrl | LAlt | LGui | | RGui | RAlt | RCtrl| KPAD | FN | * `-----------------------------------' `-----------------------------------' * ,-------------. ,-------------. - * | Left | Right| | Down | Up | + * | M(0) | M(1) | | M(2) | M(3) | * ,------|------|------| |------+------+------. * | | | Home | | PgUp | | | * |Backsp| Del |------| |------| Enter| Space| * | | | End | | PgDn | | | * `--------------------' `--------------------' * - * Macro = Ctrk+A Esc - * (this is used to issue the Esc key to the Tmux application) + * M(0) = Ctrk+A Esc + * (this is used to issue the Esc key to the Tmux application) + * M(1) = Ctrk+A P + * (this is used to issue the Paste key to the Tmux application) + * M(2) = Cmd+C + * M(3) = Cmd+V */ [BASE]=KEYMAP(//left half - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MEH_T(KC_F16), - CTL_T(KC_BSLS), KC_A, KC_S, KC_D, KC_F, KC_G, - KC_FN2, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18), - KC_FN1, TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI, - KC_LEFT, KC_RIGHT, - KC_HOME, - KC_BSPC, KC_DELT, KC_END, - //right half - M(MACRO_TMUX_ESC), KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, - MEH_T(KC_F17), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS, - KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT), - ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN2, - KC_RGUI, ALT_T(KC_LBRC), CTL_T(KC_RBRC), TG(KEYPAD), KC_FN1, - KC_DOWN, KC_UP, - KC_PGUP, - KC_PGDN, KC_ENT, KC_SPC), + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, MEH_T(KC_F16), + CTL_T(KC_BSLS), KC_A, KC_S, KC_D, KC_F, KC_G, + KC_FN2, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_F18), + KC_FN1, TG(KEYPAD), KC_LCTRL, KC_LALT, KC_LGUI, + M_TESC, M_TPASTE, + KC_HOME, + KC_BSPC, KC_DELT, KC_END, + //right half + KC_POWER, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + MEH_T(KC_F17), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_EQL, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT), + ALL_T(KC_F19), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_FN2, + KC_RGUI, KC_RALT, CTL_T(KC_LBRC), KC_FN3, KC_FN1, + M_OSXCPY, M_OSXPST, + KC_PGUP, + KC_PGDN, KC_ENT, KC_SPC), /* Keymap 1: KeyPad Layer * * ,-----------------------------------------------------. ,-----------------------------------------------------. - * | | | | | | | | | BTab | Clear| / | * | ^ | ( | LeftClick | + * | | | LClk | RClk | MClk | | | | BTab | Clear| / | * | ^ | ( | | * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------| - * | M.Accel 2 | |ScrlUp| U |ScrlDn| | | | Tab | 7 | 8 | 9 | + | ) | RightClick| + * | M.Accel 2 | |ScrlUp| U |ScrlDn| | | | Tab | 7 | 8 | 9 | + | ) | | * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------| - * | M.Accel 1 | | L | D | R | |------| |------| 4 | 5 | 6 | - | | MidClick | + * | M.Accel 1 | | L | D | R | |------| |------| 4 | 5 | 6 | - | | | * |-----------+------+------+------+------+------| | |Return|------+------+------+------+------+-----------| * | M.Accel 0 | |ScrlL | |ScrlR | | | | | 1 | 2 | 3 | = | | | * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' - * | | | | | | | 0 | . | , | | KPAD | + * | | XXXX | | | | | 0 | . | , | XXXX | | * `-----------------------------------' `-----------------------------------' * ,-------------. ,-------------. * | | | | | | * ,------|------|------| |------+------+------. - * | | | | | | | | - * | | |------| |------| | | - * | | | | | | | | + * | | | | | | XXXX | | + * | | |------| |------| XXXX | | + * | | | | | | XXXX | | * `--------------------' `--------------------' */ [KEYPAD]=KEYMAP(//left half - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_MS_WH_UP, KC_MS_U, KC_MS_WH_DOWN, KC_NO, KC_NO, - KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, - KC_NO, KC_NO, KC_MS_WH_LEFT, KC_NO, KC_MS_WH_RIGHT, KC_NO, KC_NO, - KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_NO, KC_NO, + KC_MS_ACCEL2, KC_NO, KC_MS_WH_UP, KC_MS_U, KC_MS_WH_DOWN, KC_NO, KC_NO, + KC_MS_ACCEL1, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, + KC_MS_ACCEL0, KC_NO, KC_MS_WH_LEFT, KC_NO, KC_MS_WH_RIGHT, 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, //right half - LSFT(KC_TAB), KC_CLEAR, KC_KP_SLASH, KC_KP_ASTERISK, KC_CIRCUMFLEX, KC_LPRN, KC_MS_BTN1, - KC_TAB, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS, KC_RPRN, KC_MS_BTN2, - KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_MINUS, KC_NO, KC_MS_BTN3, + LSFT(KC_TAB), KC_CLEAR, KC_KP_SLASH, KC_KP_ASTERISK, KC_CIRCUMFLEX, KC_LPRN, KC_NO, + KC_TAB, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_PLUS, KC_RPRN, KC_NO, + KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_MINUS, KC_NO, KC_NO, KC_KP_ENTER, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_EQUAL, KC_NO, KC_NO, - KC_KP_0, KC_KP_DOT, KC_KP_COMMA, KC_TRNS, KC_TRNS, + KC_KP_0, KC_KP_DOT, KC_KP_COMMA, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, - KC_NO, KC_NO, KC_NO), + KC_NO, KC_TRNS, KC_NO), /* Keymap 2: Functions Layer * @@ -153,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------+------+------+------+------+------| XXXX | | XXXX |------+------+------+------+------+-----------| * | L Shift | | | | | | XXXX | | XXXX | | | | | | R Shift | * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------' - * | XXXXX | | XXXX | XXXX | XXXX | | XXXX | XXXX | XXXX | | | + * | XXXXX | | XXXX | XXXX | XXXX | | XXXX | XXXX | XXXX | | XXXXX | * `-----------------------------------' `-----------------------------------' * ,-------------. ,-------------. * | | | | | | @@ -187,6 +197,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_ONESHOT(FN), [2] = ACTION_MODS_ONESHOT(MOD_LSFT), // Sticky shift light. Tap for the next keypress to be shifted. Hold for regular shift. + [3] = ACTION_LAYER_TAP_KEY(KEYPAD, KC_RBRC), }; static uint16_t key_timer; @@ -199,32 +210,21 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { return MACRO(D(LCTRL), T(A), U(LCTRL), D(ESC), END); } return MACRO(U(ESC), END); - case MACRO_SHIFT_OR_LPAREN: { + case MACRO_TMUX_PASTE: + if (record->event.pressed) { + return MACRO(D(LCTRL), T(A), U(LCTRL), D(P), END); + } + return MACRO(U(P), END); + case MACRO_OSX_COPY: if (record->event.pressed) { - key_timer = timer_read(); // if the key is being pressed, we start the timer. - register_code(KC_LSFT); // we're now holding down Shift. - } else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down"). - if (timer_elapsed(key_timer) < TAPPING_TERM) { // the threshhold we pick for counting something as a tap. - register_code(KC_9); // sending 9 while Shift is held down gives us an opening paren - unregister_code(KC_9); // now let's let go of that key - } - unregister_code(KC_LSFT); // let's release the Shift key now. + return MACRO(D(LGUI), D(C), END); } - break; - } - case MACRO_SHIFT_OR_RPAREN: { + return MACRO(U(C), U(LGUI), END); + case MACRO_OSX_PASTE: if (record->event.pressed) { - key_timer = timer_read(); // Now we're doing the same thing, only for the right shift/close paren key - register_code(KC_RSFT); - } else { - if (timer_elapsed(key_timer) < TAPPING_TERM) { - register_code(KC_0); - unregister_code(KC_0); - } - unregister_code(KC_RSFT); + return MACRO(D(LGUI), D(V), END); } - break; - } + return MACRO(U(V), U(LGUI), END); } return MACRO_NONE; }; |