xdotool 可以相对于当前位置定位鼠标吗?

Tim*_*Tim 7 command-line xdotool

有没有办法不选择屏幕位置,而是选择相对于它所在位置的位置?

例如,它可能是 xdotool mousemove +5 +0

这存在吗?

Syl*_*eau 8

您将在xdotool 手册页中找到答案:

   mousemove_relative [options] x y
       Move the mouse x,y pixels relative to the current position of the
       mouse cursor.

       --polar
           Use polar coordinates. This makes 'x' an angle (in degrees,
           0-360, etc) and 'y' the distance.

           Rotation starts at 'up' (0 degrees) and rotates clockwise: 90 =
           right, 180 = down, 270 = left.

       --sync
           After sending the mouse move request, wait until the mouse is
           actually moved. If no movement is necessary, we will not wait.
           This is useful for scripts that depend on actions being
           completed before moving on.

           Note that we wait until the mouse moves at all, not necessarily
           that it actually reaches your intended destination. Some
           applications lock the mouse cursor to certain regions of the
           screen, so waiting for any movement is better in the general
           case than waiting for a specific target.
Run Code Online (Sandbox Code Playgroud)

在您的情况下,它将是:

xdotool mousemove_relative --sync 5 0
Run Code Online (Sandbox Code Playgroud)

  • 如果您最终在这里尝试相对移动鼠标并使用负 x、y 值,则需要`xdotool mousemove_relative -- -5 -10` (3认同)