#!/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 '{}'