[SOLVED] getting conky calendar to work

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
achillies

[SOLVED] getting conky calendar to work

Post by achillies »

hi
I cant get the calendar script to display properly. I downloaded a caledario.sh script and called it in my conkyrc file but the day of the week wont display in a different color like the date number does. Ive tried changing the script, added another variable to contain the code but when it displays in conky the curly brackets are missing causing just the text to display with squares where the brackets should be. if i run it in a terminal it prints out the correct text that i want inserted into conky.

What have I done wrong?

Code: Select all

#! /bin/sh
# written by: jjgomera
# modified by stinkeye

DATE=`date | awk -F" " '{print $3}'`
DAY=`date +%a | cut -c1-2`
COLOR="\${color3}$DAY\${color2}"  #  <-------------- added this line

case "$1" in
month)
ncal -C -h | head -n1
;;
week)
ncal -C -h | head -n2 | tail -n1 | sed 's/'$DAY'/'$COLOR'/g'  #  <-------------- changed replacement variable to my new one
;;
last)
ncal -C -h | 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}';
;;
today)
echo $DATE;
;;
future)
ncal -C -h | 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

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
achillies

Re: getting conky calendar to work

Post by achillies »

Thanks Habitual but thats the one i downloaded that didnt work and ive been modifying
Habitual

Re: getting conky calendar to work

Post by Habitual »

ouch. I ran it locally 'as is' from there, and
sh calendario.sh week
doesn't show anything.

I checked for ncal and it's installed.
Curious. Sorry, I gave up conky after realizing I had another addiction.

But don't despair. Some one else will help.
myrkat
Level 2
Level 2
Posts: 71
Joined: Sun Feb 02, 2014 7:10 pm

Re: getting conky calendar to work

Post by myrkat »

I am not sure what's happening in that script (I even made sure the spanish was translated to english in the case). I didn't use ncal in my calendar conky script portion, but cal.

I remember monkeying with the "cal" CLI calendar and integrating it into my conky script. I wanted 2 months before, current, 2 months after for a display in a column. Highlighting the current date, of course. I was limited to monospaced fonts, but I was just using "cal" so I expected as much.

Here is my calendar conky portion:

Code: Select all

#  conky_tr -> calendars/previous 2/next 2/fading
#  mangled by myrkat

# Basic Settings
background no
cpu_avg_samples 3
double_buffer yes
imlib_cache_size 0
net_avg_samples 3
no_buffers yes
override_utf8_locale yes
temperature_unit celsius  # fahrenheit
text_buffer_size 2048
total_run_times 0
update_interval 1
uppercase no
use_xft yes
xftfont Ubuntu Mono:size=9.0   # caviar dreams:size=8
xftalpha 1.0

# Window specifications #
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual yes
own_window_argb_value 0
border_inner_margin 0
border_outer_margin 0

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Positioning & Colors
alignment tr
gap_x 180
gap_y 55
#minimum_size 220 280
maximum_width 180
default_color FF9090
color0 DD7070
color1 BB5050
color2 904040
color3 703030
color4 502020
color5 301010
color6 707070
color7 505050
color8 303030
color9 101010

TEXT
${color4}${execpi 300 YEAR=`date --date='2 months ago' +%_Y`; MONTH=`date --date='2 months ago' +%_m`; cal -m $MONTH $YEAR}
${color4}${voffset -8}${hr}
${color3}${execpi 300 YEAR=`date --date='1 month ago' +%_Y`; MONTH=`date --date='1 month ago' +%_m`; cal -m $MONTH $YEAR}
${color4}${voffset -8}${hr}
${color1}${alignc}${time %B %G}
${color2}${execpi 300 DJS=`date +%_d`; cal -h | sed '1d' | sed '/./!d' | sed 's/$/ /' | fold -w 21 | sed -n '/^.\{21\}/p' | sed 's/^/ /' | sed /" $DJS "/s/" $DJS "/" "'${color}'"$DJS"'${color4}'" "/}
${color4}${voffset -8}${hr}
${color3}${execpi 300 YEAR=`date --date='1 month' +%_Y`; MONTH=`date --date='1 month' +%_m`; cal -m $MONTH $YEAR}
${color4}${voffset -8}${hr}
${color4}${execpi 300 YEAR=`date --date='2 months' +%_Y`; MONTH=`date --date='2 months' +%_m`; cal -m $MONTH $YEAR}
...basically using sed to monkey things around for the current month / highlight. Not sure any of this may help, but one never knows!
Main Comp: i7-4770K @ 3.5GHz + nVidia 760GTX + 16GB RAM + SSD + HDD²
Linux Mint 17.2 - KDE 4.14.2 - kernel 3.16.0-38-generic
Join me and become a Linux Mint Community Sponsor and share some love! (for as little as USD$20 a month)
achillies

