Flesh out the grave escape overrides

master
skullY 2017-11-28 14:08:32 -08:00 committed by Jack Humbert
parent 8cac6088c6
commit 0b54e7f5ae
4 changed files with 47 additions and 8 deletions

View File

@ -26,6 +26,7 @@
* [Backlight](feature_backlight.md)
* [Bootmagic](feature_bootmagic.md)
* [Dynamic Macros](feature_dynamic_macros.md)
* [Grave Escape](feature_grave_escape.md)
* [Key Lock](feature_key_lock.md)
* [Layouts](feature_layouts.md)
* [Leader Key](feature_leader_key.md)

View File

@ -125,11 +125,9 @@ https://github.com/tmk/tmk_keyboard/issues/213
https://github.com/tekezo/Karabiner/issues/403
## Esc and `~ on a key
## Esc and `~ on a single key
Use `GRAVE_ESC` or `KC_GESC` in your keymap. `GUI`+`GRAVE_ESC` results in `` ` `` and `SHIFT`+`GRAVE_ESC` results in `~`.
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.
See the [Grave Escape](feature_grave_escape.md) feature.
## Arrow on Right Modifier keys with Dual-Role
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**.

View File

@ -0,0 +1,17 @@
# Grave Escape
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`.
| Key | Alias | Description |
|-----|-------|-------------|
| `GRAVE_ESC` | `KC_GESC` | Act as `KC_ESC` normally, or `KC_GRAVE` when GUI or Shift are held. |
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:
| Option | Description |
|--------|-------------|
| `GRAVE_ESC_ALT_OVERRIDE` | Always send Escape if Alt is pressed. |
| `GRAVE_ESC_CTRL_OVERRIDE` | Always send Escape if Ctrl is pressed. |
| `GRAVE_ESC_GUI_OVERRIDE` | Always send Escape if GUI is pressed. |
| `GRAVE_ESC_SHIFT_OVERRIDE` | Always send Escape if SHIFT is pressed. |

View File

@ -548,11 +548,34 @@ bool process_record_quantum(keyrecord_t *record) {
uint8_t shifted = get_mods() & ((MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)
|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)));
#ifdef GRAVE_ESC_CTRL_OVERRIDE
// if CTRL is pressed, ESC is always read as ESC, even if SHIFT or GUI is pressed.
// this is handy for the ctrl+shift+esc shortcut on windows, among other things.
if (get_mods() & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)))
#ifdef GRAVE_ESC_ALT_OVERRIDE
// if ALT is pressed, ESC is always sent
// this is handy for the cmd+opt+esc shortcut on macOS, among other things.
if (get_mods() & (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT))) {
shifted = 0;
}
#endif
#ifdef GRAVE_ESC_CTRL_OVERRIDE
// if CTRL is pressed, ESC is always sent
// this is handy for the ctrl+shift+esc shortcut on windows, among other things.
if (get_mods() & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))) {
shifted = 0;
}
#endif
#ifdef GRAVE_ESC_GUI_OVERRIDE
// if GUI is pressed, ESC is always sent
if (get_mods() & (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI))) {
shifted = 0;
}
#endif
#ifdef GRAVE_ESC_SHIFT_OVERRIDE
// if SHIFT is pressed, ESC is always sent
if (get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) {
shifted = 0;
}
#endif
if (record->event.pressed) {