summaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorStephen Wanhella <Stephen.wanhella@gmail.com>2019-08-21 17:07:08 -0700
committerDrashna Jaelre <drashna@live.com>2019-08-21 17:07:08 -0700
commitd534c72a544454132b3c6c05af85c821f6a93d65 (patch)
tree906a66b899e4de1d7ffe567bbdb2c9082d948140 /quantum/quantum.c
parent6a79b05cf02d5a6f07b17474344e272b44c77988 (diff)
downloadqmk_firmware-d534c72a544454132b3c6c05af85c821f6a93d65.tar.gz
qmk_firmware-d534c72a544454132b3c6c05af85c821f6a93d65.zip
Added keycodes for swapping and unswapping the Control and OS keys (#6110)
* Add MAGIC_SWAP_CONTROL_LGUI and MAGIC_UNSWAP_CONTROL_LGUI keycodes Key codes to swap and unswap the control and windows/cmd keys * Fix issues with pull request #6110 Renamed swap/unswap lctl and lgui key codes, added key codes to swap/unswap rctl and rgui, and moved new bool inside keycode_config.h struct to the end * Move new keycodes to the end of the enum (#6110) * add cases for swapped control and OS keys to mod_config (#6110) * Add new keycodes to feature_bootmagic.md (#6110) * Add R+L swap codes to keep in parity with AG_* codes * Extend Magic range check to include new magic codes * Update audio docs * Combine 2 byte ranges into 1 word for EECONFG Fix names for Keymap config EEPROM * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/feature_bootmagic.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 77cbbb2e77..f489c90310 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -65,9 +65,17 @@ extern backlight_config_t backlight_config;
#ifndef AG_SWAP_SONG
#define AG_SWAP_SONG SONG(AG_SWAP_SOUND)
#endif
+ #ifndef CG_NORM_SONG
+ #define CG_NORM_SONG SONG(AG_NORM_SOUND)
+ #endif
+ #ifndef CG_SWAP_SONG
+ #define CG_SWAP_SONG SONG(AG_SWAP_SOUND)
+ #endif
float goodbye_song[][2] = GOODBYE_SONG;
float ag_norm_song[][2] = AG_NORM_SONG;
float ag_swap_song[][2] = AG_SWAP_SONG;
+ float cg_norm_song[][2] = CG_NORM_SONG;
+ float cg_swap_song[][2] = CG_SWAP_SONG;
#ifdef DEFAULT_LAYER_SONGS
float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
#endif
@@ -563,7 +571,8 @@ bool process_record_quantum(keyrecord_t *record) {
return false;
#endif
#endif
- case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
+ case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
+ case MAGIC_SWAP_LCTL_LGUI ... MAGIC_TOGGLE_CTL_GUI:
if (record->event.pressed) {
// MAGIC actions (BOOTMAGIC without the boot)
if (!eeconfig_is_enabled()) {
@@ -585,6 +594,12 @@ bool process_record_quantum(keyrecord_t *record) {
case MAGIC_SWAP_RALT_RGUI:
keymap_config.swap_ralt_rgui = true;
break;
+ case MAGIC_SWAP_LCTL_LGUI:
+ keymap_config.swap_lctl_lgui = true;
+ break;
+ case MAGIC_SWAP_RCTL_RGUI:
+ keymap_config.swap_rctl_rgui = true;
+ break;
case MAGIC_NO_GUI:
keymap_config.no_gui = true;
break;
@@ -604,6 +619,13 @@ bool process_record_quantum(keyrecord_t *record) {
PLAY_SONG(ag_swap_song);
#endif
break;
+ case MAGIC_SWAP_CTL_GUI:
+ keymap_config.swap_lctl_lgui = true;
+ keymap_config.swap_rctl_rgui = true;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(cg_swap_song);
+ #endif
+ break;
case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
keymap_config.swap_control_capslock = false;
break;
@@ -616,6 +638,12 @@ bool process_record_quantum(keyrecord_t *record) {
case MAGIC_UNSWAP_RALT_RGUI:
keymap_config.swap_ralt_rgui = false;
break;
+ case MAGIC_UNSWAP_LCTL_LGUI:
+ keymap_config.swap_lctl_lgui = false;
+ break;
+ case MAGIC_UNSWAP_RCTL_RGUI:
+ keymap_config.swap_rctl_rgui = false;
+ break;
case MAGIC_UNNO_GUI:
keymap_config.no_gui = false;
break;
@@ -635,6 +663,13 @@ bool process_record_quantum(keyrecord_t *record) {
PLAY_SONG(ag_norm_song);
#endif
break;
+ case MAGIC_UNSWAP_CTL_GUI:
+ keymap_config.swap_lctl_lgui = false;
+ keymap_config.swap_rctl_rgui = false;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(cg_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;
@@ -646,6 +681,17 @@ bool process_record_quantum(keyrecord_t *record) {
}
#endif
break;
+ case MAGIC_TOGGLE_CTL_GUI:
+ keymap_config.swap_lctl_lgui = !keymap_config.swap_lctl_lgui;
+ keymap_config.swap_rctl_rgui = !keymap_config.swap_rctl_rgui;
+ #ifdef AUDIO_ENABLE
+ if (keymap_config.swap_rctl_rgui) {
+ PLAY_SONG(cg_swap_song);
+ } else {
+ PLAY_SONG(cg_norm_song);
+ }
+ #endif
+ break;
case MAGIC_TOGGLE_NKRO:
keymap_config.nkro = !keymap_config.nkro;
break;