jotson / ridiculous_coding

Ridiculous addon for Godot Engine that adds screenshake and explosions to your coding experience
MIT License
842 stars 30 forks source link

Letters are incorrect on non-Qwerty Keyboard layouts #1

Open AaronRecord opened 4 years ago

AaronRecord commented 4 years ago

I'm currently using the Dvorak keyboard layout and the letter particles that appear are still mapped to Qwerty

jotson commented 4 years ago

What OS are you using? I don't know how Dvorak works... are you using software to translate letters (s => o) and you rearranged the keycaps?

It looks like Godot does have some problems with this. There's an open bug https://github.com/godotengine/godot/issues/5503 for detecting keyboard layout.

AaronRecord commented 4 years ago

@jotson I'm using Windows 10, Dvorak is just an alternate layout to Qwerty where the letters are arranged by how often they're used (e.g. the most commonly used letters are on the home row) that I'm learning mostly for fun

are you using software to translate letters (s => o)

yes

and you rearranged the keycaps?

no, I just don't look at the keyboard :)

Most programs (Godot included) work normally including all the keyboard shortcuts (e.g. W for move tool) and the only time the keyboard layout actually matters is when you're typing (which is how it probably should work since most keyboard shortcuts are designed for QWERTY). I'd assume it's because they're reading the keyboard input before the letters get mapped to whatever keyboard layout someone is using. This is also true for Godot's input system (e.g. pressing the physical "a" key will trigger "ui left" if I map "ui left" to the "a" key, regardless of what keyboard layout I'm using), but when I'm actually typing (e.g. writing a script or changing the value of a string) then it uses the Dvorak keyboard layout.

jotson commented 4 years ago

I've never tried dvorak before. The proximate cause of the problem is in the OS.get_scancode_string method or get_scancode_with_modifiers in Godot. I use that to generate the strings of keys that were pressed like last_key = OS.get_scancode_string(event.get_scancode_with_modifiers())

Someone with a dvorak layout :eyes: who can help troubleshoot the issue will need to file a bug upstream.

ACB-prgm commented 3 years ago

Idk if this is helpful, but the OS class has a get_latin_keyboard_variant() function:

Returns the current latin keyboard variant as a String.

Possible return values are: "QWERTY", "AZERTY", "QZERTY", "DVORAK", "NEO", "COLEMAK" or "ERROR".

Note: This method is implemented on Linux, macOS and Windows. Returns "QWERTY" on unsupported platforms.

jitspoe commented 1 year ago

I don't think this is an issue any more. Could probably be closed.