Skip to content
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

Use active keymap instead of hard-coding English qwerty #2

Open
piater opened this issue Apr 23, 2019 · 6 comments
Open

Use active keymap instead of hard-coding English qwerty #2

piater opened this issue Apr 23, 2019 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@piater
Copy link

piater commented Apr 23, 2019

Resource.cpp currently hard-codes an English qwerty keyboard mapping. For example, @ is represented as Shift-2. Thus, if a German qwertz keyboard mapping is active where Shift-2 is =, ydotool type @ results in = being typed.
Perhaps one way forward is to follow the example of dumpkeys.

@ReimuNotMoe
Copy link
Member

First I have a question, since we're emulating a new input device, does Linux kernel support different keyboards in different layouts?

I don't have much time to have a deep look, but a quick search shows (at least) X11 and Wayland supports this. I'm not sure whether this can be achieved in text console.

@piater
Copy link
Author

piater commented Apr 24, 2019

does Linux kernel support different keyboards in different layouts?

Yes; dumpkeys reads the keyboard translation table used by the virtual consoles (and loadkeys loads them). They are developed alongside the kernel and hosted on kernel.org.

(at least) X11 and Wayland supports this.

The best way would be to load the currently-active translation table, no matter whether we are running on a vconsole, under X11, or under Wayland. They each handle their own keyboard mappings though. Therefore perhaps a good way to handle this is go back to the roots, use the vconsole keyboard layout as a lowest common denominator, and hope users configure their X/Wayland keymaps to match their console keymaps.

@seiichiro0185
Copy link

seiichiro0185 commented Jul 17, 2019

+1 for this, I'm currently looking to replace xdotool with ydotool (mainly for my pass autotype script) and switching to wayland. Unfortunately this issue prevents me to do this at the moment, since e.g. z is typed as y and vice versa (I'm on a german keymap as well). I would also be Ok with using the vconsole keymap for this purpose.

@ClassicOldSong ClassicOldSong added the help wanted Extra attention is needed label Jul 17, 2019
@ClassicOldSong
Copy link
Member

ClassicOldSong commented Jul 17, 2019

If anyone has any idea on how to get this issue solved, pull requests are always welcomed. We're currently moving to a new city and probably don't have time to deal with this in a month or so.

@piater
Copy link
Author

piater commented Jul 17, 2019

I have scratched my itch in the meantime; check out uinputchars. @seiichiro0185, this should fully address your use case, which exactly matches mine. @ClassicOldSong, if it helps you, I can refactor my code into a library.

@ClassicOldSong
Copy link
Member

@piater wow looks great, I'll check it out later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants