-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Implement ZMK's require-prior-idle-ms
in QMK
#24262
Comments
It is a non-trivial request to implement this into QMK's core action tapping code. But you can easily do so in your user keymap code using the // Decision macro for mod-tap keys to override
#define IS_HOMEROW_MOD_TAP(kc) ( \
IS_QK_MOD_TAP(kc) && \
QK_MOD_TAP_GET_TAP_KEYCODE(kc) >= KC_A && \
QK_MOD_TAP_GET_TAP_KEYCODE(kc) <= KC_Z )
// Decision macro for preceding trigger key and typing interval
#define IS_TYPING(k) ( \
((uint8_t)(k) <= KC_Z || (uint8_t)(k) == KC_SPC) && \
(last_input_activity_elapsed() < QUICK_TAP_TERM) )
bool pre_process_record_user(uint16_t keycode, keyrecord_t *record) {
static bool is_pressed[UINT8_MAX];
static uint16_t prev_keycode;
const uint16_t tap_keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
if (record->event.pressed) {
// Press the tap keycode if the tap-hold key follows the previous key swiftly
if (IS_HOMEROW_MOD_TAP(keycode) && IS_TYPING(prev_keycode)) {
is_pressed[tap_keycode] = true;
record->keycode = tap_keycode;
}
// Cache the keycode for subsequent tap decision
prev_keycode = keycode;
}
// Release the tap keycode if pressed
else if (is_pressed[tap_keycode]) {
is_pressed[tap_keycode] = false;
record->keycode = tap_keycode;
}
return true;
} The preprocessor macros can be adjusted to your preference. Unlike ZMK, you can choose the preceding keycode that will trigger the feature. It uses the |
First, thanks a lot for the code. I tested it and it works for home row mods. However, I also like to use my spacebar as a mod-tap key. This is how I set up my mod-taps:
I changed the #define IS_HOMEROW_MOD_TAP(kc) ( \
IS_QK_MOD_TAP(kc) && \
((QK_MOD_TAP_GET_TAP_KEYCODE(kc) >= KC_A && \
QK_MOD_TAP_GET_TAP_KEYCODE(kc) <= KC_Z) || \
QK_MOD_TAP_GET_TAP_KEYCODE(kc) == KC_SPC)) This makes it so that I attached a video. I used keyd to monitor my keystrokes. Notice how there's a delay when typing the space right before the word untitled.mp4Edit: I forgot to mention that my |
I just realized that the reason I was experiencing that issue was because I also had a key-remapping daemon running which does the same thing. I was using it as a temporary solution for this problem and forgot to turn it off when I re-flashed my firmware. I'll still keep this issue open because I'd like to see this get implemented as a core QMK feature. |
Feature Request Type
Description
ZMK has the configuration option require-prior-idle-ms for tap-hold keys. It effectively makes all tap-hold keys resolve as tapped when typing quickly. Aside from decreasing the possibility of accidentally triggering modifiers, it has the added benefit of eliminating the delay when typing quickly.
I did find a pull request on Manna Harbour's fork of the QMK firmware, but it's from two years ago and I can't merge it into my clone of this repository without a lot of merge conflicts. There's also the achordion userspace library, but it can't get rid of the delay; it can only prevent modifiers from being triggered.
The text was updated successfully, but these errors were encountered: