11

Nothing too magic here, but as a new GT user I found samples from more experienced folks useful, so I wanted to share a sample of what fairly simple shell scripts can do. The screen shot is of the relevant part of my desktop. It shows me my events and ToDo's for today and tomorrow, along with a quick weather summary.

The dates are generated in turn by

date +"%b %d"

date -v+1d  +"%b %d"

As background, I've installed icalBuddy. I also use TaskPaper, which stores my todo list (named todo.txt) as a plain-text file. I use a set of Applescripts in TaskPaper to affix the @today, @tomorrow, and @overdue tags to individual tasks and the projects (e.g., Miscellaneous) to which they belong.

Today's calendar and tasks are generated by

/usr/local/bin/icalBuddy -ic Work, Personal -npn -n -eep url eventsToday; echo ""; echo "To Do"; echo ""; egrep "@today|@overdue" ~/Dropbox/todo.txt | sed '/@overdue/ s/$/, !!/g' | sed 's/@.* //g' | sed 's/@.*$//g'

For shell script novices (as I still am, so I'm sure this is ugly code in some ways), here's what each element does.

/usr/local/bin/icalBuddy -ic Work, Personal -npn -n -eep url eventsToday; runs icalBuddy to pull today's events that haven't yet occurred (the "-n" flag) from my Work and Personal calendars, removes property names (e.g., "Location"), and omits the URL field.

echo ""; echo "To Do"; echo ""; just creates the "To Do" header, with blank lines above and below.

egrep "@today|@overdue" ~/Dropbox/todo.txt retrieves lines containing @today or @overdue from my ToDo list.

This gets piped through sed '/@overdue/ s/$/, !!/g', which puts two exclamation points at the end of any line that is overdue. This is in turn piped through

sed 's/@.* //g' | sed 's/@.*$//g' which removes any tag (they all start with "@"). I used two sed commands (again, probably a better way to do it if I were competent) in order to pull tags in the middle or end of the line. For a quick heads-up display like this, they were clutter. For details I can open TaskPaper.

For the weather sticker, I've seen more elaborate ways of doing this, but I had luck just creating an image with the relevant part of the URl from Weather Underground, http://weathersticker.wunderground.com/weathersticker/cgi-bin/banner/ban/wxBanner?bannertype=wu_clean2day_cond&airportcode=XXX My location info XXX&language=EN


Comments

Log in to comment or register here.