I add the xdotool commands to .xbindkeysrc. The commands for mouse work, such as

"xdotool mousemove 200 200"

but I keys do not work, such as

"xdotool key x"

What can be the reason that the first command works perfectly, but the second command not. When pressing Q key, instead of typing X, it does nothing (it just prevernts the default behaviour of Q key).

Mouse to key commands also work, such as

"xdotool key x"

The problem is not the xdotool command, as the following command works in the terminal

xdotool key x

This works for me:

xdotool sleep 0.2 key x

I'm not sure why it seems related to timing, but perhaps due to the overhead of, in my case, xbindkeys calling sh or bash and wmctrl.

  • Definitely something strange going on with the timing. Even with the sleep 0.2, you have to hit the keys just right to get it to work. – alrob Feb 24 at 4:01

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.