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
Permissive Hold with Custom Tap Dance Functions[Feature Request] #9158
Comments
Closed and reopened accidentally. |
I am interested in similar functionality as well. The closest I have gotten so far is this: int current_dance(qk_tap_dance_state_t *state) {
int current_state = 0;
bool is_new_dance = QK_TAP_DANCE <= state->interrupting_keycode && state->interrupting_keycode <= QK_TAP_DANCE_MAX;
if (state->count == 1) {
if (state->pressed && !is_new_dance) {
current_state = SINGLE_HOLD;
} else {
current_state = SINGLE_TAP;
} I handle the |
So you apparently need exactly the Unfortunately, I think that achieving this behavior is not possible using the tap dance code, or even using a completely custom keycode handled in
The code which handles In theory you could try to perform the same kind of queuing in your Alternatively, you can try to hijack the builtin tap/hold detection code for your own use. Choose a layer number which is not actually used in your keymap (let's call it #define U_C_12 LT(_DUAL_ROLE_FAKE_LAYER, 0) Then configure case U_C_12:
if (record->event.pressed) {
if (record->tap.count > 0 {
layer_on(12);
} else {
register_mods(MOD_BIT(KC_LCTRL));
}
} else {
if (record->tap.count > 0 {
// do nothing for the layer switch on tap
} else {
unregister_mods(MOD_BIT(KC_LCTRL));
}
}
return false; // important: do not perform the standard LT action Note that the builtin tap/hold detector does not support multi-tap actions in the manner the tap dance code does — This method of hijacking the |
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs. |
This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know. |
Feature Request Type
Description
This might be a question of how to use the firmware, as opposed to changing the firmware, but here it goes: I have used some of the documentation to write custom tap dance functions that treat non-basic keycodes (TO layer switches) with modifiers like MT keys. In other words, I needed to write some custom functions to have keys that applied modifiers to some TO layer switches like dual function keys. My functions work, but I would like to see the permissive hold functionality for the "custom" MT keys.
Detailed explanation: the specific use case that caused me to notice the issue was control-clicking. I use mouse keys, and my control modifier on my mouse layer happens to be one of these "custom" MT keys with a layer switch. Currently I have to hold the "custom" MT down for the TAPPING_TERM and then click the mouse click key to get a control-click. If it were a regular MT and I enabled permissive hold, I could (all within the TAPPING_TERM) simply: press the "custom" MT, press and release the mouse click, and release the "custom" MT.
Here is the code for the custom functions that is relevant:
and:
Now here's the twist: I can partly achieve the functionality that I want by removing
from the if statement in the first function. When I do this, I can get the quick control-click. Unfortunately, it does not mirror the permissive hold functionality exactly. If I "interrupt" the tap dance with another key (for example, the next key I intended to click after a layer switch tap,) the "custom" MT still outputs a modifier. In this case: I depress the custom key, depress the next key, release the custom key, and the release the next key. If it functioned like "permissively-held" keys, this would simply send the two tap keys (a layer switch and the key on the switched layer) instead of modifying the key on the un-switched layer.
I am mostly looking for tips regarding how to approach this, even if it's just the files in which the functionality takes place, as I am hoping to be able to contribute this feature on my own. I am a student with some knowledge of C, and this is something I would like to work on. I just need a little help being pointed in the right direction. I'm working through process_tap_dance.c, but it's slow going!
Sorry if my wording is confusing. Putting these issues into words can be difficult sometimes!
The text was updated successfully, but these errors were encountered: