Re: December 2011 Conky Thread

Sector11 wrote:
gmonti wrote:

Thanks Sector11, as i said, i have 1024x768, and left half of my monitor is busy with another things, so the vertical calendar is the best option. I'll wait for mobilediesel's fix. Also i think the problem should be design in differents screen manager, i use gnome

No, mobile was using GNOME when he made it.  I have an older one that I can't get the colour working for today, maybe a someone that know bash can fix it:

http://thumbnails30.imagebam.com/16349/ca1f59163487065.jpg

# To use #! in a conky use: ${exec echo '#!'}
##
# killall conly && conky -c ~/Conky/OB_Cal_2.conky &
# OB_V-Cal #

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints below,skip_taskbar,skip_pager
own_window_title VCal
own_window_class VCal

#own_window_argb_visual no # no yes
#own_window_argb_value 10  <--- no ARGB visuals

background no
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
no_buffers yes
override_utf8_locale yes
pad_percents 2
short_units yes
stippled_borders 0
text_buffer_size 4096
uppercase no
use_spacer right
use_xft yes
xftfont monospace:size=9
xftalpha 1.0

# Colors
default_color FDD2C0 #LightSalmon DCDCDC #Gainsboro
color0 FFFFF0 #Ivory
color1 FFA07A #LightSalmon
color2 FF8C00 #Darkorange
color3 C6FF8E #Light Green #FFF00 #Chartreuse
color4 778899 #LightSlateGrey
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red


### OB_V-Cal ###
################
update_interval 1
imlib_cache_size 0
gap_x 10             ### left &right
gap_y 10            ### up & down
#minimum_size 930 90 ### width, height
#maximum_width 930    ### make this equal to the minimum width
alignment tl        ### Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr

TEXT
${color8} ${time %a}
 ${time %b}
${hr}${color7}
${execpi 10 ~/Conky/scripts/v_cal.sh}
${color8}${hr}
${time %Y}

v_cal.sh

#!/bin/bash
TODAY=$(date +%d)
MONTH=$(date +%-m)
case "$MONTH" in
    2)
        DAYS=28;;
    4|6|9|11)
        DAYS=30;;
    *)
        DAYS=31;;
esac
for (( i=1 ; i<=$DAYS ; i++ )); do
DAY=$(printf "%02d" $i)
    case "$i" in
        $TODAY)
            echo '$color8' $DAY'$color7';;
        *)
            echo " $DAY";;
    esac
done

WOW THANK YOU Sector11, this is what i'm looking for. 9,99/10 jejejejej if you allow me to bother you.... For perfect 10, it is possible to show today's day in a different color?

THANKS again, you're my man

Giuliano Monti Avellino
Debian/Squeeze
Gnome

Re: December 2011 Conky Thread

gmonti wrote:

perfect 10, it is possible to show today's day in a different color?

Change line 14 in v_cal.sh to read

 case "0$i" in

That should do the trick.

Edit: Sorry, that doesn't account for later dates... I'll work on that real quick.

Edit2:

case $DAY in

That should work smile

Last edited by dotism (2011-12-08 19:47:32)

Re: December 2011 Conky Thread

@S11
I was thinking of a semi transparent background rather than text.

Re: December 2011 Conky Thread

dotism wrote:
gmonti wrote:

perfect 10, it is possible to show today's day in a different color?

Change line 14 in v_cal.sh to read

 case "0$i" in

That should do the trick.

Edit: Sorry, that doesn't account for later dates... I'll work on that real quick.

Edit2:

case $DAY in

THANK YOU Dotism, that worked fine for me, and of course completed the 10 jejejeje


That should work smile

Giuliano Monti Avellino
Debian/Squeeze
Gnome

Re: December 2011 Conky Thread

sunfizz98 wrote:

@S11
I was thinking of a semi transparent background rather than text.

Yes, with a composite manager:

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### 'own_window_type override'
 own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
 own_window_argb_value 100

Play with the value 100 to get what you want.

Re: December 2011 Conky Thread

dotism wrote:

Edit2:

case $DAY in

That should work smile

Should schmould - it does!  Great fix, thank you!
http://thumbnails67.imagebam.com/16353/f15d60163529992.jpg

Last edited by Sector11 (2011-12-08 22:07:23)

Re: December 2011 Conky Thread

i was looking for something to do, so i tried a vertical style calendar in lua

http://en.zimagez.com/avatar/screenshot-2165.png

you can have numbers, numbers and days or even just days and you can set different fonts, sizes and colors for numbers and days.  there are a number of settings to adjust at the top of the lua script.

vertcal.lua

