You are not logged in.

#1 2009-11-12 21:19:36

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

[SOLVED] - Is this a conky calendar?

Hi,
Just noticed this screenshot: http://lifehacker.com/5393804/the-ultim … en-desktop

To the right there is a very cool calendar running, does anyone know if it's a conky configuration. I like it alot!
Some of the settings is listed there but don't seem to find anything about this calendar.

Last edited by ftornell (2009-11-14 20:06:19)


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#2 2009-11-12 21:21:05

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] - Is this a conky calendar?

Ummmmm......that would be a Windows screenshot smile

Offline

#3 2009-11-12 21:24:32

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

firecat53 wrote:

Ummmmm......that would be a Windows screenshot smile

Ahhhh, ok...you know if there is anyhing like that for conky then? Think it was a cool.


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#4 2009-11-13 10:35:42

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: [SOLVED] - Is this a conky calendar?

ftornell wrote:
firecat53 wrote:

Ummmmm......that would be a Windows screenshot smile

Ahhhh, ok...you know if there is anyhing like that for conky then? Think it was a cool.

That's easy.
Here is an example for the text part:
${color3} ${time %A,}
   ${time  %d. %B %Y}
${hr}
${exec cal}

The result is:
vMnJjdQ

Offline

#5 2009-11-13 10:41:08

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

Andrwe wrote:
ftornell wrote:
firecat53 wrote:

Ummmmm......that would be a Windows screenshot smile

Ahhhh, ok...you know if there is anyhing like that for conky then? Think it was a cool.

That's easy.
Here is an example for the text part:
${color3} ${time %A,}
   ${time  %d. %B %Y}
${hr}
${exec cal}

The result is:
http://omploader.org/vMnJjdQ

thx for the suggestion but i mean the layout aswell like on the right side of screen:
1
2
3
4
[5]
6
7
8
9
and so on...


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#6 2009-11-13 11:13:23

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: [SOLVED] - Is this a conky calendar?

Have a look at the bash script mentioned in the first post:
http://ubuntuforums.org/showthread.php?t=690753

Change the "second_part" a bit and you should be able to get such a layout.
Maybe I'll write a script later if you can't handle it.

Offline

#7 2009-11-13 11:53:32

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

Andrwe wrote:

Have a look at the bash script mentioned in the first post:
http://ubuntuforums.org/showthread.php?t=690753

Change the "second_part" a bit and you should be able to get such a layout.
Maybe I'll write a script later if you can't handle it.

I now have:

${color0}${execi 1 ~/calendar1.sh first_part}${color1}${execi 1 ~/calendar1.sh today }${color0}${execi 1 ~/calendar1.sh second_part}

Its looking like a square:
Su Mo Tu We Th Fr Sa
1  2  3  4  5  [6]  7
8 9...

Would like it to look like
1
2
3
4
5
[6]
7
8


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#8 2009-11-13 14:51:50

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: [SOLVED] - Is this a conky calendar?

Here is a script which converts the output of cal into a vertical or horizontal direction just call it with the direction as parameter.

#!/bin/bash

# Possible color code are:

# Color     Foreground     Background
# black         30                     40
# red             31                     41
# green         32                     42
# yellow         33                     43
# blue             34                     44
# magenta     35                     45
# cyan             36                     46
# white         37                     47

# For more information have a look at http://tldp.org/LDP/abs/html/colorizing.html#AEN19813

# Set default background color
DFT_BG='\E[40m'
# Set default foreground color
DFT_FG='\E[32m'
# Set color for today marking
THIS_DAY_COLOR='\E[47m'

TODAY_DAY=`date | awk -F" " '{print $2}' | sed 's/\.//'`

days=`cal | sed 's/[a-zA-Z]//g' | sed 's/\S\S\S\S//g'`

