How many single key modifier/combination possible?

Just using one key, how many assignments are currently possible with the UHK? I’m not talking about modifier keys or chords. Based on the documentation and through browsing the forums, I have gathered that there are only the following 3:

  • single tap

  • double tap

  • hold

From another post, I read that ‘double tap and hold’ is not possible. Are there any other single key combinations that I am missing?

I am triet utilizing the ifShift and ifNotShift and can’t get it working. Here is the script I am using

ifShift final tapKeySeq ( )
ifNotShift ifSecondary final tapKeySeq S-9 S-0 leftArrow
ifNotShift ifGesture timeoutIn 300 $thisKeyId final tapKey S-0
ifNotShift final tapKey S-9

but it works without the Shift modifier

Tripletap. Quadrupletap. Quintupletap…

but it works without the Shift modifier

What exactly does it do and what do you expect it to do?

single tap key for (

double tap for )

hold down for () and move cursor inside

shift tap for standard () with cursor remaining outside

it does the hold shortcut, so () with cursor moved inside

Well, you understand that secondary role is not originally intended to facilitate hold behavior, and that you need to configure it in order to use it that way in the Typing behavior tab, right?

1 Like

Take a look at this macro, which puts different messages on the display depending on how you activate the key that it’s bound to:

setLedTxt 0 'KEY'
ifGesture timeoutIn 200 $thisKeyId final setLedTxt 999 'GST'
ifDoubletap final setLedTxt 999 'DBL'
delayUntilReleaseMax 500
ifInterrupted final setLedTxt 999 '2ND'
ifPlaytime 450 final setLedTxt 999 'HLD'
setLedTxt 999 'TAP'

Fast double-tapping (within 200 ms) = GST (gesture)
Slower double-tapping (depends on the doubletap time configured) = DBL (double)
Holding it and pressing a second key while the key is held down = 2ND (secondary function)
Holding (for more than 450 ms) = HLD (hold)
Single tap = TAP (tap)

Note that the slow double-tap results in a TAP on the first tap followed by DBL on the second tap.

That should give you enough ideas how to program your behaviour. Just replace the setLedTxt commands by whatever you want to do in each case.

3 Likes

Ah, okay. That makes sense, then. I’m currently using this script for triple function keys

ifSecondary final tapKeySeq ( ) leftArrow
ifGesture timeoutIn 300 $thisKeyId final tapKey )
final tapKey (

because the script I tried to create myself but whatever I had tried didn’t work for some reason. It would trigger multiple keys, and I never figured out how to resolve it. I found this script from an old post and it has been working flawlessly, except for the issue we’re discussing.

Should I use the ifHold condition? I see that it was implemented 3 months ago if the reference manual, but when I try to use it in Agent, I get an unrecognized error.

Great! Thanks. This is great. It gives me a much clearer understanding of how these functions. I had avoided chording for some reason, but now after trying the 2ND mod, I might use that.

Generally, yes it is advisable. ifHold has been implemented, but not released.

Here is a dev build if you want to try it: uhk-firmware-11.1.0-e9cedccf.tar.gz

1 Like

Can you please provide the script for this?

I’ve tried

ifGesture timeoutIn 300 $thisKeyId ifGesture timeoutIn 300 $thisKeyId final tapKey !

and

ifGesture timeoutIn 300 $thisKeyId timeoutIn 300 $thisKeyId final tapKey !

None seem to work.

ifGesture  timeoutIn 300 $thisKeyId $thisKeyId final tapKey !

(Also, I suspect you will need to increase the 300.)

1 Like

How would this work if I wanted to detect all kinds of multiple taps?

ifGesture timeoutIn 300 $thisKeyId $thisKeyId $thisKeyId final tapKey 4
ifGesture timeoutIn 300 $thisKeyId $thisKeyId final tapKey 3
ifGesture timeoutIn 300 $thisKeyId final tapKey 2
tapKey 1

In this order or the other way round? Will I have to wait for 900 ms if I just wanted the single tap?

I was tempted to use a local variable to count the number of calls to the macro within ifDoubleTap and then react based on the counter.

In this order.

I am not sure since when the 300ms is counted - assuming its from start of executing of the command, then something like:

ifGesture timeoutIn 300 $thisKeyId $thisKeyId $thisKeyId final tapKey 4
ifGesture timeoutIn 10 $thisKeyId $thisKeyId final tapKey 3
ifGesture timeoutIn 10 $thisKeyId final tapKey 2
tapKey 1

should do the trick.

I was tempted to use a local variable to count the number of calls to the macro within ifDoubleTap and then react based on the counter.

You are welcome to, but I would prefer if you didn’t share the code here. You know, to not give ideas to people…