diff --git a/LaunchAgents/com.user.restart-browsers.plist b/LaunchAgents/com.user.restart-browsers.plist index 06aa9da..feee782 100644 --- a/LaunchAgents/com.user.restart-browsers.plist +++ b/LaunchAgents/com.user.restart-browsers.plist @@ -3,24 +3,63 @@ Label - com.user.homebrew-update + com.user.restart-browsers + ProgramArguments - /bin/bash - -c - export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && brew update && brew upgrade + /usr/bin/osascript + -e + repeat with appName in {"Google Chrome", "Vivaldi", "Floorp"} + -e + set appName to contents of appName + -e + if application appName is running then + -e + log "Restarting " & appName + -e + ignoring application responses + -e + tell application appName to quit + -e + end ignoring + -e + repeat 60 times + -e + if application appName is not running then exit repeat + -e + delay 1 + -e + end repeat + -e + if application appName is running then + -e + log appName & " did not quit within 60 seconds; leaving it open." + -e + else + -e + do shell script "open -g -a " & quoted form of appName + -e + end if + -e + end if + -e + end repeat StartCalendarInterval Hour - 0 + 1 Minute 0 StandardErrorPath - /tmp/com.user.homebrew-update.err + /tmp/com.user.restart-browsers.err StandardOutPath - /tmp/com.user.homebrew-update.out + /tmp/com.user.restart-browsers.out -