-
Notifications
You must be signed in to change notification settings - Fork 112
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
Using evdev with international/non-US keyboard layouts? #180
Comments
with Q you probably mean KEY_Q, right? This name comes from https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h Instead of using "KEY_Q" to write a Q, try to inject the integer that comes from |
The key definition file I'm familiar with has dropped most of the "KEY_" prefixes, probably to reduce the verbosity of the combos in the user's config file, but it should be the same thing. # xkb uses keycodes that are 8 higher than those from evdev
XKB_KEYCODE_OFFSET = 8 That is very interesting. So input-remapper is able to build the key definition on-the-fly from the output of Thanks for the info/links. I will look into how this works. |
it doesn't actually, good point. Noone has ever opened an issue about this, so most people probably keep their keyboard layout forever without changing it. If a layout changes, I think the injection has to be restarted. If there is a way to detect a layout change, it might be via dbus. But those messages are probably custom to the desktop environments. |
I'm not sure how well this While most people may stick with a single layout, I have seen some indications that there is a pretty good slice of international users who need to use multiple layouts. And there is even an option in GNOME to use a different layout per window, which would mean there really would be a need to get the current layout at any given moment. That would be an essential feature for anyone working on documents in multiple languages in different windows. Here's a snippet of the output from
It's turning out to be quite difficult to get the active keyboard layout. Every command that I've seen offered as a solution for this purpose either shows the US layout (probably the locale default) no matter which layout is actually active, or shows a list of all enabled layouts on the system. Which is kind of what The only tool I've found so far that actually reports the currently active layout correctly is this one: Seems this is still a more difficult problem than I was hoping. |
It gets worse: In Wayland, managing keyboard layouts seems to be the job of the desktop environment as far as I know, so implementations and possible solutions vary from environment to environment. That |
I've been using a keyboard input remapper (
xkeysnail
and its forkkeyszer
) that usesevdev
and noticed that it can't handle international/non-US keyboard layouts very well. For instance, if you switch to an AZERTY layout instead of the usual US QWERTY layout and a remapped combo tries to useevdev
to type a "Q", it will output an "A" into the application because the new keyboard layout interprets that key code as an "A".I tried to understand why this happens, and it seems like
evdev
would need a different key definition file for each keyboard layout, whereas these projects only come with akey.py
file containing key definitions for a US keyboard layout. Soevdev
always acts like it's typing on a US keyboard.Are these projects misusing
evdev
in some way, or are there tools or techniques available to allowevdev
to easily adapt to different international keyboard layouts, without having to create a new key definition file for each layout?I'm not certain I actually understand the whole situation with
evdev
and non-US keyboard layouts. Any ideas on how to deal with international keyboard layouts while usingevdev
? There are not many references to keyboard layouts that I can find in the issues here, so I feel like I might be missing some obvious solution to this problem.The project that uses these keymappers:
https://github.com/rbreaves/kinto
The keymappers projects I'm referring to:
https://github.com/joshgoebel/keyszer
https://github.com/mooz/xkeysnail
The text was updated successfully, but these errors were encountered: