Created
May 23, 2014 19:04
-
-
Save tjluoma/c1935dc892c23537d1b5 to your computer and use it in GitHub Desktop.
when Caffeine is launched, is it active or not? if active, report the default duration.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh -f | |
# Check Caffeine’s Status on Launch | |
# | |
# From: Timothy J. Luoma | |
# Mail: luomat at gmail dot com | |
# Date: 2014-05-23 | |
NAME="$0:t:r" | |
# 1 = yes | |
# 0 = no | |
ACTIVATE_ON_LAUNCH=`defaults read com.lightheadsw.caffeine.plist ActivateOnLaunch` | |
if [ "$ACTIVATE_ON_LAUNCH" = "0" ] | |
then | |
#### | |
growlnotify --appIcon 'Caffeine' --identifier 'CaffeineStatus' --message "set Activate on Launch to change behavior" \ | |
--title 'Caffeine.app running, | |
but inactive' | |
#### | |
else | |
DURATION=`defaults read com.lightheadsw.caffeine.plist DefaultDuration` | |
if [ "$DURATION" = "0" ] | |
then | |
DURATION='Will run until quit' | |
else | |
DURATION="$HOST will remain on for $DURATION minutes" | |
fi | |
growlnotify --appIcon 'Caffeine' --identifier 'CaffeineStatus' --message "$DURATION" --title 'Caffeine Now On' | |
fi | |
exit | |
# | |
#EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment