summaryrefslogtreecommitdiffstats
path: root/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c')
-rw-r--r--keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c b/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c
index 24ff1c6884..bf5a974bfe 100644
--- a/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c
+++ b/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c
@@ -7,6 +7,9 @@
#define SYMB 1 // symbols
#define MDIA 2 // media keys
+#define LSFTO M(0) // Left shift, open parens when tapped
+#define RSFTC M(1) // Right shift, close parens when tapped
+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
@@ -17,9 +20,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | BkSp | A | S | D | F | G |------| |------| H | Alt/J| K | L |; / L2| LGui/' |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
- * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
+ * |LShift/(|Z/Ctrl| X | C | V | B | [ | | ] | N | M | , | . |//Ctrl|RShift/)|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
- * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
+ * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | - |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | App | LGui | | Alt |Ctrl/Esc|
@@ -36,18 +39,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
- KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
+ LSFTO, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_LBRC),
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
ALT_T(KC_APP), KC_LGUI,
KC_HOME,
- KC_SPC,KC_FN1,KC_END,
+ KC_SPC,KC_FN1,KC_END,
// right hand
- KC_RGHT, KC_6,KC_7, KC_8, KC_9, KC_0, KC_MINS,
- TG(SYMB), KC_Y,KC_U, KC_I, KC_O, KC_P, KC_BSLS,
- KC_H,ALT_T(KC_J),KC_K, KC_L, LT(MDIA,KC_SCLN),GUI_T(KC_QUOT),
- MEH_T(KC_NO),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
- KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
- KC_LALT, CTL_T(KC_ESC),
+ KC_RGHT, KC_6,KC_7, KC_8, KC_9, KC_0, KC_MINS,
+ TG(SYMB), KC_Y,KC_U, KC_I, KC_O, KC_P, KC_BSLS,
+ KC_H,ALT_T(KC_J),KC_K, KC_L, LT(MDIA,KC_SCLN),GUI_T(KC_QUOT),
+ MEH_T(KC_RBRC),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), RSFTC,
+ KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_MINS,
+ KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
KC_PGDN,LT(SYMB, KC_TAB), KC_ENT
),
@@ -140,17 +143,37 @@ const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
};
+static uint16_t key_timer;
+
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
- // MACRODOWN only works in this function
switch(id) {
- case 0:
- if (record->event.pressed) {
- register_code(KC_RSFT);
- } else {
- unregister_code(KC_RSFT);
+ case 0: {
+ 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) < 70) { // 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.
+ }
+ break;
+ }
+ case 1: {
+ 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) < 70) {
+ register_code(KC_0);
+ unregister_code(KC_0);
+ }
+ unregister_code(KC_RSFT);
+ }
+ break;
}
- break;
}
return MACRO_NONE;
};
@@ -183,3 +206,5 @@ void matrix_scan_user(void) {
}
};
+
+