Your script IS working - the only problem is - at startup it will only run once. And if the popup is not present when it is auto-ran - your script will have no effect, because it has nothing to act upon.No, it is a popup caused by indicator applet complete has quit unexpectedly.
I am using Ubuntu Mate 18.04.
This works with run from cli, but not when added to my Startup Applications.
# Automatically close that popup windows that occurs with every boot up
# xdotool selectwindow This determines the window id or 2nd method
# xdotool search --name "Error"
id=$(xdotool search --name "Error")
xdotool key --window $id alt+F4
#!/usr/bin/env bash # Periodically check for the existence # of an "Error" window # and kill it if it exists while true do id=$(xdotool search --name "Error") if [ "$id" ]; then xdotool key --window "$id" alt+F4 # uncomment the line below if the window only pops up once #exit fi id="" # reset id to blank # Sleep the thread for a while # Use whatever period you feel is required sleep 60s done