aboutsummaryrefslogtreecommitdiff
path: root/dotfiles
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2026-01-18 19:23:09 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2026-01-18 19:23:09 +0300
commitceb30a50c805e37d563365f8d2492d96ba28d2c7 (patch)
tree000402be8cc102b10dcb183848d355d7d482fbc9 /dotfiles
parent3275785c38c3c960c6f4ae6dbf788a5157616eb9 (diff)
downloadswayrice-ceb30a50c805e37d563365f8d2492d96ba28d2c7.tar.gz
swayrice-ceb30a50c805e37d563365f8d2492d96ba28d2c7.zip
calcurse: calendar sync notificationsniri
So that I can notice when something went wrong. Also added a timeout.
Diffstat (limited to 'dotfiles')
-rwxr-xr-xdotfiles/.config/calcurse/hooks/post-save19
-rwxr-xr-xdotfiles/.config/calcurse/hooks/pre-load18
2 files changed, 20 insertions, 17 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
diff --git a/dotfiles/.config/calcurse/hooks/pre-load b/dotfiles/.config/calcurse/hooks/pre-load
index d2f367f..20787fe 100755
--- a/dotfiles/.config/calcurse/hooks/pre-load
+++ b/dotfiles/.config/calcurse/hooks/pre-load
@@ -1,11 +1,4 @@
#!/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"
@@ -18,8 +11,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" "Loading and syncing with caldav server..."
echo "$date Running calcurse-caldav from the pre-load 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 synced"
+ fi
echo
rm caldav/lock
) >>caldav/log 2>&1