Can xdotool position the mouse relative to current location?
You'll find the answer in the xdotool
man page:
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.
In your case it will be:
xdotool mousemove_relative --sync 5 0
Related videos on Youtube
Tim
My name is Tim. I've graduated from the University of Nottingham with a First Class Computer Science BSc with Hons. In my spare time I do computer programming, often C or JavaScript, but also shell scripts, and answering questions on Stack Exchange. I used to spend most of my time on Ask Ubuntu; now I mostly browse the HNQ or Meta Stack Exchange. If you want to contact me it's [email protected] Do you need a reliable VPS? Try Digital Ocean. Sign up with this link for $10 free. One of my favourite sites is Kiva.org, a micro-funding organisation that allows people to lend money via the Internet to low-income entrepreneurs and students in over 80 countries. Kiva's mission is “to connect people through lending to alleviate poverty.” With just $25 you can make a difference - and 99% of loans are paid back in full - so you can lend again and again!
Updated on September 18, 2022Comments
-
Tim almost 2 years
Is there any way of choosing not a screen location, but a location relative to where it is?
For example, it could be
xdotool mousemove +5 +0
Does this exist?
-
tester about 5 yearsif you end up here trying to move the mouse relatively and with negative x, y values, you need to
xdotool mousemove_relative -- -5 -10