aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-18 15:29:35 +0200
committerDanilo M. <danix@danix.xyz>2026-10-18 15:29:35 +0200
commit48fa63ff5d0e12edf86db7f01def635aa0aaa9fb (patch)
tree28bdd13bf12cf51464b01975ee4e9eef08596f85 /bin
parente81d0c6f7e975b1b98f1adf84299ba921093d100 (diff)
downloadconky-theme-udt-48fa63ff5d0e12edf86db7f01def635aa0aaa9fb.tar.gz
conky-theme-udt-48fa63ff5d0e12edf86db7f01def635aa0aaa9fb.zip
fix(calendar): mark events past this week on the month grid
The sampler asked khal for 8 days only, so the grid never coloured an event later in the month. Sample through the month's end instead, and cut the event table back to the coming week with calendar_upcoming(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/calendar-sample.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/calendar-sample.sh b/bin/calendar-sample.sh
index af583f6..a0fb87e 100755
--- a/bin/calendar-sample.sh
+++ b/bin/calendar-sample.sh
@@ -45,9 +45,17 @@ trap 'rm -f "$TMP"' EXIT
# 8d, not 7d: khal's range is exclusive of the final day in practice for
# all-day events, and one extra day costs nothing but avoids a birthday
# vanishing from the card on the morning it matters.
+#
+# The range runs to the end of the month when that is further out, because
+# the month grid colours every day with an event, not just this week's. The
+# widget cuts the event table back to the 8 days itself. khal's Nd covers day
+# offsets 0..N-1, so the month's last day needs last - today + 1.
+LAST=$(date -d "$(date +%Y-%m-01) +1 month -1 day" +%-d)
+DAYS=$(( LAST - $(date +%-d) + 1 ))
+[ "$DAYS" -lt 8 ] && DAYS=8
EVENTS=$(khal list --day-format '' \
--format '{start-date-long}|{start-time}|{end-time}|{calendar}|{title}' \
- --notstarted today 8d 2>/dev/null)
+ --notstarted today "${DAYS}d" 2>/dev/null)
# khal's exit status is 0 even with no calendars configured, so emptiness is
# not distinguishable from failure by status alone. The widget treats a missing