diff options
Diffstat (limited to 'contrib/hooks/pre-load')
-rwxr-xr-x | contrib/hooks/pre-load | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/hooks/pre-load b/contrib/hooks/pre-load index c9ab62d..d69fbde 100755 --- a/contrib/hooks/pre-load +++ b/contrib/hooks/pre-load @@ -3,15 +3,19 @@ # 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 ~/.calcurse/hooks/. +# In order to install this hook, copy this file to +# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or +# ~/.calcurse/hooks/ if using ~/.calcurse. -cd "$HOME"/.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 in the background. -if [ -d caldav -a -x "$(which calcurse-caldav)" ]; then +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..." |