I've been using xdotool type
in the past only to type a shrugface on shortcut using xdotool type '¯\_(ツ)_/¯'
. That works, but always takes quite a long time and causes the entire desktop to freeze (entirely, not just input) for a few seconds. Didn't bother me much though.
Now I need a way to read things from a file, manipulate that, and type it out. I wanted to use xdotool for that task like this:
while read URL; do
xdotool type "!play $URL" && sleep 1 && xdotool key Return && sleep 1
done < <(mycommand)
The mycommand
put out around 20 lines of URLs. Once I ran the script my desktop (gnome3.26, archlinux) freezed entirely. I SSHd into the machine killing the bash process (successfully), but that didn't do anything to the frozen state. Ten minutes later it worked again, the command did run (as in, xdotool typed everything correctly as expected) but I had to restart the X server since my mouse wasn't working anymore.
I need a way to type automated like xdotool type
does but without this freezing behaviour. The best case would be a tool that types the whole text I pass pretty much instantly. I thought of a solution implementing xclip
and then just simulating the key presses for paste and enter, but I think there has to be a better solution.
This issue with xdotool
has been present for me for around two years now (always been on gnome + archlinux), until now I never needed it for more than a shrugface though. I'm guessing it's not just a bug in the version I use because of that. Just for completeness:
$ xdotool --version
xdotool version 3.20160805.1