how can I write a script to move relative cursor position with a keystroke (Like AHK on Windows)

An example in AHK would be:

1::Click, right

2::MouseMove, 0, 70, 0, R

3::Click

1 Answer

Install xdotool:

sudo apt-get install xdotool

and from a terminal or script:

  • Up

    xdotool mousemove_relative -- 0 -70
  • Down

    xdotool mousemove_relative 0 70
  • Right

    xdotool mousemove_relative 70 0
  • Left

    xdotool mousemove_relative -- -70 0

You can also pilot clicks with:

  • Left click

    xdotool click 1
  • Right click

    xdotool click 3
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like