executing action if a key is released with modifier held or key is held for period of time
I am trying to implement homerow mods and for the most part I have it working. What I would like to do is have similar functionality to overloadt2() but that an action is done either when the key that is pressed after the modifier key is released or that same key is held for a certain period of time. I am trying to remap f as control and jkl; as arrow keys and have it so when f is held for under 200ms until one of jkl; is held for around 200ms that it sends that arrow key repeatedly.
This is what I am currently using:
f = overloadt2(control,f,200)
Right now when I hold the f key for less than the timeout and press one of these keys it will only send one arrow key when that key is released and will not repeat that key when it is held past key repeat time. Let me know if there is a way to do this that I overlooked. I am not sure if there is a way to implement this by using various actions together in some way.
Do you have a minimum working example config? Is your intention that jkl; are arrow keys in the main layer, or only in the control layer? When you say 'f is held for under 200ms', do you mean that it is still held, just for for a timespan <200ms, or that it has been released already? When you say 'sends that arrow key repeatedly', do you mean as in macro2 (ie the same down/up events are emitted multiple times) or just that it is held down (without an up event) such that your display server can handle key repeats?
Example Configuration
[ids]
*
[main]
f = overloadt2(control, f, 200)
[control]
j = left
k = down
l = up
; = right
Current Behavior
- Press
f. - Before 200 milliseconds elapse, press
l. - The daemon waits for
lto be released, then issues theupaction.
Desired Behavior
Add a long-hold trigger (beyond the release trigger) when the second key (here, l) is held past 200 ms (or any specified threshold):
- If
lremains pressed longer than the threshold, begin repeatedly sending theupaction (as if the arrow key itself were held down). - Continue repeating until
l(or all keys) are released.
In other words, give overloadt2 another condition (“on long hold”) in addition to “on release.” This could support other actions too.
Note: My use case needs a clean way to stop the repeat events when the key is released, which may be the trickiest part to implement.