``` res=$(osascript -e 'tell application "System Events" to get name of application processes whose frontmost is true and visible is true'); if [ $res == "Kim" ] then osascript -e 'tell application "System Events" to set visible of process "Kim" to false'" else open -a 'Kim.app' fi ``` I did it like this, it works but excutes very slow, how to optimize this?