I have a simple shell/python script that opens up other windows. I'd like to bring the terminal where the script is running to the foreground when the script has finished.
I know the process ID of my parent window. How can I bring a given window to the foreground? I imagine I have to find out the window name from the PID along the way.
Not sure if there's a proper way, but this works for me:
You can do it with
osacript -e '...'
too.Obviously change the
350
to the pid you want.Thanks to Mark for his awesome answer! Expanding on that a little:
You can then run:
Quick test using:
And swap to something else. After 5 seconds the terminal running your script will be sent to the top.