Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Monday, March 9, 2009

How to add calendar in conky (Linux)

Simply edit your .conkyrc file and add the following line:
${font DejaVu Sans Mono :size=8}${exec cal -m | cut -c23-44 --complement}

Some explanation:
The Font - Yep, you have to use that font, otherwise it wont come out right.
"cal -m" - If you want Sunday to be the first day of the week simply remove the -m.

If you are having any problems, please post in the comment field (no registration required and I will try to help you out).


UPDATE (Debian Users):
Unfortunately "cal" doesn't support weeks starting with monday anymore. The fix:
apt-get install gcal
New line for conkyrc;
${font DejaVu Sans Mono :size=8}${exec gcal --starting-day=monday | cut -c23-44 --complement}


  1. Is there a way that it marks the current day somehow?

  2. THANK YOU for the calender script! It works brilliantly! Two question for you?
    1.How can I change the colour of the calender text to match the rest of my Conky?
    2.How do I center the calender to the center of the conky?

    Your help is appreciated.


  3. Anonymous: There's always a way, but I dont know of any. Conky gets the whole calendar from the cal function in bash. Open xterm for example and type "cal", and check the output. In xterm it automaticly marks the current day, but I dont know how to "convert" the color over to conky.

    defiant: No problem!
    1.) You can either use default colors, by setting these in conkyrc. From my .conkyrc:
    default_color white
    Or you can set the color for different parts:
    ${color slate grey} this will be gray text ${color}
    User the ending ${color} to end the color field (somehow like /font> in html if you know.

    2.) I dont know how to do it. Best I think is to position it as the rest. If you send me your e-mail I can send you my .conkyrc

  4. this code marks the current day:
    ${execpi 60 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color #b7d1ea}'"$DJS"'${color}'" "/} --juanmamp

    (#b7d1ea, for instance)

  5. 2.How do I center the calender to the center of the conky

    I use this to make offset:

    ${offset 50}${font DejaVu Sans Mono:size=11}${exec cal -m | cut -c23-44 --complement}

  6. Yea, now I'm just confused. But either way, I have this code

    "${execpi 60 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color #b7d1ea}'"$DJS"'${color 0077ff}'" "/}"

    Now, I'm wondering how to increase the size of the fonts.

  7. This will work best i have found.

    "${color d7d7d7}${font Ubuntu:style=Bold:size=10}${execpi 60 VinDSL_Cal_8=`date +%-d`; cal -h | sed -e '1d' -e 's/\<'"$VinDSL_Cal_8"'\>/${color cc0000}&${color d7d7d7}/' -e 's/^/${offset 30}/'}"

  8. How can you get the name of the month along with the highlighted date?

  9. This works for me...

    ${font courier:size=17:style=bold}${execpi 90 DJS=`date +%_d`; cal | sed s/"\(^\
    |[^0-9]\)$DJS"'\b'/'\1${color green}'"$DJS"'$color'/ }$font