Bug: "xdotool key" and keyboard rate setting

336 views
Skip to first unread message

Nazri Ramliy

unread,
Jun 2, 2010, 1:15:57 AM6/2/10
to xdotool-users
It seems like the latest xdotool is sensitive to my keyboard rate
setting (set via gnome-keyboard-properties).

I set my keyboard repeat delay to a very short value, and a the
repetition speed to be high.

To reproduce the bug please run the following shell script. You'll need
the following versions of xdotool and also zenity and xtoolwait
installed to see the bug in action:

xdotool-20090710 (no bug)
xdotool-2.20100601.2912 (buggy)
xdotool-2.20100524.2886 (buggy)

--->8---
#!/bin/sh
dir="$HOME/src/xdotool-20090710
$HOME/src/xdotool-2.20100601.2912
$HOME/src/xdotool-2.20100524.2886"

for d in $dir; do
xtoolwait zenity --text "$d" --scale
if [ -f $d/libxdo.so ]; then
export LD_LIBRARY_PATH=$d
else
export LD_LIBRARY_PATH=
fi
ldd $d/xdotool|grep libxdo
for i in 1 2 3;do
$d/xdotool key Right
done
done
---8<---

The scrollbar in zenity scrolled for different amount for each of the
three versions of xdotool above.

The "ldd $d/xdotool" is there just to verify that xdotool is using its
corresponding libxdo.

nazri.

Jordan Sissel

unread,
Jun 2, 2010, 3:29:59 AM6/2/10
to ayie...@gmail.com, xdotool-users

Hey hey.

First, thanks for the great details :)

I wonder if this is related to some delay features I've added to a few commands.

In 20090710, the delay between keystrokes is set to 0ms. In recent
versions (since at least svn r2888 / 2010-05-24, but possibly
earlier), the delay is 12ms by default, which is 12ms between key
actions (both up and down), so 'xdotool key Return' could take 24ms
(12ms delay after the "Return" down, etc...).

Could you try using xdotool key --delay with small value, even 0 is fine:
% xdotool key --delay 0 Right

The above should mimic similar behavior, timing-wise, as 20090710.

Let me know if this helps or not and I'll continue digging some more.

-Jordan

Jordan Sissel

unread,
Jun 2, 2010, 3:36:28 AM6/2/10
to ayie...@gmail.com, xdotool-users

I did some testing, set repeat delay to 10ms, rate 50..

% xset r rate 10 50
% xdotool key A
# I see some key repeats and actually seems like shift gets missed sometimes.

% xdotool key --delay 0 A
# this seems to work for me.

-Jordan

Nazri Ramliy

unread,
Jun 2, 2010, 5:48:34 AM6/2/10
to Jordan Sissel, xdotool-users
On Wed, Jun 2, 2010 at 3:36 PM, Jordan Sissel <j...@semicomplete.com> wrote:
>> First, thanks for the great details :)

Coming up with the script was fun!

> I did some testing, set repeat delay to 10ms, rate 50..
>
> % xset r rate 10 50
> % xdotool key A
> # I see some key repeats and actually seems like shift gets missed sometimes.
>
> % xdotool key --delay 0 A
> # this seems to work for me.

I modified the script to add the delay option, and the result
is still the same:

$ xset r rate 10 50; sh bug2.sh ; xset r rate 250

version scroll stops at
xdotool-20090710 4
xdotool-2.20100601.2912 45
xdotool-2.20100524.2886 45

bug2.sh:
---->8----


#!/bin/sh
dir="$HOME/src/xdotool-20090710
$HOME/src/xdotool-2.20100601.2912
$HOME/src/xdotool-2.20100524.2886"

n=1


for d in $dir; do
xtoolwait zenity --text "$d" --scale
if [ -f $d/libxdo.so ]; then
export LD_LIBRARY_PATH=$d
else
export LD_LIBRARY_PATH=
fi
ldd $d/xdotool|grep libxdo

if [ $n -eq 1 ]; then
delay=
else
delay='--delay 0'
fi


for i in 1 2 3;do

$d/xdotool $delay key Right
done
done
----8<----

nazri

Nazri Ramliy

unread,
Jun 2, 2010, 5:55:07 AM6/2/10
to Jordan Sissel, xdotool-users
On Wed, Jun 2, 2010 at 5:48 PM, Nazri Ramliy <ayie...@gmail.com> wrote:
> I modified the script to add the delay option, and the result
> is still the same:

It turned out that my script was buggy too :), it didn't pass the --delay
option correctly.

Here's the correct version, followed by the result:

$ xset r rate 10 50; sh bug2.sh ; xset r rate 250

version scroll stops at
xdotool-20090710 3
xdotool-2.20100601.2912 30
xdotool-2.20100524.2886 0 (key don't do --delay in this version)

bug2.sh (fixed):


---->8----
#!/bin/sh
dir="$HOME/src/xdotool-20090710
$HOME/src/xdotool-2.20100601.2912
$HOME/src/xdotool-2.20100524.2886"

n=1
for d in $dir; do
xtoolwait zenity --text "$d" --scale
if [ -f $d/libxdo.so ]; then
export LD_LIBRARY_PATH=$d
else
export LD_LIBRARY_PATH=
fi
ldd $d/xdotool|grep libxdo

if [ $n -eq 1 ]; then
delay=
else
delay='--delay 0'
fi
for i in 1 2 3;do

$d/xdotool key $delay Right
done
n=$(($n + 1))
done
----8<----

nazri

Reply all
Reply to author
Forward
0 new messages