1
0
Fork 0
This commit is contained in:
Jack Humbert 2016-06-17 21:42:59 -04:00
parent c4ea06d255
commit b70248fa21
2 changed files with 24 additions and 8 deletions

View file

@ -134,6 +134,11 @@ Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/)
To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift. To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
It's defaulted to work on US keyboards, but if your layout uses different keys for parenthesis, you can define those in your keymap like this:
#define LSPO_KEY KC_9
#define RSPC_KEY KC_0
The only other thing you're going to want to do is create a `makefile.mk` in your keymap directory and set the following: The only other thing you're going to want to do is create a `makefile.mk` in your keymap directory and set the following:
``` ```

View file

@ -70,6 +70,15 @@ uint8_t chord_key_down = 0;
static uint8_t input_mode; static uint8_t input_mode;
#endif #endif
// Shift / paren setup
#ifndef LSPO_KEY
#define LSPO_KEY KC_9
#endif
#ifndef RSPC_KEY
#define RSPC_KEY KC_0
#endif
static bool shift_interrupted[2] = {0, 0}; static bool shift_interrupted[2] = {0, 0};
bool keys_chord(uint8_t keys[]) { bool keys_chord(uint8_t keys[]) {
@ -431,18 +440,20 @@ bool process_record_quantum(keyrecord_t *record) {
#endif #endif
// Shift / paren setup
switch(keycode) { switch(keycode) {
case KC_LSPO: { case KC_LSPO: {
if (record->event.pressed) { if (record->event.pressed) {
shift_interrupted[0] = false; shift_interrupted[0] = false;
register_mods(MOD_BIT(KC_LSFT)); register_mods(MOD_LSFT);
} }
else { else {
if (!shift_interrupted[0]) { if (!shift_interrupted[0]) {
register_code(KC_9); register_code(LSPO_KEY);
unregister_code(KC_9); unregister_code(LSPO_KEY);
} }
unregister_mods(MOD_BIT(KC_LSFT)); unregister_mods(MOD_LSFT);
} }
return false; return false;
break; break;
@ -451,14 +462,14 @@ bool process_record_quantum(keyrecord_t *record) {
case KC_RSPC: { case KC_RSPC: {
if (record->event.pressed) { if (record->event.pressed) {
shift_interrupted[1] = false; shift_interrupted[1] = false;
register_mods(MOD_BIT(KC_RSFT)); register_mods(MOD_RSFT);
} }
else { else {
if (!shift_interrupted[1]) { if (!shift_interrupted[1]) {
register_code(KC_0); register_code(RSPC_KEY);
unregister_code(KC_0); unregister_code(RSPC_KEY);
} }
unregister_mods(MOD_BIT(KC_RSFT)); unregister_mods(MOD_RSFT);
} }
return false; return false;
break; break;