Open dropsonic opened 1 year ago
Supporting Tap Dance in Caps Word may be really complicated:
TD(n)
keycodes by default might not make sense as the default behavior.TD(n)
press and release goes through process_tap_dance()
individually, and it is impossible to determine the final tap dance action at that time, so the only option is to ignore TD(n)
keycodes completely if the corresponding tap dance has at least one action that could be used inside a word.tap_dance_task()
, so it does not go through the normal keycode processing at that time. (Another way to trigger the tap dance action is to press an unrelated key — in that case the tap dance handler will be called first, and then the handling for that unrelated key would be performed.)Probably the only way to implement the Tap Dance support would be:
caps_word_press_user()
which returns true
for the relevant TD(n)
keycodes (if some tap dances definitely can't be used in the middle of a word, those keycodes can be left out, so the Caps Word mode would be turned off immediately when such tap dance sequence is started)finished
handler for the tap dance so that it checks the Caps Word status and performs some actions accordingly. This might require effectively duplicating some Caps Word code, but there is no way around that, because the keycode handlers are not invoked for any register_code16()
/tap_code16()
calls that might be inside the tap dance implementation. Maybe it could be possible to refactor the Caps Word code to provide some reusable helpers for this use case.Wanted to +1 this issue, discovered why my caps word wasn't working due to this. Is there a fork with this in the works? I think I'll just turn off tap dance in the meantime for my alphanumeric keys, I wasn't using them often anyways.
Same, I've spent several hours trying to debug this problem this week, and finally found this issue.
Oh well I'm not alone here haha, spend hours trying to debug this problem this weekend hahaha. Hope someone can fix this soon <3 <3
Based on the suggestions in https://github.com/qmk/qmk_firmware/issues/19574#issuecomment-1381065727 I managed to get my layout to work the way I want, by returning true
from caps_word_press_user()
and manually handling the keycodes in the tapdance callbacks. The original code was generated by ZSA Oryx for a Voyager keyboard: https://github.com/thubble/qmk_firmware/commit/69e6e13d3bc2420bc7aaf2e892653927acca9e2f
It needed more manual modifications than I'd like, and it will need to be manually changed if I make changes to the layout, but it does seem to work properly so feel free to take a look if you need ideas on how to get around this issue.
Just stumbled on this issue as I use home row mods . Seems this will be an issue for anyone wanting to use home row mods. A fix to this would be very beneficial.
Fwiw on my moonlander (on macOS, have yet to check linux) it works fine for keys which only have a tap and a hold action. Adding tap-hold is where it breaks down.
On Linux it works as well if it is only a simple hold action. It stops working as soon as the hold action does more then one thing (e.g. ctrl+v, ctrl+c) as mentioned in the issue.
Yes to all of sigprof's comment on why Caps Word <> Tap Dance interoperation is complicated.
I suggest that where it's desired that Caps Word capitalize a Tap Dance key, that this is done through defining caps_word_press_user()
to
add_weak_mods(MOD_BIT(KC_LSFT))
to capitalize (if desired)as documented here. Then, if needed, the Tap Dance handler can conditionally act on the weak shift to know when to capitalize:
void my_dance_finished(tap_dance_state_t* state, void* user_data) {
if ((get_weak_mods() & MOD_MASK_SHIFT) != 0) {
clear_weak_mods(); // If necessary, clear the shift first.
// Produce capitalized output...
} else {
// Produce lower case output...
}
}
Or alternatively instead of weak shift mod, use the is_caps_word_on()
function within the Tap Dance handler to know when Caps Word is active:
void my_dance_finished(tap_dance_state_t* state, void* user_data) {
if (is_caps_word_on()) {
// Produce capitalized output...
} else {
// Produce lower case output...
}
}
Describe the Bug
Problem definition
When the Caps Word feature is enabled, pressing any Tap Dance keys:
Steps to reproduce
W
;W
on tap, andCtrl+W
on hold.owl
). When pressingW
, Caps Word would be disabled, andOwl
would be typed instead ofOWL
.I used the default Moonlander firmware with Caps Word mode enabled and
Ctrl+...
on hold to reproduce the issue.Why this might happen
Tap dance keys are defined as
TD(DANCE_n)
.TD(n)
is a macro:#define TD(n) (QK_TAP_DANCE | ((n)&0xFF))
process_caps_word
(caps_word_press_user
, in particular) checks only basic keycodes likeKC_A ... KC_Z
andKC_MINS
:So when
keycode
isQC_TAP_DANCE ... QC_TAP_DANCE_MAX
, nothing happens to the typed letter.Also, it seems that
QC_TAP_DANCE ... QC_TAP_DANCE_MAX
are not ignored inprocess_caps_word
: link to the codeTap dance code from the Moonlander firmware that I used:
Keyboard Used
Moonlander
Link to product page (if applicable)
No response
Operating System
Windows 10
qmk doctor Output
No response
Is AutoHotKey / Karabiner installed
Other keyboard-related software installed
No response
Additional Context
No response