--vertical cal by mrpeachy dec  8th 2011
require 'cairo'

function conky_cal()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings
--fonts and font sizes
local font_txt="Mono"
local font_size_txt=10
local font_num="Sans"
local font_size_num=20
--colors, colors and alpha set as number between 0 and 1
--[[note on colors
when you see colors represented for example in gimp they are given
as a value out of 255.  In lua/cairo 255 would be 1.  You can easily use
calculations in lua if you have your rgba numbers out of 255 
as in the first setting below:
for alpha, the 4th number, 0=full transparent, 1=full opaque
]]
local rgba_num_bg={100/255,200/255,50/255,1}--base color for numbers
local rgba_num_ind={1,0,0,1}--indicator color for numbers
local rgba_name_bg={1,1,0,1}--base color for names
local rgba_name_ind={1,0,0,1}--indicator color for names
--day name type
local num_name=2--set 1 for numbers only, 2 for numbers and day names, 3 for day names only
local long_short=2--1 for long (Tuesday), 2 for short (Tue)
local lower_normal_upper=3--1 for all lower (tuesday/tue), 2 for normal (Tuesday/Tue), 3 for caps (TUESDAY/TUE)
--position
local toply=20--will apply to numbers and names
local top_left_x_number=200--adjust along with gaph to make names first
local top_left_x_name=230
local gapv=3--gap between lines
--gaph=5--gap between numbes and day names, make negative and adjust top_left_x to have day names first
local v_number=0--use to move numbers up and down independantly of names
local v_name=-5--use to move day names up and down independantly of numbers
local pad_zero=1--1 for padding zeros 2 for no padding
--############################################################
--calculations
local year4num=os.date("%Y")
local t1 = os.time( {    year=year4num,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year4num,month=02,day=01,hour=00,min=0,sec=0} );
local febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
local monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
--calculate what day is the first----------
local this_month=tonumber(os.date("%m"))
local todaynum=tonumber(os.date("%d"))
local dayofweek=tonumber(os.date("%w"))
-------------------------------------------
n=todaynum
v=0
while n>0 do
v=v+1
n=n-7
end
calc=(todaynum-((v-1)*7))-1
day1st=((dayofweek-calc) % 7)
-------------------------------------------
local text="MondayTuesdayWednesdayThursdayFridaySaturdaySunday"
cairo_select_font_face (cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_txt)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local theightt=extents.height
--calculate height of numbers
local text="1234567890"
cairo_select_font_face (cr, font_num, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_num)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local theightn=extents.height
if theightt>theightn then 
height=theightt 
else 
height=theightn 
end
--set day name types
if long_short==1 then
    if lower_normal_upper==1 then
    days={"monday","tuesday","wednesday","thursday","friday","saturday","sunday"}
    elseif lower_normal_upper==2 then
    days={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}
    else
    days={"MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"}
    end
