]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Flesh out the grave escape overrides
authorskullY <skullydazed@gmail.com>
Tue, 28 Nov 2017 22:08:32 +0000 (14:08 -0800)
committerJack Humbert <jack.humb@gmail.com>
Sun, 3 Dec 2017 05:00:23 +0000 (00:00 -0500)
docs/_summary.md
docs/faq_keymap.md
docs/feature_grave_esc.md [new file with mode: 0644]
quantum/quantum.c

index 3c10e101d19ae4cedb193c992e6091ce1c8b7cee..2c0fc17e36f241494b86cb375876c8594f073e91 100644 (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)
index 83eeb235ef14331210e63463a400b583665147f2..6a364eb538abee67adc18c68c984ffea0fb4e228 100644 (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**.
diff --git a/docs/feature_grave_esc.md b/docs/feature_grave_esc.md
new file mode 100644 (file)
index 0000000..ea3c55c
--- /dev/null
@@ -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. |
index 9232cf4411ed49549856821d57a0441945645b30..d08f15870c497b3e7ef202f7c49d77b580a47d2e 100644 (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_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 read as ESC, even if SHIFT or GUI is pressed.
+      // 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)))
+      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) {