I'm trying to make a script like the following:
st -n dropdown &
pid=$(xdotool search --classname dropdown)
st
is a terminal emulator
I'm trying to run some commands on the created st using xdotool. Unfortunately the commands after st -n dropdown &
are run before the actual st terminal starts up so there is no pid. I can always just put sleep 0.1
after but there are instances (on older machines for example) where it will take longer than 0.1 seconds for the terminal to start. Is there a way to wait for the terminal to start before executing the rest of the script?
The wait
command doesn't work because it waits for the process to finish, which in the case of st
is when it is killed which is not what I want.