summaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_caps_word.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_caps_word.c')
-rw-r--r--quantum/process_keycode/process_caps_word.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/quantum/process_keycode/process_caps_word.c b/quantum/process_keycode/process_caps_word.c
index ffd509a914..1b9583196d 100644
--- a/quantum/process_keycode/process_caps_word.c
+++ b/quantum/process_keycode/process_caps_word.c
@@ -101,14 +101,34 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
return true;
#ifndef NO_ACTION_TAPPING
+ // Corresponding to mod keys above, a held mod-tap is handled as:
+ // * For shift mods, pass KC_LSFT or KC_RSFT to
+ // caps_word_press_user() to determine whether to continue.
+ // * For Shift + AltGr (MOD_RSFT | MOD_RALT), pass RSFT(KC_RALT).
+ // * AltGr (MOD_RALT) is ignored.
+ // * Otherwise stop Caps Word.
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
- if (record->tap.count == 0) {
- // Deactivate if a mod becomes active through holding
- // a mod-tap key.
- caps_word_off();
- return true;
+ if (record->tap.count == 0) { // Mod-tap key is held.
+ const uint8_t mods = (keycode >> 8) & 0x1f;
+ switch (mods) {
+ case MOD_LSFT:
+ keycode = KC_LSFT;
+ break;
+ case MOD_RSFT:
+ keycode = KC_RSFT;
+ break;
+ case MOD_RSFT | MOD_RALT:
+ keycode = RSFT(KC_RALT);
+ break;
+ case MOD_RALT:
+ return true;
+ default:
+ caps_word_off();
+ return true;
+ }
+ } else {
+ keycode &= 0xff;
}
- keycode &= 0xff;
break;
# ifndef NO_ACTION_LAYER
@@ -131,7 +151,11 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
#endif // SWAP_HANDS_ENABLE
}
+#ifdef AUTO_SHIFT_ENABLE
+ del_weak_mods(get_autoshift_state() ? ~MOD_BIT(KC_LSFT) : 0xff);
+#else
clear_weak_mods();
+#endif // AUTO_SHIFT_ENABLE
if (caps_word_press_user(keycode)) {
send_keyboard_report();
return true;