-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to engage hold behaviour immediately #10
base: master
Are you sure you want to change the base?
Conversation
Hi, many thanks for your contribution. |
Had a look at #9. seems like it is solving a slightly different problem. That one aims to immediately trigger an arbitrary non-hold action on key down. This PR aims to provide the option (via setting the hold time to 0) to engage the hold behaviour immediately. |
- Replace remaining reference to holdActive - Fix quickhold to no longer assume the button has been held when a double-tap occurs, which breaches tapTime
After trying to use this in a new way, I noticed that double-taps don't cause the state to be set to TAP, because FullHold was taking too much priority. It now checks the internal state so as to disengage itself if appropriate, making way for double taps to come through and set the state to tap mode |
Immediately setting the soft shift mode would mean that if you type fast and release your shift-on-hold key after the next one has been pressed, instead of getting two lowercased letters you get one capitalized f↓j↓f↑j↑ should be I've tried to tackle it recently in this modtap branch where I track the down/up key sequences and decide whether to engage a 'soft hold' or not based on the following sequence of key events Do you think it'd be a workable approach for this otherwise great library so that we could finally get proper tap vs hold behavior without timing compromises? |
I'm sorry, I still do not understand the intent. |
The sample script as well as a more detailed description of the approach is the linked branch above, e.g., here is the script (and it's launcher script) The use case is having home row modifiers without affecting your regular typing, e.g., having f act as ⇧ on hold, but type letter Reducing the hold timer to 0 would solve that issue, but would also break fast typing as in the example above where j is pressed before f is released |
A glance at the sample script certainly helps, I think I understand the use-case now. But just off the top of my head... If this is the case, then why not just have some mechanism for any given key (eg u) to tie it in some way to the modifier key?
|
(btw, I've updated the script and now it shows debug status symbol
As far as I understood, THM only deals with timings, so I didn't look further, so I don't know how to use THM for the same purpose. Hence my original comment - I was thinking that the folks much more knowledgeable about THM could see if THM could incorporate this approach
Only in the simplest case: you press and hold a key longer than, say, 1 second, then it's obvious that it's a modifier.
No, typing
In this description I don't see the key up even, which is crucial for differentiating Also, you need to handle |
by the way, you'd need to declare the whole keyboard layout this way since modifier would affect all keys (though maybe that's not a big deal if THM can declare something like a |
Maybe I am getting confused here, but what I was asking for was a sample script that utilizes the code in this PR, so that I can clearly see intent and results, and evaluate whether I feel that it's the best solution to the problem |
First of all thanks for the repo! Looks sturdy and well written, a lot better than my personal attempts at this kind of behaviour in AHK! So I can only apologise for how much I've strayed away from the code style here, but I thought it would be a useful feature for other people.
Problem
When you set up hold and tap behaviours for a key, and let's say your hold behaviour is to hold down the shift key. You want to be able to immediately press the button and get the shift behaviour, but you can't, because you have to wait out the timers.
Setting the hold time to 0 means the key is always in hold behaviour, so you never get the tap behaviour.
Solution
Set the hold time to 0, but now this engages "soft hold"- The state sent to the callback function is that the key is in hold mode. However, internally there is now a "full hold" mode, which is only activated once the tap time has also been breached.
If you've made it to "full hold" state, and you release the key, you won't get a tap, but if you release before the full hold mode kicks in, you will.
All this time, hold mode has been active, so your attached functionality for hold mode has been available the whole time.
Side notes
Now, obviously you won't always want this, if for e.g. you send a letter or symbol on hold, you don't want this to appear immediately, you want it to appear after the hold time, in which case you set your hold time >= tap time, and then you get existing behaviour.