ydotool icon indicating copy to clipboard operation
ydotool copied to clipboard

Ctrl+C garbles whole session input

Open donjan opened this issue 3 years ago • 4 comments

Running on Ubuntu 22.04 and possibly ydotool 1.0.1 (see #169).

I want to automate a batch sequence with ctrl+c. The ydotool lines that should accomplish this

ydotool key 29:1 46:1 29:0 46:0

or

ydotool key 29:1 46:1 46:0 29:0

behave both exactly the same: they get stuck. The output is

~$ ydotool key 29:1 46:1 29:0 46:0
^C
~$ ^C
~$ ^C
~$ ^C
[...]
~$ ^C
~$ ^C
~$ ^C
~$ ^A

until I hit some other key, e.g. just a, and after that my keyboard is stuck with the Ctrl key pressed, making it unusable. The quickest way to salvage the situation is to exit the whole session by logging out via the panel. Since the mouse still works, I can also navigate the System Monitor and end the ydotoold process, which normalises my keyboard again.

Am I using this wrong or does anyone else observe this behaviour? Haven't found much info in #167.

donjan avatar Aug 13 '22 15:08 donjan

I'm kinda facing the same issue, did you resolve this?

Hikandy avatar May 08 '23 10:05 Hikandy

This might be resolved when ydotool is not being executed on the topmost frame:

When Ctrl+C is pressed, ydotool itself is killed, so Ctrl+C release commands are never sent to ydotoold.

You may workaround by:

sh -c 'sleep 1 && ydotool 29:0 46:0' &
ydotool 29:1 46:1

or simply:

ydotool 29:1 46:1 29:0 46:0 &

ClassicOldSong avatar May 08 '23 15:05 ClassicOldSong

Possible solution here is whenever a socket connection is broken, ydotoold will release those unreleased keys automatically.

This should be provided as an option, for example ydotool --release-on-disconnect, since we might want to press a key in one ydotool command and then release it in another one.

ClassicOldSong avatar May 08 '23 15:05 ClassicOldSong

I'm kinda facing the same issue, did you resolve this?

Unfortunately no, and I find myself more often than not logging into X11 instead of Wayland due to latter's immature tooling.

You may workaround by: sh -c 'sleep 1 && ydotool 29:0 46:0' & ydotool 29:1 46:1

Thanks for the suggestion. My automation migration to Wayland is on hold for now, I'll just keep an eye on this issue and try again once things have progressed.

donjan avatar May 16 '23 15:05 donjan