Having a 'double tap' configured but disabled causes 'single tap' shortcuts to be delayed

Describe the bug
When I have just a 'three finger tap' shortcut configured, it executes basically instantly.

I just created a 'three dinger double-tap' shortcut as a test, and it causes the 'three finger tap' shortcut to delay execution (which makes sense, since it will need to wait to determine if it was a single or double tap)

If I add a modifier key so that the double-tap shortcut only runs when I'm holding eg. Shift, the single-tap shortcut still runs slowly, even when I'm not holding the modifier key. I would have expected it to know that it doesn't need to wait to determine if it's a double-tap since the modifier key wasn't being held.

Similarly, if I disable the double-tap shortcut all-together, the single-tap shortcut still runs slowly; even though there is no need for it to wait and see if there was a double-tap before executing.

If I delete the double-tap shortcut, the single-tap shortcut runs quickly again.

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Magic Trackpad / N/A

Screenshots
If applicable, add screenshots to help explain your problem. (You can just paste or drag them here)

Device information:

  • Type of Mac: MacBook Pro 16-inch, 2019
  • macOS version: Ventura 13.1 (22C65)
  • BetterTouchTool version: Version 3.952 (2117)

Additional information (e.g. StackTraces, related issues, screenshots, workarounds, etc.):

N/A

That's expected and probably all double tap implementations have this issue. The problem is, to know whether the single tap gesture can be executed - BTT needs to wait until the double-tap timeout has passed. Otherwise a double tap would always also execute a single tap. It's the same for macOS when you use tap to click. You can change the double tap delay here:

@Andreas_Hegenberg I understand that that's how it needs to work WHEN the double-tap is likely to happen; but as I explicitly mentioned in my original detailed explanation, there are cases where the double-tap will NEVER be possible, and thus there should be no delay:

  • if I have a modifier key configured on the double-tap, that isn't configured on the single-tap, there should be no delay :bug:
  • if the double-tap is disabled, there should be no delay :bug:

These are the cases that I consider to be the bugs.

Reducing the delay required in the settings is an ok'ish workaround in the meantime; but it still makes me not want to configure double-taps due to the delay it requires.

The disabled case I have fixed recently (it's only in a not yet released development build btt3.9994-2195.zip (folivora.ai))

Unfortunately I most likely won't be able to fix the modifier case, as BTT doesn't evaluate the trigger availabilities dynamically. It could also lead to weird behavior when eg. releasing the modifier key before the timeout has ended. It could be done, but I don't think it's feasible right now.

If you really want this you could use the "run real java script" action and implement specific logic for this use case. It would require my latest development build, but it could be achieved with a few lines of code there.

1 Like

Glad to hear that the disabled case is fixed in the new development build! :tada:

Totally understand that the modifier case would be too hard to fix given the architecture/implementation.

What aspects of the new development build would be required to implement it using 'run real javascript' out of curiosity? And do you have a high level thought of how it could work with that? (even just pseudocode/the relevant function calls/variables/etc would be sufficient for me to get an idea of how to approach it)

The development build allows you to query the currently pressed keys and has new functionality to delay the execution of named triggers / cancel the execution within the delay time.

You could do something like this (not functional, but to show the principle):

let currentKeyboardKeys = await callBTT('get_string_variable', {variableName: 'currently_pressed_keyboard_keys'});

if(currentKeyboardKeys.contains(55) /* 55 = cmd*/) {
callBTT('trigger_named_async_without_response', {variableName: 'single-tap-named-trigger'});
} else {
let lastTapTime = await callBTT('get_number_variable', {variableName: 'last_tap_time'});

callBTT('trigger_named_async_without_response', {trigger_name: 'single-tap-named-trigger', 'delay': 300});


if(Date.now -  lastTapTime < 300 /*ms*/) {
callBTT('cancel_delayed_named_trigger_execution',  {trigger_name: 'single-tap-named-trigger' }) 
else {
callBTT('trigger_named_async_without_response', {trigger_name: 'single-tap-named-trigger'});

}

}

await callBTT('set_number_variable', {variableName: 'last_tap_time', to: Date.now()});
}

1 Like

Awesome, thanks for that! Will check it out/play with it more once that new build is out :slight_smile:

For my future knowledge, is that making use of this feature?

No, this is something different. The "run real java script" action is already there and can be assigned to any trigger. However while developing the generic device support feature I extended & improved it a bit.

Using Java Script (not JXA) ยท GitBook (folivora.ai)

1 Like

Cool, makes sense. Shall have a bit of a deeper read into it. Thanks :slight_smile: