From 4c4f632378867b5c3e61461333974f59170893c3 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 17 Aug 2021 15:47:50 -0700 Subject: [PATCH] Add a toggle key for GUI On/Off in Magic feature (#13830) --- docs/keycodes_magic.md | 1 + quantum/process_keycode/process_magic.c | 3 +++ quantum/quantum_keycodes.h | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/docs/keycodes_magic.md b/docs/keycodes_magic.md index 719d820312d3..7e1b1a4f6235 100644 --- a/docs/keycodes_magic.md +++ b/docs/keycodes_magic.md @@ -24,6 +24,7 @@ |`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides | |`MAGIC_NO_GUI` |`GUI_OFF`|Disable the GUI keys | |`MAGIC_UNNO_GUI` |`GUI_ON` |Enable the GUI keys | +|`MAGIC_TOGGLE_GUI` |`GUI_TOG`|Toggles the status of the GUI keys | |`MAGIC_SWAP_GRAVE_ESC` |`GE_SWAP`|Swap ` and Escape | |`MAGIC_UNSWAP_GRAVE_ESC` |`GE_NORM`|Unswap ` and Escape | |`MAGIC_SWAP_BACKSLASH_BACKSPACE` |`BS_SWAP`|Swap `\` and Backspace | diff --git a/quantum/process_keycode/process_magic.c b/quantum/process_keycode/process_magic.c index 44dd5f057955..01f2fb92892b 100644 --- a/quantum/process_keycode/process_magic.c +++ b/quantum/process_keycode/process_magic.c @@ -164,6 +164,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) { case MAGIC_EE_HANDS_RIGHT: eeconfig_update_handedness(false); break; + case MAGIC_TOGGLE_GUI: + keymap_config.no_gui = !keymap_config.no_gui; + break; } eeconfig_update_keymap(keymap_config.raw); diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 08ed5a490de5..ef4b0f457b4b 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -521,6 +521,9 @@ enum quantum_keycodes { KEY_OVERRIDE_ON, KEY_OVERRIDE_OFF, + // Additional magic key + MAGIC_TOGGLE_GUI, + // Start of custom keycode range for keyboards and keymaps - always leave at the end SAFE_RANGE }; @@ -694,6 +697,7 @@ enum quantum_keycodes { #define GUI_OFF MAGIC_NO_GUI #define GUI_ON MAGIC_UNNO_GUI +#define GUI_TOG MAGIC_TOGGLE_GUI #define GE_SWAP MAGIC_SWAP_GRAVE_ESC #define GE_NORM MAGIC_UNSWAP_GRAVE_ESC