diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2012-09-04 16:18:30 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2012-09-04 16:18:30 +0200 |
commit | 142dc77652bc04b08dac8f35b24949d4fe6a3823 (patch) | |
tree | c967cc98a36d5b9c38d6e86e48f5afdbe52ed17c /bin | |
parent | 6a6e58b50f13d337cf80351a74b494546f7cd72f (diff) | |
download | dzen2-config-142dc77652bc04b08dac8f35b24949d4fe6a3823.tar.gz dzen2-config-142dc77652bc04b08dac8f35b24949d4fe6a3823.tar.xz dzen2-config-142dc77652bc04b08dac8f35b24949d4fe6a3823.zip |
bin/clock.sh: use gcal if available
Diffstat (limited to 'bin')
-rw-r--r-- | bin/clock.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/clock.sh b/bin/clock.sh index 5b54a6a..3c67a8e 100644 --- a/bin/clock.sh +++ b/bin/clock.sh @@ -9,16 +9,23 @@ do if [ $TODAY -ne $OLD_TODAY ] then - MONTH=`date +'%m' | sed "s/^0//"` - YEAR=`date +'%Y'` + MONTH=$(date +'%_m') + YEAR=$(date +'%Y') [ $MONTH -eq 12 ] && YEAR=$(($YEAR + 1)) OLD_TODAY=$TODAY echo "^cs()" - echo - cal -m | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/" - echo " " - cal -m $((($MONTH % 12) +1)) $YEAR | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" + 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" + 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" + else + echo + cal -m ${MONTH} | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" | sed -u -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(#ff0000)\2^fg()\3/" + echo " " + cal -m $((($MONTH % 12) +1)) $YEAR | sed "s/$/ /;s/^\(.\{20\}\).*$/\1/" + fi fi sleep 1 |