summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Stillwell <dragonfax@gmail.com>2018-03-16 13:41:01 -0700
committerJack Humbert <jack.humb@gmail.com>2018-03-16 16:41:01 -0400
commit00b4dce605bc44a2ee6babaf93dbe3640e735d2e (patch)
treef146f9f64439a7ea0b16bf91f5f7e89e172a4368
parentbb5c98699fe622a8978c6fc62dc5829d227fdec5 (diff)
Rule to enable Modifiers with Auto-Shift (#2542)
* Re-enable modifiers with auto-shift

* Auto-shift modifiers rule

* missed a line

* Documentation

* fixing whitespace
-rw-r--r--common_features.mk3
-rw-r--r--docs/feature_auto_shift.md17
-rw-r--r--quantum/process_keycode/process_auto_shift.c4
3 files changed, 20 insertions, 4 deletions
diff --git a/common_features.mk b/common_features.mk
index 1c0b3546a1..9b99edd752 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -132,6 +132,9 @@ endif
 ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
     OPT_DEFS += -DAUTO_SHIFT_ENABLE
     SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
+    ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
+        OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
+    endif
 endif
 
 ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md
index ae821431de..9db4f11aa0 100644
--- a/docs/feature_auto_shift.md
+++ b/docs/feature_auto_shift.md
@@ -28,10 +28,7 @@ Yes, unfortunately.
    characters, you could press and hold the 'a' key for a second or two. This no
    longer works with Auto Shift because it is timing your depressed time instead
    of emitting a depressed key state to your operating system.
-2. Auto Shift is disabled for any key press that is accompanied by one or more
-   modifiers. Thus, Ctrl+A that you hold for a really long time is not the same
-   as Ctrl+Shift+A.
-3. You will have characters that are shifted when you did not intend on shifting, and
+2. You will have characters that are shifted when you did not intend on shifting, and
    other characters you wanted shifted, but were not. This simply comes down to
    practice. As we get in a hurry, we think we have hit the key long enough
    for a shifted version, but we did not. On the other hand, we may think we are
@@ -48,6 +45,18 @@ If no `rules.mk` exists, you can create one.
 
 Then compile and install your new firmware with Auto Key enabled! That's it!
 
+## Modifiers
+
+By default, Auto Shift is disabled for any key press that is accompanied by one or more
+modifiers. Thus, Ctrl+A that you hold for a really long time is not the same
+as Ctrl+Shift+A.
+
+You can re-enable Auto Shift for modifiers by adding another rule to your `rules.mk`
+
+    AUTO_SHIFT_MODIFIERS = yes
+
+In which case, Ctrl+A held past the `AUTO_SHIFT_TIMEOUT` will be sent as Ctrl+Shift+A
+
 ## Configuring Auto Shift
 
 If desired, there is some configuration that can be done to change the
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index fcce91849c..098bdeaa7d 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -92,7 +92,9 @@ bool autoshift_state(void) {
 }
 
 bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
+#ifndef AUTO_SHIFT_MODIFIERS
   static uint8_t any_mod_pressed;
+#endif
 
   if (record->event.pressed) {
     switch (keycode) {
@@ -175,6 +177,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
         autoshift_flush();
         if (!autoshift_enabled) return true;
 
+#ifndef AUTO_SHIFT_MODIFIERS
         any_mod_pressed = get_mods() & (
           MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|
           MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)|
@@ -185,6 +188,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
         if (any_mod_pressed) {
           return true;
         }
+#endif
 
         autoshift_on(keycode);
         return false;