xdotool: typing transactionally

1

2

My overall goal is to get something like auto-hot-key for windows working for me.

I've tried a few different solutions (and I'm still open to retrying or trying new ones) and what I've settled on using now is xdotool and xmonad.

I have a command along the lines of xdotool getwindowfocus windowfocus --sync; xdotool type --delay 50 example@example.com.

If I type keystrokes while xdotool is typing this, they'll go in between the letters of what xdotool is typing. (the reason I have that delay in there is that the keystrokes sometimes get to the window out of order, otherwise).

What is the fastest way to send a sequence of uninterrupted keystrokes?

wafflecat

Posted 2015-09-11T14:55:42.310

Reputation: 125

Answers

2

A few options:

  • First put the entire text in clipboard (using xsel -i -b or xclip -in -sel clipboard), then paste it by sending a Ctrl+V (or Ctrl+Shift+V for terminals).

    (Shift+Ins would be compatible with more programs, although then you have to put the same text in the "primary" selection, in the "clipboard" selection for Firefox, and in the cutbuffers for some old xaw apps.)

  • Hack xdotool to set up a global keyboard grab via X11 while it is running; this will make all input go to xdotool until the grab is released.

    (Bonus points for making xdotool actually remember and replay the grabbed input, instead of merely discarding it.)

user1686

Posted 2015-09-11T14:55:42.310

Reputation: 283 655

You rock! Thanks! I'll also go look up global keyword grabs got any google searchable suggestions? – wafflecat – 2015-09-11T15:13:27.877