else
    if lower_normal_upper==1 then
    days={"mon","tue","wed","thu","fri","sat","sun"}
    elseif lower_normal_upper==2 then
    days={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"}
    else
    days={"MON","TUE","WED","THU","FRI","SAT","SUN"}
    end
end
--print numbers and names
for i=0,monthdays[this_month]-1 do
    day=(((i % 7)+day1st) % 7)
    if day==0 then day=7 end
    if num_name==1 or num_name==2 then--print numbers
        if todaynum==i+1 then 
        cairo_set_source_rgba (cr,rgba_num_ind[1],rgba_num_ind[2],rgba_num_ind[3],rgba_num_ind[4])
        else
        cairo_set_source_rgba (cr,rgba_num_bg[1],rgba_num_bg[2],rgba_num_bg[3],rgba_num_bg[4])
        end
        cairo_move_to (cr,top_left_x_number,toply+(height*(i+1))+(gapv*i)+(v_number))
        if pad_zero==1 then
            if i+1<10 then
            num="0"..i+1
            else
            num=i+1
            end
        else
        num=i+1
        end
        cairo_select_font_face (cr, font_num, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
        cairo_set_font_size (cr, font_size_num)
        cairo_show_text (cr,num)
        cairo_stroke (cr)
    end
    if num_name==2 or num_name==3 then
        --print day names
        if todaynum==i+1 then 
        cairo_set_source_rgba (cr,rgba_name_ind[1],rgba_name_ind[2],rgba_name_ind[3],rgba_name_ind[4])
        else
        cairo_set_source_rgba (cr,rgba_name_bg[1],rgba_name_bg[2],rgba_name_bg[3],rgba_name_bg[4])
        end
        cairo_select_font_face (cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
        cairo_set_font_size (cr, font_size_txt)
        cairo_move_to (cr,top_left_x_name,toply+(height*(i+1))+(gapv*i)+(v_name))
        cairo_show_text (cr,days[day])
        cairo_stroke (cr)
    end
end
--print (dayadj)
--#########################################################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

in conkyrc

lua_load /path/vertcal.lua
lua_draw_hook_pre cal

TEXT

the script doesnt output any headers or footers, just numbers and days at the moment

Last edited by mrpeachy (2011-12-09 00:34:23)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

Re: December 2011 Conky Thread

Nice one Mr P!  big_smile

Re: December 2011 Conky Thread

thanks VastOne

just edited the above!  it was getting the days wrong for other months smile

should be fixed now... scratch that... still havnt got the math right

will update when its all fixed

Last edited by mrpeachy (2011-12-08 22:42:19)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

Re: December 2011 Conky Thread

mrpeachy wrote:

thanks VastOne

just edited the above!  it was getting the days wrong for other months smile

should be fixed now... scratch that... still havnt got the math right

will update when its all fixed

WoW!!!!!!!!!!  Looks Good so far!
Waiting in the sidelines....

Re: December 2011 Conky Thread

Sector11 wrote:

Should schmould - it does!  Great fix, thank you!

Yay big_smile

Re: December 2011 Conky Thread

dotism wrote:
Sector11 wrote:

Should schmould - it does!  Great fix, thank you!

Yay big_smile


Did not take you long to become the teacher...

Well done dotism...

Re: December 2011 Conky Thread

OMFG I have used the fecking quote-button

SHOOT ME

Re: December 2011 Conky Thread

@VastOne -- That means a lot to me, thank you.

I am really happy to a part of these forums. Everyone here is so abnormally kind.

Re: December 2011 Conky Thread

Sector11 gets all the credit... he is the most abnormal of us all... big_smile

Re: December 2011 Conky Thread

VastOne wrote:

OMFG I have used the fecking quote-button

SHOOT ME

BANG!  - {sweating} OH GOOD!  I MISSED!
hahahahahahahahaha

Re: December 2011 Conky Thread

VastOne wrote:

Sector11 gets all the credit... he is the most abnormal of us all... big_smile

Why I'm so abnormal I'm normal ... whatever that is!!!!!

Re: December 2011 Conky Thread

i think i have fixed it, see post above for code for vertical calendar

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

Re: December 2011 Conky Thread

VastOne wrote:

Sector11 gets all the credit... he is the most abnormal of us all... big_smile

His real name is A. B Normal 

(still marvellling that VastOne used the quote button)

Congratulations, you've figured out the sound of one hand clapping...

Re: December 2011 Conky Thread

updated vertical calendar now with optional header and footer and better organised settings

http://en.zimagez.com/miniature/screenshot-3130.png

code here
http://crunchbanglinux.org/pastebin/1345

same in conkyrc as before

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

Re: December 2011 Conky Thread

Mr P ... took your code and expanded some of the options to show what it can do..

http://www.zimagez.com/miniature/screenshot-12082011-101449pm.php

edit - Realized an error in my naming convention

Last edited by VastOne (2011-12-09 04:26:59)

Re: December 2011 Conky Thread

VastOne wrote:

Mr P ... took your code and expanded some of the options to show what it can do..

I tried this on the desktop and #! laptop and cannot get it to render the cal.  Even the VastOne Post 2000 conky file above TEXT will not render it.

Hmmm sad

http://s5.postimage.org/lf9w83kfn/Screenshot_12082011_09_25_28_PM.jpg

Last edited by BoredOOMM (2011-12-09 05:27:35)

Congratulations, you've figured out the sound of one hand clapping...

Re: December 2011 Conky Thread

BooMM I think you did the same thing I did

The name of the file you created is not the same as what is being called in the conky

I named the file vertical.lua

the conkyrc is looking for vertcal.lua

Re: December 2011 Conky Thread

the conkyrc I am using for it is just the three lines that mrpeachy supplied

.conkyrc3 (what I named it)

lua_load /path/vertcal.lua
lua_draw_hook_pre cal

TEXT

Re: December 2011 Conky Thread

VastOne wrote:

BooMM I think you did the same thing I did

The name of the file you created is not the same as what is being called in the conky

I named the file vertical.lua

the conkyrc is looking for vertcal.lua

ah, sorry for the confusing naming smile
and looking at the error you are getting BoredOOMM (when there isnt a line number of further description just nil vale) it could well be a naming thing
check that and if you still get the error, scroll back in the terminal to where conky is initially started and see if there are error messages there

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.