aboutsummaryrefslogtreecommitdiffstats
path: root/bin/calendar-sample.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-29 11:14:08 +0200
committerDanilo M. <danix@danix.xyz>2026-09-29 11:14:08 +0200
commit272c5732b0bc932749f0e771de51ee49f6cebe5b (patch)
tree95ed2d7c7b9f182f801ca55a31a9b7c740f4e914 /bin/calendar-sample.sh
parent4227577ec780b2fbc6863bb9fd3d9be4f46b0e9d (diff)
downloadconky-theme-udt-272c5732b0bc932749f0e771de51ee49f6cebe5b.tar.gz
conky-theme-udt-272c5732b0bc932749f0e771de51ee49f6cebe5b.zip
fix(calendar): drop the cache when khal is missing
With khal uninstalled the sampler still wrote a cache with a generated key and no events, because khal's stderr is discarded. The card then read "nothing this week" while an event was scheduled. Removing the cache instead shows the card's "no calendar data" face. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin/calendar-sample.sh')
-rwxr-xr-xbin/calendar-sample.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/calendar-sample.sh b/bin/calendar-sample.sh
index 1937cf6..af583f6 100755
--- a/bin/calendar-sample.sh
+++ b/bin/calendar-sample.sh
@@ -13,6 +13,14 @@ CACHE="$CACHE_DIR/calendar.txt"
umask 077
mkdir -p "$CACHE_DIR"
+# Without khal the list below fails silently (its stderr is discarded), and the
+# cache would claim an empty week. Removing the cache instead makes the card
+# show its "no calendar data" face, which is the truth.
+if ! command -v khal >/dev/null 2>&1; then
+ rm -f "$CACHE"
+ exit 1
+fi
+
TMP="$CACHE.tmp.$$"
trap 'rm -f "$TMP"' EXIT