Skip to content

Commit 44decf3

Browse files
authored
Add a toggle key for GUI On/Off in Magic feature (qmk#13830)
1 parent dd16f1e commit 44decf3

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

docs/keycodes_magic.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides |
2525
|`MAGIC_NO_GUI` |`GUI_OFF`|Disable the GUI keys |
2626
|`MAGIC_UNNO_GUI` |`GUI_ON` |Enable the GUI keys |
27+
|`MAGIC_TOGGLE_GUI` |`GUI_TOG`|Toggles the status of the GUI keys |
2728
|`MAGIC_SWAP_GRAVE_ESC` |`GE_SWAP`|Swap <code>&#96;</code> and Escape |
2829
|`MAGIC_UNSWAP_GRAVE_ESC` |`GE_NORM`|Unswap <code>&#96;</code> and Escape |
2930
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` |`BS_SWAP`|Swap `\` and Backspace |

quantum/process_keycode/process_magic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
164164
case MAGIC_EE_HANDS_RIGHT:
165165
eeconfig_update_handedness(false);
166166
break;
167+
case MAGIC_TOGGLE_GUI:
168+
keymap_config.no_gui = !keymap_config.no_gui;
169+
break;
167170
}
168171

169172
eeconfig_update_keymap(keymap_config.raw);

quantum/quantum_keycodes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ enum quantum_keycodes {
521521
KEY_OVERRIDE_ON,
522522
KEY_OVERRIDE_OFF,
523523

524+
// Additional magic key
525+
MAGIC_TOGGLE_GUI,
526+
524527
// Start of custom keycode range for keyboards and keymaps - always leave at the end
525528
SAFE_RANGE
526529
};
@@ -694,6 +697,7 @@ enum quantum_keycodes {
694697

695698
#define GUI_OFF MAGIC_NO_GUI
696699
#define GUI_ON MAGIC_UNNO_GUI
700+
#define GUI_TOG MAGIC_TOGGLE_GUI
697701

698702
#define GE_SWAP MAGIC_SWAP_GRAVE_ESC
699703
#define GE_NORM MAGIC_UNSWAP_GRAVE_ESC

0 commit comments

Comments
 (0)