#!/bin/sh # Waybar date module with two-month calendar tooltip DATE=$(date '+%a, %b %d %Y') TODAY=$(date '+%-d') MONTH=$(date '+%B %Y') # Generate current month (with today highlighted) stacked above next month NEXT_M=$(date -d 'next month' '+%-m') NEXT_Y=$(date -d 'next month' '+%Y') CUR=$(cal | sed "s/\b${TODAY}\b/${TODAY}<\/u><\/b><\/span>/") NEXT=$(cal "$NEXT_M" "$NEXT_Y") HIGHLIGHTED=$(printf '%s\n%s' "$CUR" "$NEXT") TOOLTIP="${HIGHLIGHTED}" # Escape for JSON TOOLTIP=$(echo "$TOOLTIP" | sed ':a;N;$!ba;s/\n/\\n/g') printf '{"text": "%s", "tooltip": "%s"}\n' "$DATE" "$TOOLTIP"