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

Support key release events #695

Closed
jjant opened this issue Jul 30, 2022 · 3 comments · Fixed by #745
Closed

Support key release events #695

jjant opened this issue Jul 30, 2022 · 3 comments · Fixed by #745

Comments

@jjant
Copy link

jjant commented Jul 30, 2022

Is your feature request related to a problem? Please describe.
I'm making a piano-like UI and I need to detect key up events to know when to stop playing the note for that key.

Describe the solution you'd like
An additional field in KeyEvent for Press/Release.

Additional context
Just FYI, termion doesn't seem to provide this either.

@sigmaSd
Copy link
Contributor

sigmaSd commented Jul 30, 2022

It is is possible in master(not released) yet using the kitty protocol.
See https://github.com/crossterm-rs/crossterm/blob/master/src/event.rs#L357 it also contains the list of supported terminals.

To use it just add:

    execute!(stdout, PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::REPORT_EVENT_TYPES))?;

and run it in a supported terminal.

@David-Else
Copy link

This feature was release in 0.25, the issue can be closed.

@TimonPost
Copy link
Member

Its partially possible for those that have a kitty terminal

@TimonPost TimonPost changed the title Listen to key up events? Support key up events Jan 11, 2023
@TimonPost TimonPost changed the title Support key up events Support key release events Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants