Skip to content

Instantly share code, notes, and snippets.

@r3nya
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r3nya/9457f58a99f4fdd08346 to your computer and use it in GitHub Desktop.
Save r3nya/9457f58a99f4fdd08346 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
tweetbot_running() {
ps x | grep -v grep | grep Tweetbot > /dev/null
}
clean_tweetbot_cache() {
rm -rf ~/Library/Containers/com.tapbots.TweetbotMac/Data/Library/Caches/com.tapbots.TweetbotMac
}
tell_tweetbot_to() {
osascript -e "tell application \"Tweetbot\" to $1"
}
quit_tweetbot() {
tell_tweetbot_to quit
while tweetbot_running ; do
sleep 0.001
done
}
start_tweetbot() {
tell_tweetbot_to activate
}
if tweetbot_running ; then
quit_tweetbot
clean_tweetbot_cache
start_tweetbot
else
clean_tweetbot_cache
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment