The command

xdotool type "hello"

can be used to type the word hello. But only if the keyboard layout is not English, otherwise it will type something else.

How can I solve this problem so that xdotool will always type hello in any layout.

I use the latest xdotool in Ubuntu 14.04 repo.

  • 1
    It should work. Changing the keyboard layout doesn't change the result here. Maybe you are running into this bug that occured when having multiple layouts configured, and was fixed here ? – Leiaz Jun 30 '14 at 15:37
  • Should I recompile that code and use that xdotool instead of the latest in repo? – user69453 Jun 30 '14 at 17:16
  • Yes, you can try the latest git version and see if it still happens. Here xdotool -v says I'm using version 2.20110530.1. – Leiaz Jun 30 '14 at 17:30
  • I have version 3.20140217.1 – user69453 Jun 30 '14 at 17:41
  • If it still doesn't work, add to your question how your are using xdotool exactly, how you call it, on which application you are trying to type (maybe the application interprets keycodes with its own keymap for instance). – Leiaz Jun 30 '14 at 18:51

xdotool seems to have a bug, If you are not using the us keyboard layout, and your keyboard layout was set through an Xorg configuration file (not setxkbmap), it will use the corresponding keysyms from the us layout.

To work around this, simply set your keyboard layout (again) in your .xinitrc file, or run setxkbmap yourlayout before using xdotool.

  • this works beatifully, unfortunately the command takes ~0.5 sec which is not feasible. – phil294 Aug 4 '17 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.