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 # Don't show reminders when ~/.hushlogin exists ...
11 [[ -r ~/.hushlogin ]] && return 0
13 # Check if reminders have been shown during last 60 minutes, and if so,
14 # don't show them now but return.
15 [[ -z `find "$XDG_CACHE_HOME/axzsh_last_reminder" -mmin -60 2>/dev/null` ]] || return 0
17 tmpfile=$(mktemp ${TMPDIR:-/tmp}/icalbuddy.XXXXXX) || return 1
19 if [[ "$LANG" =~ "\.UTF" ]]; then
20 bul="•"; bul_imp="!"; sep="»"
22 bul="*"; bul_imp="!"; sep=">"
26 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
27 -nc -npn -iep "title,due" -stda \
28 tasksDueBefore:today 2>/dev/null >>"$tmpfile"
29 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
30 -nc -npn -iep "title,datetime" \
31 eventsToday+1 2>/dev/null >>"$tmpfile"
33 if [[ -s "$tmpfile" ]]; then
38 unset bul bul_imp sep tmpfile
41 [[ -w ~/ ]] && touch "$XDG_CACHE_HOME/axzsh_last_reminder"