diff options
Diffstat (limited to 'dotfiles/.config/calcurse/hooks/pre-load')
-rwxr-xr-x | dotfiles/.config/calcurse/hooks/pre-load | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/dotfiles/.config/calcurse/hooks/pre-load b/dotfiles/.config/calcurse/hooks/pre-load new file mode 100755 index 0000000..577736f --- /dev/null +++ b/dotfiles/.config/calcurse/hooks/pre-load @@ -0,0 +1,25 @@ +#!/bin/sh +# +# This is an example hook. It synchronizes calcurse with a CalDAV server before +# loading the data files. +# +# In order to install this hook, copy this file to +# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or +# ~/.calcurse/hooks/ if using ~/.calcurse. + +[ -d "$HOME/.calcurse" ] && data_dir="$HOME/.calcurse" || data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse" + +cd "$data_dir" || exit + +# Do not do anything when synchronizing with a CalDAV server. +[ -f caldav/lock ] && exit + +# Run the CalDAV synchronization script. +if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then + ( + date="$(date +'%b %d %H:%M:%S')" + echo "$date Running calcurse-caldav from the pre-load hook..." + calcurse-caldav + echo + ) >>caldav/log 2>&1 +fi |