case "$1" in
    vertical)
        echo -e ${DFT_BG}${DFT_FG}
        for day in ${days}
        do
            [ ${day} -eq ${TODAY_DAY} ] && echo -e "${THIS_DAY_COLOR}${day}${DFT_BG}${DFT_FG}"
            [ ! ${day} -eq ${TODAY_DAY} ] && echo -e ${day}
        done
    ;;
    horizontal)
        echo -e ${DFT_BG}${DFT_FG}
        for day in ${days}
        do
            [ ${day} -eq ${TODAY_DAY} ] && month="${month} ${THIS_DAY_COLOR}${day}${DFT_BG}${DFT_FG}"
            [ ! ${day} -eq ${TODAY_DAY} ] && month="${month} ${day}"
        done
        echo -e ${month}
    ;;
esac

Offline

#9 2009-11-13 15:12:33

pseup
Member
Registered: 2008-06-06
Posts: 103

Re: [SOLVED] - Is this a conky calendar?

I think it's possible to reduce it to a few messy looking sed pipes and cal, but I'm not great with sed and can't remove a couple of extra newlines that appear, so went the script route instead.

#!/bin/sh

TODAY=`date +%e`
MONTHLENGTH=`cal | egrep -v '[A-Za-z]' | wc -w`

for i in $(seq 1 $MONTHLENGTH)
do
    if [ $i == $TODAY ]; then
        printf "\${color #e84448}%2d\${color}\n" $i
    else
        printf "%2d\n" $i
    fi
done

Probably makes more sense to just build the list of dates then do a sed operation to mark today's date instead of constant if/then/else checking for each day, but it works.

Offline

#10 2009-11-13 15:44:00

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

Re: [SOLVED] - Is this a conky calendar?

for the really short variant without any loops and ifs you could use something like this:

1 line vertical:

#!/bin/sh
cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/$(echo -en '\e[30;47m')$(date +%e)$(echo -en '\e[00m')/"

1 line horizontal:

#!/bin/sh
echo $(cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/$(echo -en '\e[30;47m')$(date +%e)$(echo -en '\e[00m')/" | tr '\n' ' ')

Last edited by seiichiro0185 (2009-11-13 16:24:04)


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#11 2009-11-13 15:55:22

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: [SOLVED] - Is this a conky calendar?

Now just for pseup my script without if/else/for:

#!/bin/bash

# Possible color code are:

# Color     Foreground     Background
# black         30                     40
# red             31                     41
# green         32                     42
# yellow         33                     43
# blue             34                     44
# magenta     35                     45
# cyan             36                     46
# white         37                     47

# For more information have a look at http://tldp.org/LDP/abs/html/colorizing.html#AEN19813

# Set default background color
DFT_BG='\E[40m'
# Set default foreground color
DFT_FG='\E[32m'
# Set color for today marking
THIS_DAY_COLOR='\E[47m'

TODAY_DAY=`date +%e`
days=`cal | sed 's/[a-zA-Z]//g;s/\S\S\S\S//g'`

case "$1" in
    vertical)
        echo -e "${DFT_BG}${DFT_FG}$(echo ${days} | sed s/${TODAY_DAY}/\\${THIS_DAY_COLOR}${TODAY_DAY}\\${DFT_BG}\\${DFT_FG}/g | sed 's/ /\n/g')"
    ;;
    horizontal)
        echo -e "${DFT_BG}${DFT_FG}$(echo ${days} | sed s/${TODAY_DAY}/\\${THIS_DAY_COLOR}${TODAY_DAY}\\${DFT_BG}\\${DFT_FG}/g)"
    ;;
esac

@seiichiro0185:
My script uses variables. tongue

Last edited by Andrwe (2009-11-13 15:56:52)

Offline

#12 2009-11-14 06:22:45

~/home/
Member
Registered: 2009-11-06
Posts: 3

Re: [SOLVED] - Is this a conky calendar?

${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 white}'" "/}${color white}

vMnJtdA

Offline

#13 2009-11-14 18:04:26

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

seiichiro0185 wrote:

for the really short variant without any loops and ifs you could use something like this:

1 line vertical:

#!/bin/sh
cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/$(echo -en '\e[30;47m')$(date +%e)$(echo -en '\e[00m')/"

1 line horizontal:

