Two-line calendar (en)
From Conky PitStop
Two-line calendar
Language | English Français |
Here is a two line calendar with the day names shortened to 2 characters and the month & year in the middle with the calendar underneath.
The top one shows a calendar with Sunday as the first day of the week, the second is with Monday as the First day of the week. (NOTE: A Monday start doesn't work with newer versions of "cal")
TEXT ${goto 15}${font LCDMono:bold:size=17}${color2}SU MO ${color}${time %b %y}${color2} FR SA ${voffset 5}${color4}${execpi 60 DJS=`date +%_d`; cal | sed '2d' | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${goto 0} /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color4}'" "/} ${goto 15}${font LCDMono:bold:size=17}${color2}MO TU ${color}${time %b %y}${color2} SA SU ${voffset 5}${color4}${execpi 60 DJS=`date +%_d`; cal -m | sed '2d' | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${goto 0} /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color4}'" "/}
Notice the
; cal -m |
in line 7 of the code above to change the calendar to start on Monday, well that doesn't work with the "new" cal command.
However:
ncal -M
does work, you may not like the results though:
21:20 ~ $ ncal -M September 2010 Mo 6 13 20 27 Tu 7 14 21 28 We 1 8 15 22 29 Th 2 9 16 23 30 Fr 3 10 17 24 Sa 4 11 18 25 Su 5 12 19 26
Strange thing is when you check the "man page" for "cal " it's still there:
Now comes the tricky part, putting it somewhere in a working conky.
Two lines need to be treated differently, but put the actual calendar line directly under the day-month line and it falls into place:
${goto 162}${voffset -28}${font LCDMono:bold:size=17}${color2}SU MO ${color}${time %b %y}${color2} FR SA ${voffset 5}${color4}${execpi 60 DJS=`date +%_d`; cal -m | sed '2d' | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${goto 150} /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color4}'" "/}
Why the two goto commands are different I’m not sure, it’s all the same font but it does work.