crossterm icon indicating copy to clipboard operation
crossterm copied to clipboard

Capture additional keys (Media keys, caps lock, etc.)

Open SammyWhamy opened this issue 2 months ago • 0 comments

Is your feature request related to a problem? Please describe. I would like to be able to control a media player in the terminal using my hardware media keys, but these are not captured by crossterm.

Describe the solution you'd like I'd like the read/poll functions to also report keys such as the hardware multimedia keys, along with keys like num lock, caps lock, etc. It would also be nice if keys like shift and ctrl could be reported separately, instead of only as modifiers.

Additional context Windows 11, cmd/powershell, Windows Terminal I have played around a bit with the crossterm_winapi crate, and I was able to fairly easy get readings for these keys. Using the following

let handle = crossterm_winapi::Handle::current_in_handle()?;
let console = crossterm_winapi::Console::from(handle);
let key = console.read_single_input_event()?;

Seeing as how easy this was to do, I feel like i might be overlooking something in crossterm, but I can't find any way to get readings for these keys.

SammyWhamy avatar May 25 '24 13:05 SammyWhamy