My situation: I have a notebook with German keyboard layout running Ubuntu 16.04. It hosts an Android VM through QEmu/KVM, which is configured for German keyboard layout as well.
When I'm typing something in the VM using the real hardware keyboard, it works perfectly fine. However, as the guest system doesn't support a shared clipboard (or I am just too stupid to set it up), I wanted to use xclip
and xdotool
on the host to simulate typing the host's clipboard content into the VM.
The command I have bound to a keyboard shortcut is:
bash -c 'sleep 0.5 ; xdotool type --clearmodifiers "$(xsel -b)"'
This does its job and types whatever is in the host's clipboard buffer. Unfortunately, there seems to be some keyboard layout confusion when I use it to type something into my VM. For example, https://youtube.com
becomes httpsÖ//zoutube.com
in the VM.
To me this looks like xdotool
is using the English QWERTZ keyboard layout to type, instead of the German layout I configured everywhere, as the German key Ö is used for `: in the English layout, and the keys Y and Z are swapped too (among other differences).
How can I teach xdotool
or my VM or whatever component is responsible for the confusion to type using the correct keyboard layout?
Best Answer
It might not be the cleanest solution but this works for me.
Use
setxkbmap
before yourxdotool
command :You can avoid having to change the keyboard layout in your script by including your current layout in the config file
.xinitrc
. Create the file if it does not exist.