calendario.sh

In the HowTo’s & T&T’s Section: T&T-1: Spacing I showed you two lines that put a calendar into my conky that uses the calendario.sh script.

calendar1

Those lines:

1
2
${font LCDMono:size=19}${color2}${pre_exec ~/Conky/scripts/calendario.sh semana}
${color 888888}${pre_exec ~/Conky/scripts/calendario.sh pasado}${color2}${pre_exec ~/Conky/scripts/calendario.sh hoy}${color 888888}${pre_exec ~/Conky/scripts/calendario.sh futuro}${font}

And the calendario.sh script that they use:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/sh
# written by: jjgomera
 
#str=`echo '\033[01;32m29'`
 
# replace the 4 "cal |" with "cal -m |" to have the week start on Monday
 
DATE=`date | awk -F" " '{print $3}'`
 
case "$1" in
mes)
cal | head -n1
;;
semana)
cal | head -n2 | tail -n1
;;
pasado)
cal | grep -v '[a-zA-Z]' | grep '[0-9]' | awk -F$DATE ' BEGIN {i=0}
($1 == $0 && i==0) {print $1}($1 != $0 && i==0){i=i+1;print $1}';
;;
hoy)
echo $DATE;
;;
futuro)
cal | grep -v '[a-zA-Z]' | grep '[0-9]' | awk -F$DATE ' BEGIN {i=1}
(i==0) {print $0}($1 != $0 && i==1){i=i-1;print $2}';
;;
esac

Now make that “executable” and conky can use it.

Happy conkying.
Bruce & uncertain

OPTION #2

Crinos512
April 26th, 2009 at 06:29

That whole script can be replaced with:

1
${color 888888}${font LCDMono:bold:size=12}${execpi 60 DJS=`date +%_d`; cal | sed '1d' | sed '/./!d' | sed 's/$/                     /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/${alignc} /' | sed /" $DJS "/s/" $DJS "/" "'${color2}'"$DJS"'${color 888888}'" "/}

I can’t claim to have crafted that code, but I wish I could. :D

OK, and it looks like:

1-liner

Comments are closed.