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: one-shot timeout action #970

Open
oblitzitate opened this issue Apr 22, 2024 · 6 comments
Open

Feature request: one-shot timeout action #970

oblitzitate opened this issue Apr 22, 2024 · 6 comments
Labels
enhancement New feature or request gauging interest Looking for additional discussion and viewpoints

Comments

@oblitzitate
Copy link

oblitzitate commented Apr 22, 2024

Is your feature request related to a problem? Please describe.

When I tap a one-shot key, I want to be able to run an action like a cmd after timeout (if no further key has been pressed) so I can do things like a deadman's switch or notify that a modifier key has 'unstickied', etc.

Describe the solution you'd like.

It could look: (one-shot-press-timeout <timeout value> <one-shot action> <timeout action>)

Describe alternatives you've considered.

A workaround seems to be using virtual keys like so: (multi (on-release tap-vkey some-one-shot-vkey) (on-idle 1 tap-vkey some-cmd-vkey))

Additional context

If the above feature request is approved, maybe also allow a pre one-shot action so I could run a script immediately just before a one-shot action.

@oblitzitate oblitzitate added the enhancement New feature or request label Apr 22, 2024
@jtroo
Copy link
Owner

jtroo commented Apr 23, 2024

one-shot timeout action

Maybe this works: simulator. Here z takes the placeholder of cmd because cmd isn't allowed in the simulator.

allow a pre one-shot action

I think this is possible today: simulator. The mlft takes the place of the pre-action here.

I haven't fully dug into why but seems some indirection/delay is needed to avoid an early trigger of the one-shot release. It's a bit clunky but seems to work.

@jtroo
Copy link
Owner

jtroo commented Apr 23, 2024

Describe alternatives you've considered.

A workaround seems to be using virtual keys like so: (multi (on-release tap-vkey some-one-shot-vkey) (on-idle 1 tap-vkey some-cmd-vkey))

Out of curiousity does this actually work how you want it to? It would unconditionally execute some-cmd-vkey.

@jtroo
Copy link
Owner

jtroo commented Apr 23, 2024

Maybe this works: simulator

A weakness in this solution is that I don't think it works quite right if you double-tap the one-shot key. But maybe some extra logic in the switch can make it work how you would expect in that scenario.

@oblitzitate
Copy link
Author

Describe alternatives you've considered.
A workaround seems to be using virtual keys like so: (multi (on-release tap-vkey some-one-shot-vkey) (on-idle 1 tap-vkey some-cmd-vkey))

Out of curiousity does this actually work how you want it to? It would unconditionally execute some-cmd-vkey.

Not exactly, but I don't need it to be conditional for my current config right now.

Maybe this works: simulator. Here z takes the placeholder of cmd because cmd isn't allowed in the simulator.

Interesting idea! I should probably play around more with switch and input-history and what not.

@jtroo jtroo added the gauging interest Looking for additional discussion and viewpoints label Apr 24, 2024
@oblitzitate
Copy link
Author

In switch, I felt key-timing worked better than input-history, at least for my use case.

Anyways, thanks to your solutions, I can run a pre-one-shot action and post-one-shot timeout action, which is great.

However, is there a good solution to run a post-one-shot action after a follow up key has been pressed (without having to modify each key in the one-shot's layer-while-held)?

@jtroo
Copy link
Owner

jtroo commented Apr 29, 2024

Debateable if it's a "good" solution, but with some hackery with tap-hold-press-timeout, it can work: sample

I used switch as a weird-looking multi using fallthrough because it behaves slightly differently; the actions activate one tick apart.

The tap-hold-press-timeout's hold activation interrupts the one-shot action, so the hold action needs to persist the one-shot action itself, for a little while longer while b activates, and then the hold action releases itself earlier than the deadmanswitch releases it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gauging interest Looking for additional discussion and viewpoints
Projects
None yet
Development

No branches or pull requests

2 participants