How can I add a long press to a letter key such it triggers the shortcut after the threshold but triggers the letter key if released sooner ?
Ok , setting two triggers with maximum on key up and minimum on key down works. However cause a lag while typing if the letter passed on keyup. If there was an if_else on the minimum keydown then it would have been as intended .
Unfortunately there is a disadvantage if using just one letter. The letter is typed at "up". Depending on how fast you write, this letter will be typed later than the following one which is typed at "down".
Yes that is what I realised.
If the BTT had an option to trigger the key as normal if :
- the key was released before the hold duration
- and the hold timer was cancelled if another key was pressed while the timer was on
then this could work.
I think it can be a good feature. It will open a lot more shortcuts.
By "as normal" you mean key down. I'm not sure if short and long pressed work both with "down". BTT can not see the future, but I don't understand enough about it. Andreas sees it all and gets back to us when he has time, or not
I'm working to improve the one letter key long press. It will never be perfect, but it can be better than it currently is. My current work goes in a similar direction as the suggestions made by @druboi, but it's complicated
Ah, would both actions be triggered on "pressed"?
My current idea is
When the key (example: a) is pressed BTT blocks the original macOS key event - so nothing happens initially. Internally BTT now starts a "timer" that waits for the configured long press time.
Now there are three scenarios:
1.) The user releases the key before the long press treshold has been reached AND no other key has been pressed since. In that case BTT will just send the key event (e.g. the key a) to the system. All good.
2.) The user presses another key (example b) while the timer is running. In that case BTT will also block the second key press, cancel the timer and then send the key events to the system in their correct order (first a, then b)
3.) The user keeps the key pressed until the long press treshold has been reached: Execute the long press action.
Ok, that sounds logical. So however, the problem could arise when after b the next letter c is pressed. Either there is a significant delay in writing, but the order of the characters is correct. Or c pushes itself between a and b.
But you're the boss and you know best. One thing is for sure: If you can manage it, BTT is the only app that can do it. Not even KM can
it would just be put on the queue and BTT would block the c before the ab has been sent to the system. Yes - this can cause a little delay. But in my tests it's pretty much not noticable. (But that's what I meant by "never be perfect")
Then I am very excited to test your solution. Especially when the queue gets longer and longer because ten letters in a row are assigned with short/long press actions. We will see. Anyway your idea is really good!
The number of keys in a row that have long press actions is not that important because problems only arise if multiple keys are down at the same time. Usually only few will be down at the same time
Let's see
@Andreas_Hegenberg , @Frank1 , Hope it works ! It'll be awesome to have.
Currently I have the long press enabled with the | (pipe) key.
- One trigger with
execute_on_key_down
+min_hold_duration
=> Desired Shortcut - Another with
execute_on_key_up
=> Types the normal key letter ( | in this case).
It works fine for me because I don't use pipe | a lot during rapid typing. If this works with all keys without a need for a hack then it'll be so awesome !
One issue I realised with execute_on_key_up
is that sometimes if I press Shift + |
with a little delay between the modifier key and the letter , then the execute_on_key_up
is triggered. BTT does't consider that a modifier was recently pressed.
BTT is awesome !