Re: getting conky calendar to work

Post by achillies »

thx for the reply myrkat. I tried your code but still the same issue. it all lines up straight and today’s number is hi lighted but i cant get the day to hi light. Never mind :) conky has sucked up too much of my time anyway lol

Habitual I wonder if the webmaster knows that code doesnt work too lol
Habitual

Re: getting conky calendar to work

Post by Habitual »

achillies wrote:Habitual I wonder if the webmaster knows that code doesnt work too lol
Stand by, I'll ask.

Expect an update.

Is this what you are expecting to have in your conky for the output?
http://conky.pitstop.free.fr/wiki/image ... ario_3.jpg

I asked. He is a member here, so he just may chime in.

Have a Great Day!
Sector11

Re: getting conky calendar to work

Post by Sector11 »

@ achillies

Please note: a mono font is required.
achillies wrote:Habitual I wonder if the webmaster knows that code doesnt work too lol
That would be me ...I'm not sure what doesn't work with calendario.sh it's been a LONG time since I have used thatand had no idea that it didn't work until today habitual contacted me. Today I use this:

Code: Select all

${alignc}${color0}${time %X}
${goto 37}${color}SU MO ${color0}${time %b %Y}${color} FR SA
${goto 37}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 37}/g'}${color}${font}
However this will work for you with no bash script required ... just conky:

Code: Select all

${alignc}${color0}${time %X}${color}
${alignc}${time %B %Y}
${goto 37}${if_match ${time %w}==0}${color0}SU${color} MO TU WE TH FR SA${else}\
${if_match ${time %w}==1}SU ${color0}MO${color} TU WE TH FR SA${else}\
${if_match ${time %w}==2}SU MO ${color0}TU${color} WE TH FR SA${else}\
${if_match ${time %w}==3}SU MO TU ${color0}WE${color} TH FR SA${else}\
${if_match ${time %w}==4}SU MO TU WE ${color0}TH${color0} FR SA${else}\
${if_match ${time %w}==5}SU MO TU WE TH ${color0}FR${color} SA${else}\
SU MO TU WE TH FR ${color0}SA${color}\
${endif}${endif}${endif}${endif}${endif}${endif}
${goto 37}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 37}/g'}${color}${font}
Top calendar = top code - bottom calendar = bottom code
Image
Did this on the fly while answering this.
Gotta love the if_commands

time %X = Preferred time representation based on locale, without the date
Some examples: 3.59.16 or 15:59:16 or 03:59:16 AM or 03:59:16 PM
Sector11

Re: getting conky calendar to work

Post by Sector11 »

Habitual wrote:I asked. He is a member here, so he just may chime in.
You're bad - you know I can't turn down a conky challenge. :)

Thanks for the heads up.
achillies

Re: getting conky calendar to work

Post by achillies »

Sector11 that last block of code works perfectly, exactly what I wanted.
Thats what I was trying to do with the code but wasnt sure how to write it.
Last time I played with linux before mint 17 was Red hat linux 4 so i got alot of catchup and learning to do lol

Thanks for all the replies and help guys, greatly appreciated.
Habitual

Re: getting conky calendar to work

Post by Habitual »

Sector11 wrote:You're bad - you know I can't turn down a conky challenge. :)
I am powerless over my addiction.
and
I can 'quit' any time I want to? :idea:

Glad it worked out. and Sector11, thanks for Helping out.
Sector11

Re: getting conky calendar to work

Post by Sector11 »

@ achillies - your welcome. Glad to help.
Habitual wrote:I am powerless over my addiction.
and
I can 'quit' any time I want to? :idea:

Glad it worked out. and Sector11, thanks for Helping out.
What addiction, I don't have no addiction. Deny deny deny! :lol:
See conky challenge above and helping a friend is a given.
Habitual

Re: getting conky calendar to work

Post by Habitual »

Sector11 wrote:See conky challenge above and helping a friend is a given.
It's a "we" thing, not a "me" thing!
Locked

Return to “Compiz, Conky, Docks & Widgets”