使用 xdotool 输入一些文本,与键盘布局无关

use*_*453 5 xorg keyboard-layout xdotool

命令

xdotool type "hello"
Run Code Online (Sandbox Code Playgroud)

可用于输入单词hello。但前提是键盘布局不是英文,否则会输入其他内容。

我该如何解决这个问题,以便xdotool在任何布局中始终键入 hello。

我使用 Ubuntu 14.04 存储库中的最新版本xdotool

use*_*873 3

xdotool 似乎有一个错误,如果您没有使用us键盘布局,并且您的键盘布局是通过 Xorg 配置文件(不是setxkbmap)设置的,它将使用布局中相应的键盘符号us

要解决此问题,只需在文件中(再次)设置键盘布局.xinitrc,或setxkbmap yourlayout在使用 xdotool 之前运行即可。