1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # icalbuddy.zshrc: Show reminders using icalBuddy(1).
4 # Make sure that "icalBuddy(1)" is installed.
5 (( $+commands[icalBuddy] )) || return 1
7 # Don't run this plugin on "check-plugins"!
8 [[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 0
10 # Check if reminders have been shown during last 60 minutes, and if so,
11 # don't show them now but return.
12 [[ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]] || return 0
14 tmpfile=$(mktemp ${TMPDIR:-/tmp}/icalbuddy.XXXXXX) || return 1
16 if axzsh_is_utf_terminal; then
17 bul="•"; bul_imp="!"; sep="»"
19 bul="*"; bul_imp="!"; sep=">"
23 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
24 -nc -npn -iep "title,due" -stda \
25 tasksDueBefore:today 2>/dev/null >>"$tmpfile"
26 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
27 -nc -npn -iep "title,datetime" \
28 eventsToday+1 2>/dev/null >>"$tmpfile"
30 if [[ -s "$tmpfile" ]]; then
31 echo; cat "$tmpfile"; echo
35 unset bul bul_imp sep tmpfile
38 [[ -w ~/ ]] && touch ~/.last_reminder