aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Wasson <joe@talljoe.com>2018-09-17 09:23:43 -0700
committerGravatar Drashna Jaelre <drashna@live.com>2018-09-17 15:04:22 -0700
commita6d1db2c275f2e33e23135a6e410dbc8d19720a2 (patch)
tree647632d1df64f5e7a1f083caad6fc0da77892f7d
parent244e1c5a57eecd349c7d88e1af42d1b3467aeafe (diff)
downloadqmk_firmware-a6d1db2c275f2e33e23135a6e410dbc8d19720a2.tar.gz
Create AG_TOGG code to toggle Alt/Gui swap.
-rw-r--r--docs/feature_bootmagic.md1
-rw-r--r--docs/keycodes.md1
-rw-r--r--quantum/quantum.c11
-rw-r--r--quantum/quantum_keycodes.h2
4 files changed, 15 insertions, 0 deletions
diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md
index d6915d355..586b5d837 100644
--- a/docs/feature_bootmagic.md
+++ b/docs/feature_bootmagic.md
@@ -57,6 +57,7 @@ Hold down the Bootmagic key (Space by default) and the desired hotkey while plug
|`MAGIC_UNNO_GUI` | |Enable the GUI keys |
|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides (for macOS)|
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Left Alt and Left GUI |
+|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Left Alt and GUI swap |
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace |
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Left Control and Caps Lock |
diff --git a/docs/keycodes.md b/docs/keycodes.md
index c344a7528..6676bb53c 100644
--- a/docs/keycodes.md
+++ b/docs/keycodes.md
@@ -271,6 +271,7 @@ This is a reference only. Each group of keys links to the page documenting their
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
|`MAGIC_UNHOST_NKRO` | |Force NKRO off |
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides |
+|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides|
|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off |
## [Bluetooth](feature_bluetooth.md)
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 9bf91eb86..84ccbdeab 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -626,6 +626,17 @@ bool process_record_quantum(keyrecord_t *record) {
PLAY_SONG(ag_norm_song);
#endif
break;
+ case MAGIC_TOGGLE_ALT_GUI:
+ keymap_config.swap_lalt_lgui = !keymap_config.swap_lalt_lgui;
+ keymap_config.swap_ralt_rgui = !keymap_config.swap_ralt_rgui;
+ #ifdef AUDIO_ENABLE
+ if (keymap_config.swap_ralt_rgui) {
+ PLAY_SONG(ag_swap_song);
+ } else {
+ PLAY_SONG(ag_norm_song);
+ }
+ #endif
+ break;
case MAGIC_TOGGLE_NKRO:
keymap_config.nkro = !keymap_config.nkro;
break;
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 3b8795496..050d2d275 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -116,6 +116,7 @@ enum quantum_keycodes {
MAGIC_UNHOST_NKRO,
MAGIC_UNSWAP_ALT_GUI,
MAGIC_TOGGLE_NKRO,
+ MAGIC_TOGGLE_ALT_GUI,
GRAVE_ESC,
// Leader key
@@ -590,6 +591,7 @@ enum quantum_keycodes {
#define AG_SWAP MAGIC_SWAP_ALT_GUI
#define AG_NORM MAGIC_UNSWAP_ALT_GUI
+#define AG_TOGG MAGIC_TOGGLE_ALT_GUI
// GOTO layer - 16 layers max
// when: