Skip to content

Commit 0aefbb3

Browse files
drashnamechmerlin
authored andcommitted
Make delay for Capslock in Hold-Tap functions configurable (qmk#5497)
* Increase delay for Hold-Tap register for CAPSLOCK Because it seems that the 80ms delay wasn't too much * Screw it, make the caps delay a define and make it configurable
1 parent 9e98632 commit 0aefbb3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/config_options.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ If you define these options you will enable the associated feature, which may in
171171
* how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined.
172172
* `#define TAP_CODE_DELAY 100`
173173
* Sets the delay between `register_code` and `unregister_code`, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds.
174+
* `#define TAP_HOLD_CAPS_DELAY 200`
175+
* Sets the delay for Tap Hold keys (`LT`, `MT`) when using `KC_CAPSLOCK` keycode, as this has some special handling on MacOS. The value is in milliseconds, and defaults to 200ms if not defined.
174176

175177
## RGB Light Configuration
176178

tmk_core/common/action.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ int retro_tapping_counter = 0;
4444
#include <fauxclicky.h>
4545
#endif
4646

47+
#ifndef TAP_HOLD_CAPS_DELAY
48+
# define TAP_HOLD_CAPS_DELAY 200
49+
#endif
4750
/** \brief Called to execute an action.
4851
*
4952
* FIXME: Needs documentation.
@@ -518,7 +521,7 @@ void process_action(keyrecord_t *record, action_t action)
518521
if (tap_count > 0) {
519522
dprint("KEYMAP_TAP_KEY: Tap: unregister_code\n");
520523
if (action.layer_tap.code == KC_CAPS) {
521-
wait_ms(80);
524+
wait_ms(TAP_HOLD_CAPS_DELAY);
522525
}
523526
unregister_code(action.layer_tap.code);
524527
} else {
@@ -853,8 +856,13 @@ void unregister_code(uint8_t code)
853856
*/
854857
void tap_code(uint8_t code) {
855858
register_code(code);
859+
if (code == KC_CAPS) {
860+
wait_ms(TAP_HOLD_CAPS_DELAY);
861+
}
856862
#if TAP_CODE_DELAY > 0
863+
else {
857864
wait_ms(TAP_CODE_DELAY);
865+
}
858866
#endif
859867
unregister_code(code);
860868
}

0 commit comments

Comments
 (0)