Ubuntu – Xdotool commands run one by one

bashxdotool

I have this bash script:

#!/bin/bash

function foo() {
  terminator
  xdotool type 'myalias'
  xdotool key Return
  xdotool key ctrl+shift+t
  xdotool type 'cd ~/git/apps/myapp/client && gulp'
  xdotool key Return
}

foo

I run this script from a key shortcut.

It opens the terminal, but only executes the following commands after I close the terminal

Any idea around this?

Best Answer

The commands after terminator will not execute until terminator exits, so you will have to send it to the background:

terminator &

This will allow the script to continue with the other steps immediately after starting terminator (which may be too soon), so try:

...
terminator &
sleep 3
xdotool type 'myalias'
...
Related Question