#!/bin/sh
echo $(cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/$(echo -en '\e[30;47m')$(date +%e)$(echo -en '\e[00m')/" | tr '\n' ' ')

Closest yet!

But something is wrong with the "today output".

1 2 3 4 5 6 7 8 9 10 11 12 13 >[30;47m14>[00m 15 16 17 18 19 ...

So the color or [ ] or whatefter that will hilight todays date is not working properly.


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#14 2009-11-14 18:16:07

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] - Is this a conky calendar?

you should execp the script from within conkyrc and replace the bash color definitions with conky ones.

#!/bin/sh
cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$\{color1\}&\$color/" | tr '\n' ' '
# conkyrc
color1 #f0f0f0

TEXT
${execp /path/to/above.sh}

note: untested.

also: FYI, don't use #!/bin/sh and $( ) in the same script.  #!/bin/bash and $( ) or #!/bin/sh and ` `.

Last edited by brisbin33 (2009-11-14 18:18:54)

Offline

#15 2009-11-14 18:21:16

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

brisbin33 wrote:

you should execp the script from within conkyrc and replace the bash color definitions with conky ones.

#!/bin/sh
cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$color1&\$color/" | tr '\n' ' '
# conkyrc
color1 #f0f0f0

TEXT
${execp /path/to/above.sh}

note: untested.

also: FYI, don't use #!/bin/sh and $( ) in the same script.  !/bin/bash and $( ) or #!/bin/sh and ` `.

hmm..

receive 12 13 $color114} 15 16...

.conkyrc

color1 1994d1

TEXT
${execp ~/calendar.sh}

calendar.sh

#!/bin/sh
cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$color1&\$color/" | tr '\n' ' '

[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#16 2009-11-14 18:24:33

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED] - Is this a conky calendar?

sorry bout that, caught a small mistake and edited my above post.

//blue/0/~/ cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$\{color1\}&\$color/" | tr '\n' ' '
1 2 3 4 5 6 7 8 9 10 11 12 13 ${color1}14$color 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3

that should get parsed correctly by conky recoloring the 14 to color1

Offline

#17 2009-11-14 18:32:31

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

brisbin33 wrote:

sorry bout that, caught a small mistake and edited my above post.

//blue/0/~/ cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$\{color1\}&\$color/" | tr '\n' ' '
1 2 3 4 5 6 7 8 9 10 11 12 13 ${color1}14$color 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3

that should get parsed correctly by conky recoloring the 14 to color1

Works like a charm! thx m8!

possible to get it in vertical aswell?

btw, is this conky code or general programing?


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#18 2009-11-14 19:53:08

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

Re: [SOLVED] - Is this a conky calendar?

for vertical just use my variant from above with the color corrections from brisbin33:

cal | sed -e "1,2d;s/^ *//g;s/  / /g;s/ /\n/g;s/$(date +%e)/\$\{color1\}&\$color/"

the color stuff is conky, the rest is bash/sed scripting


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#19 2009-11-14 20:05:55

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

Thx guys! you made my day! smile


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#20 2009-11-15 00:53:51

toxygen
Member
Registered: 2008-08-22
Posts: 713

Re: [SOLVED] - Is this a conky calendar?

ftornell wrote:

Thx guys! you made my day! smile

can you post a screenshot of what the final result looked like?


"I know what you're thinking, 'cause right now I'm thinking the same thing. Actually, I've been thinking it ever since I got here:
Why oh why didn't I take the BLUE pill?"

Offline

#21 2009-11-15 13:27:21

ftornell
Member
Registered: 2008-08-18
Posts: 277
Website

Re: [SOLVED] - Is this a conky calendar?

Here ya go!

screenql.th.png

Finally decided to stick with the horizontal one!


[ logicspot.NET | mempad.org ]
Archlinux x64

Offline

#22 2009-11-18 16:59:04

Paul-S
Member
From: Wales
Registered: 2008-02-04
Posts: 353

Re: [SOLVED] - Is this a conky calendar?

Nice desk ftornell, it always amazes me how helpful people on the forum are, Archlinux ftw

Cheers
Paul-S

Offline

Board footer

Powered by FluxBB