I still do not understand why that is waiting for a doubletap
Well, if pretending that its name is ifFollowedBy
instead helps, then please feel free to pretend so :).
The idea behind ifGesture is supporting discontinuous action sequences similar to for instance vimâs controls. There are control sequences like gg, gt and gT (or generally g+something), c+movement command, where the first key can be released before the next key is pressed, yet the sequence still has a special meaning.
ifGesture takes a string of key ids (hardware key identifiers). If I parametrize it with $thisKeyId
, it will wait for tap of the same key, i.e., effectively doubletap.
Does this explain it?
and what the ifDoubletap
command is used for then. Maybe the name is indeed contributing to the confusion of myself. A gesture is a (hand) movement and I do not understand what the name means here.
ifDoubletap
is historically much older than ifGesture
. There are many âdead keyâ actions on UHK, for which it is reasonable to want the keys to retain realtime execution, and for which the side effects of realtime execution have no negative consequences.
For instance:
holdLayer fn
ifDoubletap toggleLayer fn
holdKey iLS //act as a normal left shift
ifDoubletap tapKey capsLock //lock "shift" by doubletapping shift
which I also do not understand what gesture means in that context (pointer device use? if so, why is that also used for keys like in the doubletap example?)
Still not? A possibly discontinuous sequence of key taps that has a specific meaning. Just like a string of consecutive mouse movements, or whatever.
What would be the difference? Just possibly easier to read or is secondaryRole
something basically different?
The way I see it it is different semantics. The advanced secondary role contains pretty sophisticated logic that tries to distinguish intentional primary and secondary roles from normal typing. While some configurations are based on length of the hold, others rely more on exact key release order, or on consecutiveness of the taps. With some configurations, hold can on the contrary lead to a press of the primary key, not secondary.
On the other hand, ifHold
would be logically very straighforward: tell the user whether the key is being briefly tapped or held. Do not pressume anything about intended meaning or usecase.
ifGesture
, ifShortcut
, ifPrimary
and ifSecondary
are sophisticated implementation for specific usecase. ifHold
would be a simple basic block for tapdance like usecases.
Part of the point is that if you use secondary role for detection of simple hold⌠âŚthen you canât use it for any sophisticated secondary role resolution.