]> arthur.barton.de Git - ax-zsh.git/blob - plugins/icalbuddy/icalbuddy.zshrc
dcc70c61f26a7b12f61ceed5d54b2324d53dee6b
[ax-zsh.git] / plugins / icalbuddy / icalbuddy.zshrc
1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # icalbuddy.zshrc: Show reminders using icalBuddy(1).
3
4 # Make sure that "icalBuddy(1)" is installed.
5 (( $+commands[icalBuddy] )) || return 1
6
7 # Check if reminders have been shown during last 60 minutes, and if so,
8 # don't show them now but return.
9 [[ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]] || return 0
10
11 tmpfile=$(mktemp ${TMPDIR:-/tmp}/icalbuddy.XXXXXX) || return 1
12
13 if axzsh_is_utf_terminal; then
14         bul="•"; bul_imp="!"; sep="»"
15 else
16         bul="*"; bul_imp="!"; sep=">"
17 fi
18
19 # Show reminders now.
20 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
21         -nc -npn -iep "title,due" -stda \
22         tasksDueBefore:today 2>/dev/null >>"$tmpfile"
23 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
24         -nc -npn -iep "title,datetime" \
25         eventsToday+1 2>/dev/null  >>"$tmpfile"
26
27 if [[ -s "$tmpfile" ]]; then
28         echo; cat "$tmpfile"; echo
29 fi
30
31 rm -f "$tmpfile"
32 unset bul bul_imp sep tmpfile
33
34 # Wtite "stamp" file.
35 [[ -w ~/ ]] && touch ~/.last_reminder