From 3283cd6e1f1e1e93192d7cb649ea16332afa0844 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 26 Nov 2012 14:05:11 +0100 Subject: clock.sh: fix highlight of multiple holidays in one line --- bin/clock.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'bin/clock.sh') diff --git a/bin/clock.sh b/bin/clock.sh index 3c67a8e..0a36087 100644 --- a/bin/clock.sh +++ b/bin/clock.sh @@ -17,9 +17,34 @@ do echo "^cs()" if hash gcal 2>/dev/null; then echo - gcal --cc-holidays=DE_BE --starting-day=Mon "${MONTH}" | sed "s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /;s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg() /;/^[ \t]*$/d" + gcal --cc-holidays=DE_BE --starting-day=Mon "${MONTH}" | sed "\ + # highlight current day + s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /; \ + + # hightlight holiday + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + + # remove leftover holiday marker + s/:\(\( \|[0-9]\)[0-9]\)/ \1/g; \ + + # remove empty lines + /^[ \t]*$/d" + echo " " - gcal --cc-holidays=DE_BE --starting-day=Mon "$((($MONTH % 12) +1))" "$YEAR" | sed "s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /;s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg() /;/^[ \t]*$/d" + gcal --cc-holidays=DE_BE --starting-day=Mon "$((($MONTH % 12) +1))" "$YEAR" | sed "\ + # highlight current day + s/<\(\( \|[0-9]\)[0-9]\)>/ ^fg(#ff0000)\1^fg() /; \ + + # hightlight holiday + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + s/:\(\( \|[0-9]\)[0-9]\):/ ^fg(#ffff00)\1^fg():/g; \ + + # remove leftover holiday marker + s/:\(\( \|[0-9]\)[0-9]\)/ \1/g; \ + + # remove empty lines + /^[ \t]*$/d" else echo cal -m ${MONTH} | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/" -- cgit v1.2.3