Is there a way using command line to change the focus to a specific application? If so, do I need the process id or what?
My goal is to run a process that compiles files, and then focuses on the browser window once the files have finished compiling.
If I understand you correctly, this could be done quite easily with open -a
. Opening an already-open application brings it to the forefront. The -a
option allows you to specify the application you want, so pick your favorite:
open -a Google\ Chrome
open -a Safari
open -a Firefox
Another option is osascript -e 'activate application "Google Chrome"'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With