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

Doesn't work with non-QWERTY layouts (e.g. Dvorak) #43

Open
TinfoilSubmarine opened this issue Feb 5, 2020 · 11 comments
Open

Doesn't work with non-QWERTY layouts (e.g. Dvorak) #43

TinfoilSubmarine opened this issue Feb 5, 2020 · 11 comments

Comments

@TinfoilSubmarine
Copy link
Contributor

Hi, if I type in ydotool type "This is a test" I get this instead: Ydco co a y.oyv which signifies that ydotool is typing in QWERTY, not Dvorak.

For reference, I'm using sway as my WM and the following lines of config:

input * xkb_layout "us,us"
input * xkb_variant ",dvorak"
input * xkb_options "grp:shifts_toggle, caps:swapescape"

@ClassicOldSong
Copy link
Collaborator

#22

@TinfoilSubmarine
Copy link
Contributor Author

I'm looking at the codebase to familiarize myself with it. Since it seems that currently, we assume that the user wants to type in QWERTY, there really needs to be a way to consider if the user is using an alternative layout.

For example, one can modify /etc/vconsole.conf to use a different layout resulting in the same mismatch that I have while using a non-QWERTY layout in Sway.

As I see it, there are several options.

We can create separate tools for each instance, e.g. Sway-Type, Console-Type, etc. This would probably be easiest; we can confine the scope of each tool by assuming the user is in the expected environment.

Or, we can modify the existing Type tool to preferentially use the "highest" layer to determine the layout it should type in. So if we are executing ydotool from within a WM, we should try to use the WM's layout preference. If we are in console, we should use /etc/vconsole.conf. I'm sure there's some edge case I'm missing here, but you can understand the idea. This is probably more correct, but also more complex.

Thoughts?

@ClassicOldSong
Copy link
Collaborator

Thanks for digging into this.

I didn't have this issue while I'm using Norman Layout because my keyboard can configure as different layouts it-self, no need for OS or DE to map these keys. So change to a hardware based configuration could be another solution.

@TT-392
Copy link

TT-392 commented Aug 24, 2022

I am pretty sure this is related even though I am on a pretty common qwerty layout.
On a us(intl) layout on sway, ydotool type "^" seems to type a "~" instead (kind of a big deal for rofi-pass).

@eddy-geek
Copy link

Another imperfect option is how Hawck is handling this. In short, while it's also not autodetecting the layout, it's parsing console layouts and can be configured to use any of them to translate keys for input.

Of course console keymaps are not exactly the same as XKB ones, but this may be simpler/more portable than trying to use XKB ?

@flavi1
Copy link

flavi1 commented Jan 31, 2024

I share here a temporary (and not consistant) fix for visitor that are looking to use ydotool in an azerty envoronnement

# azerty to qwerty
char=$(echo "$char" | sed -e 'y/²&é"(-è_çà)=azertyuiop^$qsdfghjklm*<wxcvbn,;:!³1234567890°+AZERTYUIOP¨£QSDFGHJKLM%µ>WXCVBN?.\/§/`123567890-=qwertyuiop[]asdfghjkl;\\êzxcvbnm,.\/~!@#$%^&*()_+QWERTYUIOP{}ASDFGHJKL:"|ÊZXCVBNM<>?/' -e "y/'ù/4'/")

(from https://linuxtrack.net/viewtopic.php?id=1380)
Likely to be helpfull...

@DonQuiProgger
Copy link

Is it possible to specify the wanted keyboard layout as parameter to ydotool?

@AndrewKvalheim
Copy link

Not currently. I’ve just been patching my layout in.

@jonas73x
Copy link

jonas73x commented Aug 13, 2024

How did you figure out how do patch the layout? I see the ascii to keycode function in tool_type.c but can't seem to figure out how to specify the layout. At first I thought the "// 00 - 0f" etc were scancodes for a typical US layout, but that doesn't seem to be the case?

@AndrewKvalheim
Copy link

ascii2keycode_map translates from ASCII text to input events; the position in the list is what character to type, and the value is how to type it.

@jonas73x
Copy link

thank you! very helpful

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

No branches or pull requests

8 participants