1

Is there a way to automatically click at a specific place in specific window without getting the window focused?

  • Try the -window option for mousemove and click. xwininfo -int -tree .. may also be of interest. – dirkt Nov 6 '17 at 8:01
  • @dirkt That does not prevent the window from getting focus, at least in Unity. – undercat supports Monica Jan 14 '18 at 20:09
2

I've just been struggling with the same problem and this is the best option I could come up with:

$ (w=`xdotool getactivewindow` && xdotool click 1 && xdotool windowactivate $w)

This line saves the ID of the currently active window, then issues the click command at the location of the mouse cursor, and then forces the focus to go back to the window that was active.

Thus, the target window WILL gain focus for a split second, but then the focus will return to the original window.

This is suboptimal, but may be an acceptable solution depending on what you are doing.

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.