ff865f602c33ac729a6ca25dc82856a046fe34a2
[OhMyZshExtensions.git] / plugins / reminders / reminders.plugin.zsh
1 # reminders.plugin.zsh
2 # 2015-03-27, alex@barton.de
3
4 # Show reminders (once every 60 minutes)
5 if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
6         if [ "$(type icalBuddy 2>/dev/null)" -a "$LOGNAME" != "root" ]; then
7                 # icalBuddy(1)
8                 case "$LANG" in
9                         *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
10                         *)      bul="*"; bul_imp="!"; sep=">"; ;;
11                 esac
12                 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
13                         -nc -npn -iep "title,due" -stda \
14                         tasksDueBefore:today 2>/dev/null
15                 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
16                         -nc -npn -iep "title,datetime" \
17                         eventsToday+1 2>/dev/null
18                 [ $? -eq 0 ] && echo
19                 unset bul bul_imp sep
20                 [ -w ~/ ] && touch ~/.last_reminder
21         else
22                 # remind(1)
23                 if [ "$(type remind 2>/dev/null)" -a -r ~/.remind ]; then
24                         remind -h -g -t5 ~/.remind | \
25                                 grep -v '^Reminders for ' | grep -v '^$'
26                         [ $? -eq 0 ] && echo
27                 fi
28                 [ -w ~/ ] && touch ~/.last_reminder
29         fi
30 fi