]> git.donarmstrong.com Git - qmk_firmware.git/blob - docs/feature_auto_shift.md
Fix up the ARM audio support (#2136)
[qmk_firmware.git] / docs / feature_auto_shift.md
1 # Auto Shift: Why Do We Need a Shift Key?
2
3 Tap a key and you get its character. Tap a key, but hold it *slightly* longer
4 and you get its shifted state. Viola! No shift key needed!
5
6 ## Why Auto Shift?
7
8 Many people suffer from various forms of RSI. A common cause is stretching your
9 fingers repetitively long distances. For us on the keyboard, the pinky does that
10 all too often when reaching for the shift key. Auto Shift looks to alleviate that
11 problem.
12
13 ## How Does It Work?
14
15 When you tap a key, it stays depressed for a short period of time before it is
16 then released. This depressed time is a different length for everyone. Auto Shift
17 defines a constant `AUTO_SHIFT_TIMEOUT` which is typically set to twice your
18 normal pressed state time. When you press a key, a timer starts and then stops
19 when you release the key. If the time depressed is greater than or equal to the
20 `AUTO_SHIFT_TIMEOUT`, then a shifted version of the key is emitted. If the time
21 is less than the `AUTO_SHIFT_TIMEOUT` time, then the normal state is emitted.
22
23 ## Are There Limitations to Auto Shift?
24
25 Yes, unfortunately.
26
27 1. Key repeat will cease to work. For example, before if you wanted 20 'a'
28    characters, you could press and hold the 'a' key for a second or two. This no
29    longer works with Auto Shift because it is timing your depressed time instead
30    of emitting a depressed key state to your operating system.
31 2. Auto Shift is disabled for any key press that is accompanied by one or more
32    modifiers. Thus, Ctrl+A that you hold for a really long time is not the same
33    as Ctrl+Shift+A.
34 3. You will have characters that are shifted when you did not intend on shifting, and
35    other characters you wanted shifted, but were not. This simply comes down to
36    practice. As we get in a hurry, we think we have hit the key long enough
37    for a shifted version, but we did not. On the other hand, we may think we are
38    tapping the keys, but really we have held it for a little longer than
39    anticipated.
40
41 ## How Do I Enable Auto Shift?
42
43 Add to your `rules.mk` in the keymap folder:
44
45     AUTO_SHIFT_ENABLE = yes
46
47 If no `rules.mk` exists, you can create one.
48
49 Then compile and install your new firmware with Auto Key enabled! That's it!
50
51 ## Configuring Auto Shift
52
53 If desired, there is some configuration that can be done to change the
54 behavior of Auto Shift. This is done by setting various variables the
55 `config.h` file located in your keymap folder. If no `config.h` file exists, you can create one.
56
57 A sample is
58
59     #ifndef CONFIG_USER_H
60     #define CONFIG_USER_H
61
62     #include "../../config.h"
63
64     #define AUTO_SHIFT_TIMEOUT 150
65     #define NO_AUTO_SHIFT_SPECIAL
66
67     #endif
68
69 ### AUTO_SHIFT_TIMEOUT (Value in ms)
70
71 This controls how long you have to hold a key before you get the shifted state.
72 Obviously, this is different for everyone. For the common person, a setting of
73 135 to 150 works great. However, one should start with a value of at least 175, which
74 is the default value. Then work down from there. The idea is to have the shortest time required to get the shifted state without having false positives.
75
76 Play with this value until things are perfect. Many find that all will work well
77 at a given value, but one or two keys will still emit the shifted state on
78 occasion. This is simply due to habit and holding some keys a little longer
79 than others. Once you find this value, work on tapping your problem keys a little
80 quicker than normal and you will be set.
81
82 {% hint style='info' %}
83 Auto Shift has three special keys that can help you get this value right very
84 quick. See "Auto Shift Setup" for more details!
85 {% endhint %}
86
87 ### NO_AUTO_SHIFT_SPECIAL (simple define)
88
89 Do not Auto Shift special keys, which include -\_, =+, [{, ]}, ;:, '", ,<, .>,
90 and /?
91
92 ### NO_AUTO_SHIFT_NUMERIC (simple define)
93
94 Do not Auto Shift numeric keys, zero through nine.
95
96 ### NO_AUTO_SHIFT_ALPHA (simple define)
97
98 Do not Auto Shift alpha characters, which include A through Z.
99
100 ## Using Auto Shift Setup
101
102 This will enable you to define three keys temporarily to increase, decrease and report your `AUTO_SHIFT_TIMEOUT`.
103
104 ### Setup
105
106 Map three keys temporarily in your keymap:
107
108 | Key Name | Description                                         |
109 |----------|-----------------------------------------------------|
110 | KC_ASDN  | Lower the Auto Shift timeout variable (down)        |
111 | KC_ASUP  | Raise the Auto Shift timeout variable (up)          |
112 | KC_ASRP  | Report your current Auto Shift timeout value        |
113 | KC_ASON  | Turns on the Auto Shift Function                    |
114 | KC_ASOFF | Turns off the Auto Shift Function                   |
115 | KC_ASTG  | Toggles the statn of the Auto Shift feature         |
116
117 Compile and upload your new firmware.
118
119 ### Use
120
121 It is important to note that during these tests, you should be typing
122 completely normal and with no intention of shifted keys.
123
124 1. Type multiple sentences of alphabetical letters.
125 2. Observe any upper case letters.
126 3. If there are none, press the key you have mapped to `KC_ASDN` to decrease
127    time Auto Shift timeout value and go back to step 1.
128 4. If there are some upper case letters, decide if you need to work on tapping
129    those keys with less down time, or if you need to increase the timeout.
130 5. If you decide to increase the timeout, press the key you have mapped to
131    `KC_ASUP` and go back to step 1.
132 6. Once you are happy with your results, press the key you have mapped to
133    `KC_ASRP`. The keyboard will type by itself the value of your
134    `AUTO_SHIFT_TIMEOUT`.
135 7. Update `AUTO_SHIFT_TIMEOUT` in your `config.h` with the value reported.
136 8. Remove `AUTO_SHIFT_SETUP` from your `config.h`.
137 9. Remove the key bindings `KC_ASDN`, `KC_ASUP` and `KC_ASRP`.
138 10. Compile and upload your new firmware.
139
140 #### An Example Run
141
142     hello world. my name is john doe. i am a computer programmer playing with
143     keyboards right now.
144
145     [PRESS KC_ASDN quite a few times]
146
147     heLLo woRLd. mY nAMe is JOHn dOE. i AM A compUTeR proGRaMMER PlAYiNG witH
148     KEYboArDS RiGHT NOw.
149
150     [PRESS KC_ASUP a few times]
151
152     hello world. my name is john Doe. i am a computer programmer playing with
153     keyboarDs right now.
154
155     [PRESS KC_ASRP]
156
157     115
158
159 The keyboard typed `115` which represents your current `AUTO_SHIFT_TIMEOUT`
160 value. You are now set! Practice on the *D* key a little bit that showed up
161 in the testing and you'll be golden.