Feature request: hold-for-duration <key|layer> <time>
#1306
Labels
enhancement
New feature or request
hold-for-duration <key|layer> <time>
#1306
Is your feature request related to a problem? Please describe.
There is a specific class of shortcuts that is difficult to implement using a single key in Kanata: those where holding
Mod
and pressingKey
enters a state that accepts additional input, and releasingMod
releases that state and accepts a selection. The most obvious examples of these are A-tab and M-1, M-2 (etc.) in Windows, M-tab in Mac OS, M-tab in Cosmic DE and others, etc.To implement this on a single key, tapping the key should: 1) begin holding the modifier for the duration, 2) tap the key, 3) release the modifier after a duration. Continued taps should reset the duration.
Describe the solution you'd like.
A new action called something like
hold-for-duration
that takes a key or layer and a duration would immensely simplify this use case. Any repeats of this action for the same key/layer should reset the duration again. Being able to also specify a held layer would make putting these types of shortcuts into a one-shot-layer just as straight-forward as on a sticky/base layer.I don't find myself with the imagination right now to come up with a lot of other examples where this could be useful, but it seems like at least this specific example is a common use case. It could potentially short-circuit other complex configurations involving timers, such as timing out a "some-shots layer" independent of key-presses. An additional variant of simply
hold
(without a timer) paired withrelease-key
andrelease-layer
could also help people stay out of the virtual-key weeds longer than they otherwise would've been able to.Describe alternatives you've considered.
It was bit of a ride, but with a lot of help I was finally able to implement this (#1303). However, the resulting configuration is (at least from my perspective) overly complex, and it took a good while to feel like I understood it. Even now, I'm not 100% confident I could make changes without breaking it again.
The key on the base layer would become one line:
m1 (macro (hold-for-duration lmet 800) 5 @1)
The key inside the one-shot layer would become
om1 (macro (hold-for-duration lmet 800) (hold-for-duration one-shot-layer 800) 5 @2
with no other virtual keys/macros/macro-release-cancel actions to set up. As it's been proven that it's possible to implement this (as complex/fragile as it might feel to this newbie), putting it further down the list would seem perfectly reasonable. Just want it out there in case it seems like low-hanging fruit; I wouldn't be able to tell.Additional context
Kmonad implements held keys on a timeout via
sticky-key
and held layers on a timeout vialayer-delay
.Discussions where this feature would've been an almost obvious solution: #502, #581, #494, #1014, #1164, and now #1303. #1014 does have a good point brought up Gerhard, and if this action can only be implemented for virtual keys and layers I still feel like it would be a nice usability upgrade.
The text was updated successfully, but these errors were encountered: