Skip to content

Instantly share code, notes, and snippets.

@michaello
Created May 15, 2020 17:38
Show Gist options
  • Save michaello/b2e8c133cf27db768edb711ac569c587 to your computer and use it in GitHub Desktop.
Save michaello/b2e8c133cf27db768edb711ac569c587 to your computer and use it in GitHub Desktop.
I HATE WHEN SIMULATOR BECOMES ACTIVE AFTER BUILD
#!/bin/bash
osascript <<EOD
set start_time to do shell script "ruby -e 'print Time.now.to_i'"
repeat while true
tell application "System Events"
set activeApp to name of application processes whose frontmost is true
if activeApp is not "Xcode" then
tell process "Xcode"
set frontmost to true
end tell
end if
end tell
set end_time to do shell script "ruby -e 'print Time.now.to_i'"
if end_time - start_time > 10 then
exit repeat
end if
end repeat
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment