keyboard-types icon indicating copy to clipboard operation
keyboard-types copied to clipboard

Ensure `Code` can represent the USB standard

Open madsmtm opened this issue 11 months ago • 2 comments

keyboard-types is based on the W3C specification, but dependencies use it in a desktop context too, and thus we extend Code with extra variants to allow for these use-cases too (currently the Chromium key codes).

Another place where it could make sense to extend support for would be the USB usage page standard. The spec is available here, see specifically the Keyboard/Keypad Page 0x07 and the Consumer Page 0x0C.

This would allow representing all the scancode events that the SDL emits.

madsmtm avatar Feb 13 '25 21:02 madsmtm

Genuine question, which codes are missing from the W3C specification? My understanding is that the authors tried to collect all keycodes in common usage and the USB standard would be a fairly obvious place to look.

If we add additional codes we should try to upstream them to W3C.

pyfisch avatar Mar 09 '25 11:03 pyfisch

I seemed to recall there being a scancode or two from SDL that I didn't know how to map, but I've forgotten now (EDIT: See https://github.com/pyfisch/keyboard-types/issues/63). Let's leave this open for for me to actually finish keyboard-types interop with the sdl2/sdl3 crate (and if I haven't done so in let's say a few weeks, I'd be fine with closing this).

madsmtm avatar Mar 09 '25 14:03 madsmtm