简体   繁体   中英

OSX Terminal - Change Application Focus

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

另一个选择是osascript -e 'activate application "Google Chrome"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM