Closed kerthale closed 3 years ago
Hi, thanks for your PR. Two comments:
What is your use case for this layout? Are you building a homebrew Dvorak keyboard? Are you telling the host computer that your keyboard is Dvorak? In that case it will do the remapping. In general I would not recommend using a KeyboardLayout
to send keypresses, because you don't have the fine control you need for modifier keys, etc. Instead send the Keycodes directly.
The adafruit_hid
library is already large, and we've decided not to add further keyboard layouts to it. See #46, #54, #60, #61. A new layout could be added as a new library, and #61 is aimed at making that easier.
Hi,
my host computer uses a Dvorak layout with a Qwerty keyboard. I am using this for automatic text entry. I'm indeed also using Keycodes directly but there too also using the KeyboardLayout to translate from the letter to the keycode, it's more convenience switching between the various layouts.
I totally understand that, I had some doubts about it too as there was a high duplication between the layouts, practically everything is copy-pasted while I'm actually only modifying the ASCII table. I'll keep an eye on PR #61 as it seems to address these concerns. I'll refactor when that is merged.
Thank you for the consideration though! I'll close the PR and make a new one when #61 is merged if that's okay.
FYI I'm in the process of building up a keyboard layouts repository/bundle, to make it easier to find and download keyboard layouts independently, while not requiring to create a new repository for each layout. It uses a modified KeyboardLayout class from PR 61.
I converted and added your Dovrak keyboard layout to it. I haven't tested it with a real keyboard.
Redid the ASCII to keycode table to support a Dvorak key layout. It mostly is a verbatim copy from the existing KeyboardLayoutUS.