I'm using xdotool
to automate running commands, opening new tabs, etc.
The thing is when doing it on the current window, I've to specifically sleep for some time or use xdotool keyup Return
before doing anything or else xdotool
won't press the enter key.
kartik@kartikpc:~/junk/xdotool$ cat automate
#!/bin/bash
# Release the Return key
# xdotool keyup Return
# Or sleep 1
xdotool type --delay 1 --clearmodifiers "clear"
xdotool key --clearmodifiers Return
kartik@kartikpc:~/junk/xdotool$ source automate
clearkartik@kartik-lappy:~/junk/xdotool$ clear
What I've read from very few sources is
% sleep 1; xdotool type "$(printf "hello\nworld\n")" (the sleep is for letting me release my actual 'return' key before typing)
I understand that the 'return' key is pressed when I specifically invoke my script by pressing 'Enter' on the keyboard. But why isn't it released automatically?
Even when xdotool
is typing stuff using xdotool type
shouldn't the 'return' key release till that time, or every letter should have been going line after line, instead of coming on the same line