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 · 16 comments
Open

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

TinfoilSubmarine opened this issue Feb 5, 2020 · 16 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...

@poleprogger
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

@jeffutter
Copy link

I believe I'm running into this issue as well although maybe a variation of it. I type in colemak, I have my console set to colemak and also have my wayland setup like this: (hyprland)

device {                               
  name=at-translated-set-2-keyboard                                                                                                                                                                                       
  kb_options=caps:escape                                                                                     
  kb_variant=colemak                                                                                                                                                                                                      
}                           
                                                                                                             
device {                                                                                                     
  name=ydotoold-virtual-device                                                                               
  kb_layout=us                                                                                               
  kb_options=                                                                                                
  kb_variant=                                        
}                  

input {
  kb_layout=us
  kb_variant=
}

If I run ydotool from a shell launched inside hyprland - everything works AOK. However if I use a hyprland binding to launch it, it prints jibberish. Ex:

bindle=ALT, M, exec, /nix/store/b5459hsa0dh441y4j8d2wv60ylzg4k4g-ydotool-1.0.4/bin/ydotool type foo
bindle=ALT, C, exec, /nix/store/b5459hsa0dh441y4j8d2wv60ylzg4k4g-ydotool-1.0.4/bin/ydotool key 29:1 46:1 46:0 29:0

I suspect that somehow when running from the binding, it converts it to colemak and then converts the colemak keycode to yet a different querty keycode?

@KaKi87
Copy link

KaKi87 commented Jan 12, 2025

This project is dead.

@ReimuNotMoe
Copy link
Owner

This project is dead.

No it isn't.

Since this is an open source project, if you cannot provide help, please just TG

@KaKi87
Copy link

KaKi87 commented Jan 12, 2025

No it isn't.

This is your first ever comment on this 5 years old issue, this is your first time commenting any issue in 10 months, and the last commit is 5 months old. 🤷

this is an open source project

That changes nothing.

you cannot provide help

I'm helping by telling people not to expect this issue to be fixed anytime soon.

TG

What do you mean ?

@ClassicOldSong
Copy link
Collaborator

I have already replied to multiple issues pointing to the same problem and explained multiple time why and how this issue happens and how it can't and shouldn't be fixed here.

Once again, ydotool emulates a physical keyboard that you need to set its software layout manually just like you set your layout to your physical keyboard. If you don't know how software layout works, it's not our job to lecture you with necessary lessons.

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