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