允许双击键按钮在不放开按住的情况下输出唯一的键盘组合
作者: eugenesvk创建于 2023年3月19日更新于 2026年9月16日
I'd like to do the following remapping:
- (single tap) ; to
;but only after a delay (to allow for a double tap/hold to have a different functionality), so this setstap︔variable to 1 - (single tap+X) ;x(any key≠;) to
;x(no change in behavior here), this resetstap︔back to 0 - (double tap) ;; to
:(replace semicolon with colon on double tap), this works by making ; withtap︔=1condition output ⇧; and resettap︔back to 0 - (hold) ; to enter a new mode via setting
hold︔variable to 1 (and resetting it back to 0 on release) And it seems to me that it's currently impossible since same-key tap is treated ascancelledand same-key hold is reated asinvoked, so there is no place for me to put;output that would not break either double tap (and output:;instead of:) or hold (and output;on hold) I'm using the following complex-modifications features
to_if_held_downsetshold︔to 1to_after_key_upresets thehold︔back to 0, works fineto_if_alonesetsvarSemicolonTapvariable to 1 (or regulartowoks)to_delayed_actionis where the main issue is, I need it to resetvarSemicolonTapback to 0 after some delay, but also print the actual;to_if_canceledthis helps with rule 2 as any x≠; in treated as cancellation, so if I output;here it's inserted beforexjust fine. However it's also triggered when I tap ; again, and this is the buggy part. I don'tto_if_invokedworks fine with printing;after a delay but then holding the key is also treated as key being invoked, so on hold I get an extra;I don't need Not sure what the best resolution is but maybe Eitherto_if_canceledcould be optionally split into 2 conditions:
to_if_canceled_by_selfto_if_canceled_by_other
Or to_if_invoked could be optionally split into 2 conditions:
to_if_invoked_unless_holdto_if_invoked_hold
Then I could skip printing ; on double tap in the cancelled clause, only reserving it for ;x
Or I could print ; only at the to_if_invoked_unless_hold call while my hold will work by just changing the variables, but not printing anything
内容来源: pqrs-org/Karabiner-Elements