xdotool type duplicates

136 views
Skip to first unread message

Jostein Berntsen

unread,
Sep 7, 2011, 11:37:06 AM9/7/11
to xdotoo...@googlegroups.com
If I run this code in a script it seems like the type command is run 2 or 3
times when I just want it once:

xdotool type "tnote -a"

Is there something I can do to avoid this?

Jostein


Jordan Sissel

unread,
Sep 7, 2011, 2:50:56 PM9/7/11
to jbe...@broadpark.no, xdotoo...@googlegroups.com
it doesn't type duplicates for me. What version are you running and on what platform?

You could try setting --delay to something so as to space the key stroke out a bit.

-Jordan




--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotoo...@googlegroups.com.
To unsubscribe from this group, send email to xdotool-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.


Jostein Berntsen

unread,
Sep 7, 2011, 3:06:05 PM9/7/11
to Jordan Sissel, xdotoo...@googlegroups.com
On 07.09.11,11:50, Jordan Sissel wrote:
> On Wed, Sep 7, 2011 at 8:37 AM, Jostein Berntsen <jbe...@broadpark.no>wrote:
>
> > If I run this code in a script it seems like the type command is run 2 or 3
> > times when I just want it once:
> >
> > xdotool type "tnote -a"
> >
> > Is there something I can do to avoid this?
> >
> > Jostein
> >
>
> it doesn't type duplicates for me. What version are you running and on what
> platform?
>
> You could try setting --delay to something so as to space the key stroke out
> a bit.
>

Setting "--delay 10" seems it worked somewhat better, but it still types the
tnote command twice:

tnote -ajostein@josteinb:~>
jostein@josteinb:~> tnote -a


Jostein


Jordan Sissel

unread,
Sep 7, 2011, 3:11:44 PM9/7/11
to Jostein Berntsen, xdotoo...@googlegroups.com
That's not twice. Explaining why this appears requires a bit of detail on how shells and terminals behave.

You can observe this yourself with normal keyboard typing by running this:

% sleep 5

And while sleep is running, type "hello world" in the same terminal. When sleep exits and returns you to your shell prompt, you will see something like this:

nightfall(~) % sleep 5
hello worldnightfall(~) % hello world

What is happening is you typing into the terminal while sleep runs (or xdotool), sleep doesn't read from stdin, so when the shell is given control again it reads your keystrokes (in the input buffer) and prints them on the screen showing you what you see above.

Hope this helps clarify things.

-Jordan
 


Jostein



Jostein Berntsen

unread,
Sep 7, 2011, 3:22:03 PM9/7/11
to Jordan Sissel, xdotoo...@googlegroups.com

Thanks! I will look into this. Is it better to use the delay or sync options
instead of sleep?


Jostein

Jordan Sissel

unread,
Sep 7, 2011, 3:35:24 PM9/7/11
to Jostein Berntsen, xdotoo...@googlegroups.com
I don't think I explained it well enough, sorry, hehe.

The 'double typing' you are observing is an artifact of how your shell and terminal behave. it is normal. It is not actually 'double typing'. You should not need to use delay in this case.

As far as I can tell from your output, everything is behaving the way it should (things only being typed once).

-Jordan


Jostein




Reply all
Reply to author
Forward
0 new messages