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

Character 'Y' switching between two keyboard layouts (cz -> rus) #354

Open
rampaq opened this issue Aug 29, 2021 · 5 comments
Open

Character 'Y' switching between two keyboard layouts (cz -> rus) #354

rampaq opened this issue Aug 29, 2021 · 5 comments

Comments

@rampaq
Copy link

rampaq commented Aug 29, 2021

There is an issue with two keyboard layouts in 3.20210804.1/2, which was not present in previous versions.

I set a primary Czech (cz) keyboard and add a russian phonetic layout, toggled between by Alt+Shift.
setxkbmap -layout cz,cz -variant ,rus -option grp:alt_shift_toggle

Then a capital 'Y' types as russian 'Ы' for some reason.

echo "Y" | xdotool type --clearmodifiers --file -                                             
# output: Ы

echo "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | xdotool type --clearmodifiers --file -                                             
# output: ABCDEFGHIJKLMNOPQRSTUVWXЫZabcdefghijklmnopqrstuvwxyz

What is interesting that this happens only with capital 'Y'. I thought that xdotool pushes the toggle switch command but that does not seem to be the case as setxkbmap -layout cz,cz -variant ,rus -option grp:alt_space_toggle (changed toggle key) behaves exactly the same.

However, when I change the primary layout to us then everything is ok:

setxkbmap -layout us,us -variant ,rus -option grp:alt_space_toggle
echo "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | xdotool type --clearmodifiers --file -
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

And yes, the 'Y' is still ascii hex 59 on both cz, us keyboards.

Note: setxkbmap after setting the layout does not solve the problem, as was suggested by some in #97

setxkbmap -print output:

xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwertz)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+cz+cz(rus):2+inet(evdev)+group(alt_space_toggle)+group(alt_shift_toggle)+capslock(escape)"  };
        xkb_geometry  { include "pc(pc105)"     };
};

Is there some even hacky fix?

@jordansissel
Copy link
Owner

Weird key map problems in xdotool are An old but unsolved issue. Thank you for the great details in your report!

I don’t have any suggestions right now, but I am hopeful we can find a fix soon.

@rampaq
Copy link
Author

rampaq commented Aug 29, 2021

Yes, but this is only a matter of the latest version, as I did not noticed any problems before.

In fact, it is caused by a supposed fix for Latin letters (PR #283). I built xdotool without that PR and it works! Quite baffled why does setting Shift modifier causes this, also only for this one 'Y' letter.

How does xdotool handle unicode characters btw?

Y = 59, Ы = (unicode) d0 ab
all hex, from hexdump

@jordansissel
Copy link
Owner

jordansissel commented Aug 29, 2021 via email

@jordansissel
Copy link
Owner

I tested this a bit and found that with your keymap, the 'Y' key is available two different ways. The first way is what xdotool chooses and it doesn't type it correctly (as you noted).

xdotool sends the "Shift" key then the Cyrillic_yeru ы key, when it should be sending a different sequence of modifiers (shift, alt, etc). I'll need to dig more to figure out what xdotool is doing wrong.

@rampaq
Copy link
Author

rampaq commented May 3, 2023

Thanks for pursuing this further! If you need any testing, please let me know (I'm using 3.20160805.1-3 for now, haven't tested newer releases).

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

2 participants