-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeated characters when --delay is large #423
Comments
I’m on my phone so it’s hard to check the code, but my guess is that xdotool splits the delay between the key press and key release, and maybe it shouldn’t do that for the reasons you’ve found!
Assuming I’m remembering the code right, we should be able to make it so the delay between press and release is much shorter
…On Wed, Apr 5, 2023, at 6:33 PM, 積丹尼 Dan Jacobson wrote:
On my system today the repeating starts at around 996 ms.
for i in 980 990 998; do xdotool type --delay $i $i.; done
980.990.999988..
Even scarier is when one tries e.g., --delay 4000...
Also key --delay has similar problems.
xdotool version 3.20160805.1
—
Reply to this email directly, view it on GitHub <#423>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABAF2UHCFXIMLDPGG655F3W7YMOVANCNFSM6AAAAAAWUY27LQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Well, apparently there is some number hardwired into the program that the user cannot access. Therefore, whatever you change, be sure to expose it so the user can also adjust it, in case whatever is assumed causes problems on his system. |
I just did some experimentation which seems to verify
(I think "apparently there is some number hardwired into the program that the user cannot access." is unrelated.) It appears that the key down event is issued immediately, and if
In other words, s is held for a second, released for a second, then held again for a second and released for a second. If your X server (window manager? I'm not sure what handles this behavior) repeats letters that are held for a long time like mine does, you'll get repeated keys. |
That's a great explanation to add to the man page. However I would use two different characters instead of the two of the same. Also the man page could add an example of using the same long delay, but with added keyups, to avoid causing repeats. |
The code indeed does what you describe -- it takes the delay and splits it evenly between the up and down strokes: Lines 989 to 992 in 7b63eb4
I agree this behavior is not desirable. I think we can change xdotool to keep it from causing key repeats by changing the code to be a bit wiser -- reducing the delay used in the "down" event and spending most of the time waiting after the "up" I'll see about making this change soon and let you know if it's available to test :) |
Good to have those changes. But be sure to expose the raw controls too in case some users need finer grained control. |
It's nice to know what it's doing. Predictable is better than unknown. Better still is configurable. Changing to a fixed 50ms delay or whatever is actually probably not good. Right now, we can at least adjust the "key down" time, but with a fixed key down time, it will no longer be adjustable. While you're there, maybe a "dwell time ratio" setting would be good? So the current behavior could be preserved by specifying a "dwell time ratio" of |
Just to add some context: My usecase is to type up daily update messages to my colleagues in Slack. It's a local-running application, but heavily web-based which means it's SLOOWWW. The pattern is: CTRL+ In this case, I would probably use an absolute dwell time of maybe 50 ms even if the I'm assuming everyone found this ticket because his own usecase also exposes it in some way. |
Wow, with all controls exposed, any "are you a human" typing test can be beat! Wait... #443 . |
So just to be clear, as it currently stands there is no way for me to for example wait 5 seconds and then send key a down, key a up could we get another delay modifier like --sleep or --wait that simply passes some time before sending the keystrokes? In case it is relevant my actual use case is: send alt key down, then press tab key, wait 3 seconds then send alt key up I want this for a mouse button so I can alt-tab through applications with the mouse. The idea was that if I press the button again within 3 seconds I can alt-tab not to the last application that had focus but the one before it. 3 seconds should be enough to quickly switch among a set of 4-5 applications |
Maybe not in one sleep 5;
xdotool keydown a keyup a || exit; |
[#423] Update xdo.c to use a 50ms dwell time
#471 is merged which should help with this issue (character repetition when delay is large). It solves this by having xdotool hold the "key down" event for 50ms before releasing each key. The delay now affects only the time between each keystroke (down + up) |
@limitedAtonement I wonder if #471 affects you. The change in #471 only changes how the |
@Dunkhan Try this:
Keep in mind that the "Tab" key will still be pressed when xdotool ends. If you'd rather "Alt+Tab" be held together for 3 seconds and then released, you can do this:
|
Thank you for taking note. I worked around my problem by incorporating calls to
Hmm, I would think making the |
On my system today the repeating starts at around 996 ms.
for i in 980 990 998; do xdotool type --delay $i $i.; done
980.990.999988..
Even scarier is when one tries e.g., --delay 4000...
Also key --delay has similar problems.
xdotool version 3.20160805.1
The text was updated successfully, but these errors were encountered: