Skip to content

Instantly share code, notes, and snippets.

@punchagan
Created March 28, 2011 11:28
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 punchagan/890313 to your computer and use it in GitHub Desktop.
Save punchagan/890313 to your computer and use it in GitHub Desktop.
Update pidgin status message periodically with a countdown timer.
#!/bin/bash
upto=`date -d "Mar 30 14:30" +%s`
text="to go!"
while true; do
now=`date +%s`
count=`expr $upto - $now`
hours=`expr $count / 3600`
minutes=`expr $count % 3600 / 60`
if [ "$hours" -gt "0" ] ; then
if [ "$minutes" -gt "0" ] ; then
msg=$hours" Hour(s) "$minutes" Minute(s) ";
else
msg=$hours" Hour(s) ";
fi
else
msg=$minutes" Minute(s) ";
fi
status=$msg$text
echo $status
`purple-remote setstatus?message="$status"`
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment