crossterm
crossterm copied to clipboard
Listen to key up events?
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.
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.
This feature was release in 0.25, the issue can be closed.
Its partially possible for those that have a kitty terminal