3 ms·
I suppose the problem is that sometimes you want keyboard shortcuts to be non-arbitrary keys. If you're on dvorak, you wouldn't want WASD to be your movement k
by jrockway 3y ago
I suppose the problem is that sometimes you want keyboard shortcuts to be non-arbitrary keys. If you're on dvorak, you wouldn't want WASD to be your movement keys in an FPS. They are nowhere near each other. So applications need some sort of API to figure out what keyboard layout is in use, so they can setup the appropriate bindings. (The OS tells them which letter was pressed, not which (row, col) on the keyboard was pressed. But in this case, you kind of want that raw key matrix event.)
This is basically impossible, because the key matrix -> letter translation can be done in multiple places (in the keyboard firmware, in the OS, etc.). Hilariously, sometimes your keyboard firmware has to be aware of the OS translation; you cannot send a & keypress event over USB, so you have to send "shift + 7" if you want a key that generates that input. Because of all this, application developers have to add a "key binding preferences" page to their application. There is absolutely no way they can target a certain physical location on your keyboard.
None of this is specific to Javascript, of course. This is all about protocols and the OS.
- zokier 3y ago> This is basically impossible, because the key matrix -> letter translation can be done in multiple places (in the keyboard firmware, in the OS, etc.). Hilariously, sometimes your keyboard firmware has to be aware of the OS translation; you cannot send a & keypress event over USB, so you have to send "shift + 7" if you want a key that generates that input As someone who just is getting into custom keyboards, this is one really ugly wart in the whole stack. imho ideally keyboard would just send individual scancodes and the host would manage all the key layout stuff. But making fully custom layouts complete with custom modifiers is afaik pretty much impossible with Windows/Mac/mobiles, and even on Linux its bit of a pain. So it ends up easier for keyboard to pretend to be a standard keyboard and have macros to send complex scancode sequences and then just have standard US qwerty layout on host side. Which kinda works until you want to input stuff that is not on the standard US layout at which point you need some different layout on the host, and then you need to remap the keyboard so that it is in sync with the layout. And then you need to sync these configurations across different computers and operating systems. Sometimes standardization is great, but sometimes it hides all sorts of pitfalls that you'll stumble upon once you actually want to step outside the standard solutions.
- pieterbreed 3y agoAs a dvorak typist HJKL as a concept is dead to me.
- jrockway 3y agoI feel like it should have been jkl; anyway.