summary refs log tree commit diff
path: root/.config/waybar/module-calendar.sh
blob: f779a5c02251119102b5bddbe6f5bab2766982af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -eu
[ -n "${DEBUG:-}" ] && set -x

shopt -s extglob

update() {
	local events tn
	local text

	# get events
	events=$(env COLOR=never cdar 2>/dev/null)
	[ -z "$events" ] && return

	tn=$(wc -l <<<"$events")

	# 	text="$today"
	# 	text="${text##"$(date +'%Y-%m-%d w%V %a ')"}"
	# 	text="${text##+([^ ]) }"

	text="󰃭 $tn"

	jq -nrc '{text:$text,tooltip:$tip}' \
		--arg tip "$events" \
		--arg text "$text"
}

update || echo '{}'