diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2012-11-26 14:05:11 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2012-11-26 14:05:42 +0100 |
commit | 3283cd6e1f1e1e93192d7cb649ea16332afa0844 (patch) | |
tree | f52b71430dee92f073916359a532903cbfb36a77 | |
parent | c570fdec56f6a4ad338fbc15dc41263e56f1b6a2 (diff) | |
download | dzen2-config-3283cd6e1f1e1e93192d7cb649ea16332afa0844.tar.gz dzen2-config-3283cd6e1f1e1e93192d7cb649ea16332afa0844.tar.xz dzen2-config-3283cd6e1f1e1e93192d7cb649ea16332afa0844.zip |
clock.sh: fix highlight of multiple holidays in one line
-rw-r--r-- | bin/clock.sh | 29 |
1 files changed, 27 insertions, 2 deletions
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/" |