Skip to content
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

Feature request: hold-for-duration <key|layer> <time> #1306

Open
brandonbeaumia opened this issue Oct 26, 2024 · 0 comments
Open

Feature request: hold-for-duration <key|layer> <time> #1306

brandonbeaumia opened this issue Oct 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@brandonbeaumia
Copy link
Contributor

brandonbeaumia commented Oct 26, 2024

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 pressing Key enters a state that accepts additional input, and releasing Mod 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 with release-key and release-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 via layer-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.

@brandonbeaumia brandonbeaumia added the enhancement New feature or request label Oct 26, 2024
@brandonbeaumia brandonbeaumia changed the title Feature request: hold-for-duration <mod|layer> 800 Feature request: hold-for-duration <mod|layer> <time> Oct 26, 2024
@brandonbeaumia brandonbeaumia changed the title Feature request: hold-for-duration <mod|layer> <time> Feature request: hold-for-duration <key|layer> <time> Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant