Implement MAGIC_TOGGLE_CONTROL_CAPSLOCK (#15368)
parent
3079fd0415
commit
2726856cde
|
@ -326,6 +326,7 @@ See also: [Magic Keycodes](keycodes_magic.md)
|
||||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
||||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
||||||
|
|`MAGIC_TOGGLE_CONTROL_CAPSLOCK` |`CL_TOGG`|Toggle Caps Lock and Left Control swap |
|
||||||
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
||||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
||||||
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
||||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
||||||
|
|`MAGIC_TOGGLE_CONTROL_CAPSLOCK` |`CL_TOGG`|Toggle Caps Lock and Left Control swap |
|
||||||
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
||||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
||||||
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
||||||
|
|
|
@ -44,6 +44,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||||
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
|
case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_ALT_GUI:
|
||||||
case MAGIC_SWAP_LCTL_LGUI ... MAGIC_EE_HANDS_RIGHT:
|
case MAGIC_SWAP_LCTL_LGUI ... MAGIC_EE_HANDS_RIGHT:
|
||||||
case MAGIC_TOGGLE_GUI:
|
case MAGIC_TOGGLE_GUI:
|
||||||
|
case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
|
||||||
/* keymap config */
|
/* keymap config */
|
||||||
keymap_config.raw = eeconfig_read_keymap();
|
keymap_config.raw = eeconfig_read_keymap();
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
|
@ -168,6 +169,9 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
|
||||||
case MAGIC_TOGGLE_GUI:
|
case MAGIC_TOGGLE_GUI:
|
||||||
keymap_config.no_gui = !keymap_config.no_gui;
|
keymap_config.no_gui = !keymap_config.no_gui;
|
||||||
break;
|
break;
|
||||||
|
case MAGIC_TOGGLE_CONTROL_CAPSLOCK:
|
||||||
|
keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
eeconfig_update_keymap(keymap_config.raw);
|
eeconfig_update_keymap(keymap_config.raw);
|
||||||
|
|
|
@ -597,6 +597,8 @@ enum quantum_keycodes {
|
||||||
MACRO_30,
|
MACRO_30,
|
||||||
MACRO_31,
|
MACRO_31,
|
||||||
|
|
||||||
|
MAGIC_TOGGLE_CONTROL_CAPSLOCK,
|
||||||
|
|
||||||
// Start of custom keycode range for keyboards and keymaps - always leave at the end
|
// Start of custom keycode range for keyboards and keymaps - always leave at the end
|
||||||
SAFE_RANGE
|
SAFE_RANGE
|
||||||
};
|
};
|
||||||
|
@ -749,6 +751,7 @@ enum quantum_keycodes {
|
||||||
#define CL_NORM MAGIC_UNSWAP_CONTROL_CAPSLOCK
|
#define CL_NORM MAGIC_UNSWAP_CONTROL_CAPSLOCK
|
||||||
#define CL_CTRL MAGIC_CAPSLOCK_TO_CONTROL
|
#define CL_CTRL MAGIC_CAPSLOCK_TO_CONTROL
|
||||||
#define CL_CAPS MAGIC_UNCAPSLOCK_TO_CONTROL
|
#define CL_CAPS MAGIC_UNCAPSLOCK_TO_CONTROL
|
||||||
|
#define CL_TOGG MAGIC_TOGGLE_CONTROL_CAPSLOCK
|
||||||
|
|
||||||
#define LCG_SWP MAGIC_SWAP_LCTL_LGUI
|
#define LCG_SWP MAGIC_SWAP_LCTL_LGUI
|
||||||
#define LCG_NRM MAGIC_UNSWAP_LCTL_LGUI
|
#define LCG_NRM MAGIC_UNSWAP_LCTL_LGUI
|
||||||
|
|
Loading…
Reference in New Issue