crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Listen to key up events?

Open jjant opened this issue 2 years ago • 1 comments

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.

jjant avatar Jul 30 '22 09:07 jjant

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.

sigmaSd avatar Jul 30 '22 11:07 sigmaSd

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

David-Else avatar Oct 19 '22 19:10 David-Else

Its partially possible for those that have a kitty terminal

TimonPost avatar Jan 11 '23 20:01 TimonPost