Last active
September 18, 2015 17:42
-
-
Save gojun077/3f3f7f486fcca2b79d62 to your computer and use it in GitHub Desktop.
Gist of script from https://github.com/gojun077/pomo2beeminder
This file contains hidden or 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 | |
#=========================================== | |
# pomo2beeminder.sh created 2015.01.25 | |
# https://github.com/gojun077/pomo2beeminder | |
# Jun Go [email protected] | |
#=========================================== | |
# This script is designed to be launched by xfce4-timer-plugin | |
# or pystopwatch after a 25-minute pomodoro timer completes. | |
# The user will be asked whether or not the pomodoro was completed | |
# successfully (without distractions). If the answer is 'y', the | |
# script will launch 'smtp-cli' which will send an email to the | |
# Beeminder bot to increment a Beeminder graph for a 'do more' | |
# goal named 'pomodoro' | |
# | |
# This script has been tested with smtp-cli 3.6 and 3.7 | |
# https://github.com/mludvig/smtp-cli (3.7) | |
# http://www.logix.cz/michal/devel/smtp-cli/ (3.6) | |
HOST=smtp.gmail.com | |
[email protected] | |
PW=$(<~/Documents/MyProjects/pomodoro/pass.txt) | |
[email protected] | |
[email protected] | |
SUBJ="gojun077/pomodoro" | |
ans=z #initialize variable 'ans' | |
while [[ "$ans" != "y" || "$ans" != "n" ]]; do | |
echo "Did you successfully complete your pomodoro?(y/n)" | |
read ans | |
case $ans in | |
"y") | |
if [ -f "/usr/bin/smtp-cli" ]; then | |
smtp-cli --verbose --host=$HOST --enable-auth --user=$USER --pass=$PW --from=$FROM --to=$TO --subject=$SUBJ --body-plain='^ 1 "sent by pomo2beeminder.sh"' --charset=UTF-8 | |
break | |
else | |
echo -e "Please install 'smtp-cli' package! Aborting.\n" 1>&2 | |
exit 1 | |
fi | |
;; | |
"n") | |
echo "Concentrate harder next time!" | |
break | |
;; | |
*) | |
echo "Please answer y or n" | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