Skip to content

Add Dvorak layout #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

vinc
Copy link
Contributor

@vinc vinc commented Jan 3, 2020

Hello, I started coding a toy OS and your crate is really helpful, thanks!

I use a Dvorak layout so I created one by copying the US 104 layout and keeping only the diff, like the code of the UK 105 layout does.

I didn't change any of the ctrl modifiers, not sure if I should? I don't use that on my keyboards so I don't really know.

@thejpster
Copy link
Member

So the deal with Control + Key is that Control + A gives 1 (0x01), Control + B gives 2 (0x02), and Control + Z gives 26 (0x1A).

I think following the principle of Least Surprise would mean that Control + C would do a 'Copy' function, no matter where on the keyboard the 'C' key was. I therefore propose we change the Dvorak mapping so that Control + Letter gives the correct control code for the letter printed on the key, as opposed to the letter at the corresponding position on the US keyboard (i.e. the KeyCode).

@thejpster
Copy link
Member

This diff also highlights the issue with naming the KeyCode letter keys after the letter they have on a US keyboard, but I can't think of anything better to use - mapping Key R to Unicode character P seems marginally less confusing than mapping Key 19 to P.

@vinc
Copy link
Contributor Author

vinc commented Jan 4, 2020

Thanks, I'll change the Control modifiers, it's indeed much better!

For the KeyCode naming I think it's good as it is, personally I didn't think it confusing because my keyboards are either blank or azerty, so I'm used to having a mental image of a physical US keyboard then remapping it to the actual output I want.

@vinc
Copy link
Contributor Author

vinc commented Jan 20, 2020

I changed the modifiers so that pressing CTRL with the key that produce a C for example will result in CTRL+C as expected. And while I was doing that I noticed that you are using is_caps() for upper-case letters and is_shifted for symbols, so I did the same.

@thejpster thejpster merged commit ea4f5ff into rust-embedded-community:master Jan 22, 2020
@thejpster
Copy link
Member

Thank you so much!

@vinc vinc deleted the feature/add-dvorak-layout branch January 22, 2020 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants