BlueM / cliclick

macOS CLI tool for emulating mouse and keyboard events
https://www.bluem.net
Other
1.56k stars 115 forks source link

Restore (-r) does not work with `cliclick -r m:100,100` #116

Open tobiashochguertel opened 3 years ago

tobiashochguertel commented 3 years ago

I tried to move the mouse to the place 100,100 and then restore the previous position (-r), but the mouse stays at 100,100 and is not restored.

watch -n 5 cliclick -r m:100,100

or 

cliclick -r m:100,100

I try to prevent enabling the screensaver - which is at the moment managed by my company and is activated each 5 minutes when there was no activity. But this usage doesn't matter - I think we just have a bug in cliclick ;)

$ sw_vers
ProductName:    macOS
ProductVersion: 11.0.1
BuildVersion:           20B50
1 hochguertelto@de-dus-nb-toh:~
$ cliclick -h

cliclick (short for “Command Line Interface Click”) is a tool for executing mouse- and keyboard-related actions from the shell/Terminal

USAGE
  cliclick [-r] [-m <mode>] [-d <target>] [-e <num>] [-f <file>] [-w <num>] command1 [command2]

OPTIONS
  -r          Restore initial mouse location when finished

....

Version 4.0.1, released 2018-04-10
Author: Carsten Blüm, <carsten@bluem.net>
List of contributors: https://github.com/BlueM/cliclick/graphs/contributors
Website: https://www.bluem.net/jump/cliclick/
tobiashochguertel commented 3 years ago

Okay a workaround is:

watch -n 250 "cliclick m:+50,+0 m:-50,0"

moves the cursor each 250 seconds relative from his current position "50 pixel to the left", and then "50 pixel to the right".

That works, very well!

Life safer, so I can read without thinking documentations or watch a movie. 😃

But the bug "-r" is still present ;)

BlueM commented 3 years ago

I’m still on 10.15 (notorious late adopter) and can’t reproduce the problem – -r works as expected.

What happens when you try to use cliclick p? Do you get the correct current cursor coordinates?

nadeemkhedr commented 2 years ago

I too have the same issue, cliclick p does work it gives the right mouse position but when I do

cliclick -r m:0,0

(to activate hot corner) it doesn't do anything, I'm on big sur 11.6

cliclick m:0,0 

works fine

BlueM commented 2 years ago

@tobiashochguertel: Do you use more than one screen?

@nadeemkhedr: “doesn't do anything” means the hot corner action is not triggered?

nadeemkhedr commented 2 years ago

@BlueM yes it doesn't trigger

tobiashochguertel commented 2 years ago

@tobiashochguertel: Do you use more than one screen?

@nadeemkhedr: “doesn't do anything” means the hot corner action is not triggered?

Yes, I have double screen, and sometimes triple screen. I think when I reported this issue, I had double screen.

BlueM commented 2 years ago

@tobiashochguertel: As you (probably) used two screens and the cliclick version was < 5.0.1, I’d assume it’s #119. Please try if the problem is reproducible with 5.0.1

@nadeemkhedr: it seems that to activate hot corners, you need to slow down / humanize the mouse movement. I found that in my case, cliclick -e 100 m:0,1440 (for lower left corner) works. But: depending on the hot corner action, macOS might require the mouse to stay there for some seconds. So, when used with -r, it might be necessary to add the “wait” (w) action: cliclick -r -e 100 m:0,1440 w:2000.

dkbarto commented 2 years ago

I'm new here and on 12.1. The cliclick m:0,0 doesn't move the mouse to 0,0, it just stays at the current position in the terminal window. Is there something that I'm missing w.r.t. 12.1?

BlueM commented 2 years ago

@dkbarto: that’s a different issue, probably https://github.com/BlueM/cliclick/issues/135#issuecomment-999397195