diff options
| author | skullY <skullydazed@gmail.com> | 2017-11-28 14:08:32 -0800 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-12-03 00:00:23 -0500 |
| commit | 0b54e7f5ae90ee36e1149b947562e9f7137ec874 (patch) | |
| tree | 7118649a9e93f2edeaa1b64d12f73641b8ca65df | |
| parent | 8cac6088c694474908a8237497026e090aaf4a35 (diff) | |
| download | qmk_firmware-0b54e7f5ae90ee36e1149b947562e9f7137ec874.tar.gz qmk_firmware-0b54e7f5ae90ee36e1149b947562e9f7137ec874.zip | |
Flesh out the grave escape overrides
| -rw-r--r-- | docs/_summary.md | 1 | ||||
| -rw-r--r-- | docs/faq_keymap.md | 6 | ||||
| -rw-r--r-- | docs/feature_grave_esc.md | 17 | ||||
| -rw-r--r-- | quantum/quantum.c | 27 |
4 files changed, 45 insertions, 6 deletions
diff --git a/docs/_summary.md b/docs/_summary.md index 3c10e101d..2c0fc17e3 100644 --- a/docs/_summary.md +++ b/docs/_summary.md | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | * [Backlight](feature_backlight.md) | 26 | * [Backlight](feature_backlight.md) |
| 27 | * [Bootmagic](feature_bootmagic.md) | 27 | * [Bootmagic](feature_bootmagic.md) |
| 28 | * [Dynamic Macros](feature_dynamic_macros.md) | 28 | * [Dynamic Macros](feature_dynamic_macros.md) |
| 29 | * [Grave Escape](feature_grave_escape.md) | ||
| 29 | * [Key Lock](feature_key_lock.md) | 30 | * [Key Lock](feature_key_lock.md) |
| 30 | * [Layouts](feature_layouts.md) | 31 | * [Layouts](feature_layouts.md) |
| 31 | * [Leader Key](feature_leader_key.md) | 32 | * [Leader Key](feature_leader_key.md) |
diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md index 83eeb235e..6a364eb53 100644 --- a/docs/faq_keymap.md +++ b/docs/faq_keymap.md | |||
| @@ -125,11 +125,9 @@ https://github.com/tmk/tmk_keyboard/issues/213 | |||
| 125 | https://github.com/tekezo/Karabiner/issues/403 | 125 | https://github.com/tekezo/Karabiner/issues/403 |
| 126 | 126 | ||
| 127 | 127 | ||
| 128 | ## Esc and `~ on a key | 128 | ## Esc and `~ on a single key |
| 129 | 129 | ||
| 130 | Use `GRAVE_ESC` or `KC_GESC` in your keymap. `GUI`+`GRAVE_ESC` results in `` ` `` and `SHIFT`+`GRAVE_ESC` results in `~`. | 130 | See the [Grave Escape](feature_grave_escape.md) feature. |
| 131 | |||
| 132 | Note that this will break the CTRL+SHIFT+ESC shortcut to the Windows task manager. Use `#define GRAVE_ESC_CTRL_OVERRIDE` in your `config.h` to get the shortcut back. With this option, `ESC_GRAVE` results in `ESC` if `CTRL` is held, even if `SHIFT` or `GUI` are also held. | ||
| 133 | 131 | ||
| 134 | ## Arrow on Right Modifier keys with Dual-Role | 132 | ## Arrow on Right Modifier keys with Dual-Role |
| 135 | This turns right modifer keys into arrow keys when the keys are tapped while still modifiers when the keys are hold. In TMK the dual-role function is dubbed **TAP**. | 133 | This turns right modifer keys into arrow keys when the keys are tapped while still modifiers when the keys are hold. In TMK the dual-role function is dubbed **TAP**. |
diff --git a/docs/feature_grave_esc.md b/docs/feature_grave_esc.md new file mode 100644 index 000000000..ea3c55c63 --- /dev/null +++ b/docs/feature_grave_esc.md | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | # Grave Escape | ||
| 2 | |||
| 3 | Grave Escape is a feature that allows you to share the grave key (`\`` and `~`) on the same key as Escape. When `KC_GESC` is used it will act as `KC_ESC`, unless Shift or GUI is pressed, in which case it will act as `KC_GRAVE`. | ||
| 4 | |||
| 5 | |||
| 6 | | Key | Alias | Description | | ||
| 7 | |-----|-------|-------------| | ||
| 8 | | `GRAVE_ESC` | `KC_GESC` | Act as `KC_ESC` normally, or `KC_GRAVE` when GUI or Shift are held. | | ||
| 9 | |||
| 10 | There are several possible key combinations this will break, among them Ctrl+Shift+Esc on Windows and Cmd+Opt+Esc on macOS. You can use these options in your `config.h` to work around this: | ||
| 11 | |||
| 12 | | Option | Description | | ||
| 13 | |--------|-------------| | ||
| 14 | | `GRAVE_ESC_ALT_OVERRIDE` | Always send Escape if Alt is pressed. | | ||
| 15 | | `GRAVE_ESC_CTRL_OVERRIDE` | Always send Escape if Ctrl is pressed. | | ||
| 16 | | `GRAVE_ESC_GUI_OVERRIDE` | Always send Escape if GUI is pressed. | | ||
| 17 | | `GRAVE_ESC_SHIFT_OVERRIDE` | Always send Escape if SHIFT is pressed. | | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index 9232cf441..d08f15870 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -548,11 +548,34 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 548 | uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) | 548 | uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT) |
| 549 | |MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))); | 549 | |MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))); |
| 550 | 550 | ||
| 551 | #ifdef GRAVE_ESC_ALT_OVERRIDE | ||
| 552 | // if ALT is pressed, ESC is always sent | ||
| 553 | // this is handy for the cmd+opt+esc shortcut on macOS, among other things. | ||
| 554 | if (get_mods() & (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT))) { | ||
| 555 | shifted = 0; | ||
| 556 | } | ||
| 557 | #endif | ||
| 558 | |||
| 551 | #ifdef GRAVE_ESC_CTRL_OVERRIDE | 559 | #ifdef GRAVE_ESC_CTRL_OVERRIDE |
| 552 | // if CTRL is pressed, ESC is always read as ESC, even if SHIFT or GUI is pressed. | 560 | // if CTRL is pressed, ESC is always sent |
| 553 | // this is handy for the ctrl+shift+esc shortcut on windows, among other things. | 561 | // this is handy for the ctrl+shift+esc shortcut on windows, among other things. |
| 554 | if (get_mods() & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))) | 562 | if (get_mods() & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))) { |
| 555 | shifted = 0; | 563 | shifted = 0; |
| 564 | } | ||
| 565 | #endif | ||
| 566 | |||
| 567 | #ifdef GRAVE_ESC_GUI_OVERRIDE | ||
| 568 | // if GUI is pressed, ESC is always sent | ||
| 569 | if (get_mods() & (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI))) { | ||
| 570 | shifted = 0; | ||
| 571 | } | ||
| 572 | #endif | ||
| 573 | |||
| 574 | #ifdef GRAVE_ESC_SHIFT_OVERRIDE | ||
| 575 | // if SHIFT is pressed, ESC is always sent | ||
| 576 | if (get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) { | ||
| 577 | shifted = 0; | ||
| 578 | } | ||
| 556 | #endif | 579 | #endif |
| 557 | 580 | ||
| 558 | if (record->event.pressed) { | 581 | if (record->event.pressed) { |
