xdotool click --clearmodifiers 3 works as right-click in firefox and chromium-browser, but not in all programs such as Thunar file manager and xfce4-terminal. Why is that?

In terminal, if I run the command by entering it there, context menu appears, but if I run the command by keyboard shortcut (set in Xfce's keyboard settings), it does not work.

Anyway, shift + F10 seems to work (though I have to use Fn key in my Macbook keyboard).

  • What about just xdotool click 3? – DK Bose Jan 13 at 10:20
  • @DKBose same thing – jarno Jan 13 at 10:49
  • 1
    +1 can confirm this. Most likely something to do with Xfce keyboard shortcut. I have since given up and just use the default shortcut Shift+F10 or context menu key. Else xdotool always work in command line. – clearkimura Jan 13 at 11:30
  • I too can confirm this for Xubuntu 18.04. I made a simple script with just xdotool click 3 and assigned a shortcut to it. But the same route works just fine in Lubuntu 18.04 and Kubuntu 18.04 for all applications tested. If it's important to you, I suggest also asking at forum.xfce.org. – DK Bose Jan 13 at 12:29
  • 3

xdotool simulates you moving or clicking the mouse, or pressing the keyboard. You trigger the xdotool script with the keyboard, but before you are releasing the key, xdotool already issues the mouse click. For some situations, xdotool may be too fast. The precise reason why it sometimes works, the other time not, is probably only to be found out by experts.

Anyway, try introducing a few ms delay by prepending the xdotool command with a sleep command, e.g.

sleep 0.2 && xdotool click --clearmodifiers 3

would introduce a 200 ms delay before executing the xdotool command.

  • In this case xdotool simulates mouse event. – jarno Jan 13 at 14:22
  • I still do not understand why it does not work without the delay with all applications, but anyway the main thing is that I can make it work now. – jarno Jan 13 at 14:28
  • +1 can confirm this. Related: This older answer also suggested a workaround to add delay for making xdotool work properly in Unity/Compiz (cause not known). So not just Xfce issue apparently. – clearkimura Jan 13 at 16:53
  • Understand or not: computers are complex systems. Input may not yet be registered if something else is busy, which is why mouse movements and keystrokes are not coming through if not issued on the right moment. I changed my answer because indeed your question is on mouse input. The principle remains, however. – vanadium Jan 13 at 17:23
  • The command seems to corrupt mouse: Bug – jarno Jan 18 at 9:58

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.