diff options
Diffstat (limited to 'dotfiles/.config/calcurse/hooks/post-save')
| -rwxr-xr-x | dotfiles/.config/calcurse/hooks/post-save | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/dotfiles/.config/calcurse/hooks/post-save b/dotfiles/.config/calcurse/hooks/post-save index ead4a47..d797649 100755 --- a/dotfiles/.config/calcurse/hooks/post-save +++ b/dotfiles/.config/calcurse/hooks/post-save @@ -1,12 +1,4 @@ #!/bin/sh -# -# This is an example hook. It does two things whenever you save the data files: -# -# Synchronize with a CalDAV server if calcurse-caldav is configured. -# -# In order to install this hook, copy this file to -# $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or -# ~/.calcurse/hooks/ if using ~/.calcurse. data_dir="$HOME/.calcurse" config_dir="$HOME/.calcurse" @@ -25,8 +17,17 @@ cd "$data_dir" || exit if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then ( date="$(date +'%b %d %H:%M:%S')" + notify-send "📅 Calcurse" "Saving and syncing with caldav server..." echo "$date Running calcurse-caldav from the post-save hook..." - calcurse-caldav + timeout 60 calcurse-caldav + rc=$? + if [ $rc -eq 124 ]; then + notify-send "📅 Calcurse" "❌ Syncing timed out" + elif [ $rc -gt 0 ]; then + notify-send "📅 Calcurse" "❌ Syncing failed (see logs)" + else + notify-send "📅 Calcurse" "Calendar saved and synced" + fi echo rm caldav/lock ) >>caldav/log 2>&1 |
