Last active
August 29, 2015 14:11
-
-
Save colby/7eab42879b6071a8dd07 to your computer and use it in GitHub Desktop.
Lunch time script and time tracker function
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/bash | |
# You need to enter your own Slack API token | |
API_TOKEN="<TOKEN>" | |
API_URL="https://slack.com/api/presence.set" | |
source "$HOME/.dotfiles/.conf.d/10-work_related" | |
now "Taking lunch break" | |
# Set Slack away if running | |
if pgrep Slack; then | |
curl --data "token=${API_TOKEN}&presence=away" ${API_URL} | |
fi | |
# Set adium away if running | |
if pgrep adium;then | |
osascript <<EOD | |
tell application "Adium" | |
go away with message "Taking my lunch break." | |
end tell | |
EOD | |
fi | |
# Start screensaver | |
osascript <<EOD | |
tell application "System Events" | |
start current screen saver | |
end tell | |
EOD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment