XTEST keyboard layout is not set properly on server startup
If you have Xkb configuration set in xorg.conf for non-US layout it seems XTEST does not really honor it until you run setxkbmap
without arguments.
To test this set the startup X server layout to EurKey (eu
) and run xdotool with a symbol that requires ISO_Level3_Shift:
Expected:
$ xdotool key adiaeresis
ä
Actual:
$ xdotool key adiaeresis
a
Testing this against xev
shows that the correct modifier (ISO_Level3_Shift / AltGr) is being pressed down by xdotool before a
to produce ä
but it seems to be ignored by the server. This smells like the keyboard layout is in fact US on startup for XTEST. Running setxkbmap
without arguments seems to fix this situation per session by resetting the layout options by reading them out and writing back in.
If you query with setxkbmap
all devices (core as id=3, XTEST as id=5 and the physical keyboard) have the proper layout set on start, just querying does not cause the layout issue to be worked around per session:
$ setxkbmap -query -device 5
rules: evdev
model: pc105
layout: eu
options: caps:super
This rarely affects end users as most configure their layout on DE level which would issue a layout change after the server has started or they stick with US that wouldn't be affected by this. However if you use tools like localectl
or /etc/defaults/keyboard
on Debian-like systems to set system wide defaults this will pop up.
I noticed this when I was working on another program that uses XTEST other than xdotool and could confirm this behavior on both.