summary refs log tree commit diff
path: root/.config/waybar/module-calendar.sh
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2026-04-08 13:11:48 +0900
committerRobert Günzler <r@gnzler.io>2026-04-08 13:11:48 +0900
commitd4620f3ac119263fee90bd819eadaf84fc8d50b7 (patch)
treef5268e72a1c0037d29acac699e5d3f4c37be0e6b /.config/waybar/module-calendar.sh
parent8afe3fa8d88ae56e96f65897935ef508581ac5f7 (diff)
*
Automated-commit-by: dots
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
-rwxr-xr-x.config/waybar/module-calendar.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/.config/waybar/module-calendar.sh b/.config/waybar/module-calendar.sh
new file mode 100755
index 0000000..6b20e2f
--- /dev/null
+++ b/.config/waybar/module-calendar.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -eu
+[ -n "${DEBUG:-}" ] && set -x
+
+shopt -s extglob
+
+update() {
+	local today tn
+	local text
+
+	# get events
+	today=$(~/src/calsync/ics2calendartxt ~/calendars/**/**/* 2>/dev/null |
+		grep -I "$(date -I)")
+	[ -z "$today" ] && return
+
+	tn=$(wc -l <<<"$today")
+
+	# 	text="$today"
+	# 	text="${text##"$(date +'%Y-%m-%d w%V %a ')"}"
+	# 	text="${text##+([^ ]) }"
+
+	text="󰃭 $tn"
+
+	jq -nrc '{text:$text,tooltip:$tip}' \
+		--arg tip "$today" \
+		--arg text "$text"
+}
+
+update || echo '{}'