I used to have:
${execpi 3600 DJS=`date +%_d`; cal -m | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc} /' | sed /" $DJS "/s/" $DJS "/" "'${color FCAF3E}'"$DJS"'${color #e0e0e0}'" "/}
in my Conky. It shows as at the top of the following screenshot:
Recently, I decided to widen my Conky, so using cal -3s seems to be a better option. But as you can see the second one in above screenshot, it’s very hard to tell where today is in calendar. The Conky code:
${execi 3600 cal -3s}
I tried to use normal Un*x command-line tool (wasn’t trying very hard), but I came out with a Python script (it only took me a few minutes):
#!/usr/bin/env python import datetime import re import sys day = datetime.date.today().day RE = re.compile(r'\b%d\b' % day) for line in sys.stdin.readlines(): print line[:22] + RE.sub(r'${color red}%d$color' % day, line[22:42]) + line[42:],
It’s not Pythonism nor genius script, but, anyway, it serves the purpose. The Conky code:
$color${execpi 3600 cal -3s | ~/.conky/calhltoday.py}
Note
You may need to specify text_buffer_size 512, so the calendar wouldn’t be cut off due to small buffer size.
Is the python script entire? I tried a copy/paste but it seems that a part is missing.
ReplyDeleteIt is entire script. Were you running `cal -3s | ~/.conky/calhltoday.py` from shell for testing? What was the error message?
ReplyDeleteis siplest
ReplyDelete${execpi 3600 ccal -e -noc | sed 's//${color} /'}
What's this "ccal-e" command?
ReplyDelete