SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#4776 2013-02-20 05:38:11

timius1
New Member
Registered: 2013-02-19
Posts: 4

Re: Conky v1.9 Thread

Sector11!!!
Thank you very much!
It works!
s_1361338398_5917049_3c7c136bf1.png

Offline

Be excellent to each other!

#4777 2013-02-20 07:17:40

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

@ansem_of_nexus
One is your code "multi-face" and the other of  PackRat.
I'd like to use the multiface clock hands on the PackRat's clock...
It's 2 differents codes i'm not sure it's possible because the values are not declared in the same way.

Offline

#4778 2013-02-20 18:14:00

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

is it possible to display a flash-movie within conky?

Offline

#4779 2013-02-20 18:26:00

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

ansem_of_nexus wrote:

@Sector11 Thank you for taking care of that question

You're welcome.  It was there, I didn't know when you'd be back.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#4780 2013-02-20 18:27:44

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

timius1 wrote:

Sector11!!!
Thank you very much!
It works!

You're welcome too.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#4781 2013-02-20 19:40:05

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

Sector11 wrote:
ansem_of_nexus wrote:

@Sector11 Thank you for taking care of that question

You're welcome.  It was there, I didn't know when you'd be back.

yeah, when I will be here is hit or miss.


You can find my work here

Make everything ok button

Offline

#4782 2013-02-20 20:03:43

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

ragamatrix wrote:

@ansem_of_nexus
One is your code "multi-face" and the other of  PackRat.
I'd like to use the multiface clock hands on the PackRat's clock...
It's 2 differents codes i'm not sure it's possible because the values are not declared in the same way.

It should be very simple to add my hand code in. I will put the hand code below. Once it is in your lua script you will just have to change the values, at the top is all the strings. The PackRat clock will call all the sames strings (just named something else most likely, but it may not call the am&pm value), you just need to find which strings have the conky_parse value that my hands need and change the strings to match. I would just real quick do it, but I don't have the PackRat clock lua.

Also my hands are setup to be 12 and 24 hour depending on what you want, if the clock has a similar feature then you might be able to change my coding to the coding already present.

center_x=110
center_y=110

hours=12

hands_red=.5
hands_green=.5
hands_blue=.5
hands_alpha=1
hands_ired=.25
hands_igreen=.25
hands_iblue=.25
hands_ialpha=1

outer_radius=100
ampm=conky_parse("${time %p}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then
hour=tonumber(conky_parse("${time %I}"))
else
hour=tonumber(conky_parse("${time %H}"))
end

hour_hand_radius1=outer_radius-30
hour_hand_radius2=outer_radius-50
hour_position=(-90*(math.pi/180))+(((360/(hours*60*60))*((hour*60*60)+(minute*60)+second))*(math.pi/180))
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(hour_position-(20*(math.pi/180))),(hour_position+(20*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position+(5*(math.pi/180))),(hour_position+(5*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius1,hour_position,hour_position)
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position-(5*(math.pi/180))),(hour_position-(5*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
minute_hand_radius1=outer_radius-15
minute_hand_radius2=outer_radius-35
minute_position=(-90*(math.pi/180))+(((360/(60*60))*((minute*60)+second))*(math.pi/180))
cairo_arc(cr,center_x,center_y,10,(minute_position-(20*(math.pi/180))),(minute_position+(20*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position+(5*(math.pi/180))),(minute_position+(5*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius1,minute_position,minute_position)
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position-(5*(math.pi/180))),(minute_position-(5*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
second_hand_radius=outer_radius-5
second_position=(-90*(math.pi/180))+(((360/60)*second)*(math.pi/180))
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,center_y)
cairo_arc(cr,center_x,center_y,second_hand_radius,second_position,second_position)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
--am & pm
if hours == 12 then
cairo_select_font_face (cr,"mono",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr,10)
cairo_set_source_rgba (cr,.8,.8,.8,1)
cairo_move_to (cr,(center_x-6.25),(center_y+3.25))
cairo_show_text (cr,ampm)
cairo_stroke (cr)
else
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,5,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_fill(cr)
end--am & pm

You can find my work here

Make everything ok button

Offline

#4783 2013-02-21 04:27:02

pzl
New Member
Registered: 2013-02-20
Posts: 1

Re: Conky v1.9 Thread

Hey everyone!

I'm a new #!er (installed for the first time two days ago), and relatively new linux user -- so please forgive my noobishness if there are more efficient/linuxy ways to do things than I'm currently using.

Conky was probably the first thing I got really excited about on first install, and browsing the screenshot threads was like a kid drooling in a toy store. I wanted the fancy stuff! So I read mrpeachy's 14-or-so-part tutorial on lua and got crackin.

This was my first time using lua (though I'm very familiar with javascript, which may have helped) and this is what I got:
conk1.png

The email icons have colored bars above them to act as account-labels. The envelope dims when you don't have any new messages, and if you do it badges the number

the fan icon actually spins according to your fan speed, and includes an (optional) 1-px wide bar graph indicating fan speed as well. Since conky only runs at 1s minimum updates, its a little jittery looking, but if you set the rotation angles to be small enough, it doesn't look awful

the thermometer is obviously a thermometer. uses a gradient fill, and when you're above some set "warning level" you can change the color, to, say, red.


the clock is just a little clock.

--YAY EMAIL
function conky_mail(opts)
    if opts.color==nil then opts.color={0,1,0,1} end
    if opts.new==nil then opts.new=0 end



    local mail_width=18
    local mail_height=11
    local mail_color={0.85,0.22,0.22,1}
    local mail_y_pad=4

    --envelope
    cairo_set_source_rgba(cr,1,1,1,1)
    cairo_set_line_width(cr,0.5)
    cairo_rectangle(cr,opts.x,opts.y+mail_y_pad,mail_width,mail_height)
    cairo_fill_preserve(cr)
    cairo_set_source_rgba(cr,color(mail_color))
    cairo_stroke(cr)

    --thick red lines
    cairo_set_line_width(cr,2)
    cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
    cairo_move_to(cr,opts.x,opts.y+mail_y_pad)
    cairo_rel_line_to(cr,0,mail_height)
    cairo_move_to(cr,opts.x+mail_width,opts.y+mail_y_pad)
    cairo_rel_line_to(cr,0,mail_height)
    cairo_stroke(cr)
    --flap
    cairo_move_to(cr,opts.x,opts.y+mail_y_pad)
    cairo_rel_line_to(cr,mail_width/2,3*mail_height/5)
    cairo_line_to(cr,opts.x+mail_width,opts.y+mail_y_pad)
    cairo_stroke(cr)
    --flap thin lines
    cairo_set_line_width(cr,0.5)
    cairo_move_to(cr,opts.x+0.5,opts.y+mail_y_pad+4*mail_height/5)
    cairo_rel_line_to(cr,mail_width/3,-1*mail_height/3)
    cairo_move_to(cr,opts.x+mail_width-0.5,opts.y+mail_y_pad+4*mail_height/5)
    cairo_rel_line_to(cr,-mail_width/3,-1*mail_height/3)
    cairo_stroke(cr)


    --account color
    cairo_set_line_width(cr,1.5)
    cairo_set_source_rgba(cr,color(opts.color))
    cairo_move_to(cr,opts.x,opts.y)
    cairo_rel_line_to(cr,mail_width,0)
    cairo_stroke(cr)


    if opts.new<1 then
        cairo_set_source_rgba(cr,0,0,0,0.65)
        cairo_rectangle(cr,opts.x-1,opts.y+mail_y_pad-0.5,mail_width+2,mail_height+1)
        cairo_fill(cr)
    else
        cairo_select_font_face(cr,"terminus",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
        cairo_set_font_size(cr,3)
        cairo_set_source_rgba(cr,0,0,0,1)
        cairo_move_to(cr,opts.x+mail_width-6,opts.y+mail_y_pad+mail_height)
        cairo_show_text(cr,opts.new)
    end

    
end
--YAY FAN SPEED
function conky_fan(opts)
    if opts.color==nil then opts.color={1,1,1,1} end
    if opts.low==nil then opts.low=0 end
    if opts.high==nil then opts.high=100 end
    if opts.val==nil then opts.val=0 end
   
    local my_bg = {0.18,0.2,0.21,1}

    local fan_radius=8
    local fan_blades=3
    local fan_rotation_speed=(opts.val-opts.low)/(opts.high-opts.low)*50
    local fan_angle=360/fan_blades

    --print(fan_position)
    if fan_position==nil then
        fan_position=fan_rotation_speed
    else
        fan_position=fan_position+fan_rotation_speed
    end

    cairo_set_source_rgba(cr,color(opts.color))
    --blades
    for i=1,fan_blades do
        blade({x=opts.x+fan_radius,
               y=opts.y+fan_radius,
               r=fan_radius,a=i*fan_angle-fan_position,
               sweep=fan_angle})
    end

    --pin
    cairo_set_source_rgba(cr,color(my_bg)) 
    cairo_arc(cr,opts.x+fan_radius,opts.y+fan_radius,3.0,0,2*math.pi)
    cairo_fill(cr)
    cairo_set_source_rgba(cr,color(opts.color))
    cairo_arc(cr,opts.x+fan_radius,opts.y+fan_radius,2,0,2*math.pi)
    cairo_fill(cr)

    if opts.bar ~= nil or opts.bar ~= false then
        local bar_height = (opts.val-opts.low)/(opts.high-opts.low)*fan_radius*2
        cairo_set_line_width(cr,1)
        cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
        cairo_move_to(cr,opts.x+fan_radius*2+2.5,opts.y+fan_radius*2)
        cairo_rel_line_to(cr,0,-bar_height)
        cairo_stroke(cr)
    end


end
function blade(opts)
    local crv_s=27 --curvature strength

    local half_pt={x=opts.r*math.cos(math.rad(opts.sweep/2+opts.a)),
             y=opts.r*math.sin(math.rad(opts.sweep/2+opts.a))}
    local curve_pt={x=opts.r/2*math.cos(math.rad(opts.a+opts.sweep/2-crv_s)),
              y=opts.r/2*math.sin(math.rad(opts.a+opts.sweep/2-crv_s))}
    local curve_in={x=opts.r/2*math.cos(math.rad(opts.a+opts.sweep-crv_s)),
              y=opts.r/2*math.sin(math.rad(opts.a+opts.sweep-crv_s))}

    cairo_set_line_width(cr,0.5)
    cairo_move_to(cr,opts.x,opts.y)
    cairo_curve_to(cr,
        opts.x+curve_pt.x,opts.y+curve_pt.y,
        opts.x+curve_pt.x,opts.y+curve_pt.y,
        opts.x+half_pt.x,opts.y+half_pt.y)
    cairo_arc(cr,opts.x,opts.y,opts.r,math.rad(opts.a+opts.sweep/2),math.rad(opts.a+opts.sweep))
    cairo_curve_to(cr,
        opts.x+curve_in.x,opts.y+curve_in.y,
        opts.x+curve_in.x,opts.y+curve_in.y,
        opts.x,opts.y)
    cairo_fill(cr)
end
--YAY THERMOMETER
function conky_temp(opts)
    if opts.cold==nil then opts.cold={0,.5,1,1} end
    if opts.hot==nil then opts.hot={1,0,0,1} end
    if opts.burn==nil then opts.burn={1,0,0,1} end
    if opts.burn_border==nil then opts.burn_border={.4,0,0,1} end
    if opts.high==nil then opts.high=70 end
    if opts.low==nil then opts.low=22 end
    if opts.warn==nil then opts.warn=60 end
    if opts.border==nil then opts.border={1,1,1,.6} end
    if opts.val==nil then opts.val=20 end --honestly, whatever here


    local therm_h=17
    local therm_w=6.2

    local bulb={x=opts.x+therm_w/2+.5,y=opts.y+therm_h-therm_w/2+.5}
    local stalk={dx=therm_w/2*math.cos(math.rad(60)),
                dy=therm_w/2*math.sin(math.rad(60))}
    stalk.h=therm_h-therm_w/2-stalk.dx-4

    local grad = cairo_pattern_create_linear(0,0,0,therm_h)
    cairo_pattern_add_color_stop_rgba(grad,0,color(opts.hot))
    cairo_pattern_add_color_stop_rgba(grad,1,color(opts.cold))
    local value = (opts.val-opts.low)/(opts.high-opts.low)*(stalk.h+stalk.dx)

    --bulb fill
    if opts.val < opts.warn then
        cairo_set_source(cr,grad)
    else
        cairo_set_source_rgba(cr,color(opts.burn))
    end
    cairo_arc(cr,bulb.x,bulb.y,therm_w/2,0,2*math.pi)
    cairo_fill(cr)

    --stalk fill
    cairo_rectangle(cr,bulb.x-stalk.dx,bulb.y-therm_w/2,2*stalk.dx,-value)
    cairo_fill(cr)


    --outline
    --bulb
    if opts.val < opts.warn then
        cairo_set_source_rgba(cr,color(opts.border))
    else
        cairo_set_source_rgba(cr,color(opts.burn_border))
    end
    cairo_set_line_width(cr,1)
    cairo_arc(cr,bulb.x,bulb.y,therm_w/2,math.rad(30-90),math.rad(330-90))
    --stalk
    cairo_move_to(cr,bulb.x-stalk.dx,bulb.y-stalk.dy)
    cairo_rel_line_to(cr,0,-1*stalk.h)
    cairo_arc(cr,bulb.x,opts.y+stalk.dx+.5,stalk.dx,math.rad(270-90),0)
    cairo_line_to(cr,bulb.x+stalk.dx,bulb.y-stalk.dy)
    cairo_stroke(cr)

end
function conky_tinyclock(opts)
    if opts.color==nil then opts.color={1,1,1,1} end

    local r=6
    local s=tonumber(os.date("%S"))
    local m=tonumber(os.date("%M"))*60+s
    local h=tonumber(os.date("%I"))*60*60+m
    opts.x=opts.x+.5
    opts.y=opts.y+.5

    --border
    cairo_set_source_rgba(cr,color(opts.color))
    cairo_set_line_width(cr,1.2)
    cairo_arc(cr,opts.x+r,opts.y+r,r,0,2*math.pi)
    cairo_stroke(cr)

    cairo_set_line_width(cr,1)
    --hours
    cairo_move_to(cr,opts.x+r,opts.y+r)
    cairo_rel_line_to(cr,3*math.cos(math.rad(h*(360/(60*60*12))-90)),3*math.sin(math.rad(h*(360/(60*60*12))-90)))
    cairo_stroke(cr)
    --minutes
    cairo_move_to(cr,opts.x+r,opts.y+r)
    cairo_rel_line_to(cr,4*math.cos(math.rad(m*(360/(60*60))-90)),4*math.sin(math.rad(m*(360/(60*60))-90)))
    cairo_stroke(cr)
    --seconds
    cairo_set_source_rgba(cr,1,0,0,1)
    cairo_move_to(cr,opts.x+r,opts.y+r)
    cairo_rel_line_to(cr,5*math.cos(math.rad(s*360/60-90)),5*math.sin(math.rad(s*360/60-90)))
    cairo_stroke(cr)
end

little helper function to expand color lists/arrays/whatever the name is in lua:

function color(opts)
    return opts[1],opts[2],opts[3],opts[4]
end

thoughts? am I crunchbangin' right?

Offline

#4784 2013-02-21 14:54:06

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

ansem_of_nexus wrote:
ragamatrix wrote:

@ansem_of_nexus
One is your code "multi-face" and the other of  PackRat.
I'd like to use the multiface clock hands on the PackRat's clock...
It's 2 differents codes i'm not sure it's possible because the values are not declared in the same way.

It should be very simple to add my hand code in. I will put the hand code below. Once it is in your lua script you will just have to change the values, at the top is all the strings. The PackRat clock will call all the sames strings (just named something else most likely, but it may not call the am&pm value), you just need to find which strings have the conky_parse value that my hands need and change the strings to match. I would just real quick do it, but I don't have the PackRat clock lua.

Also my hands are setup to be 12 and 24 hour depending on what you want, if the clock has a similar feature then you might be able to change my coding to the coding already present.

center_x=110
center_y=110

hours=12

hands_red=.5
hands_green=.5
hands_blue=.5
hands_alpha=1
hands_ired=.25
hands_igreen=.25
hands_iblue=.25
hands_ialpha=1

outer_radius=100
ampm=conky_parse("${time %p}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then
hour=tonumber(conky_parse("${time %I}"))
else
hour=tonumber(conky_parse("${time %H}"))
end

hour_hand_radius1=outer_radius-30
hour_hand_radius2=outer_radius-50
hour_position=(-90*(math.pi/180))+(((360/(hours*60*60))*((hour*60*60)+(minute*60)+second))*(math.pi/180))
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(hour_position-(20*(math.pi/180))),(hour_position+(20*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position+(5*(math.pi/180))),(hour_position+(5*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius1,hour_position,hour_position)
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position-(5*(math.pi/180))),(hour_position-(5*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
minute_hand_radius1=outer_radius-15
minute_hand_radius2=outer_radius-35
minute_position=(-90*(math.pi/180))+(((360/(60*60))*((minute*60)+second))*(math.pi/180))
cairo_arc(cr,center_x,center_y,10,(minute_position-(20*(math.pi/180))),(minute_position+(20*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position+(5*(math.pi/180))),(minute_position+(5*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius1,minute_position,minute_position)
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position-(5*(math.pi/180))),(minute_position-(5*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
second_hand_radius=outer_radius-5
second_position=(-90*(math.pi/180))+(((360/60)*second)*(math.pi/180))
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,center_y)
cairo_arc(cr,center_x,center_y,second_hand_radius,second_position,second_position)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
--am & pm
if hours == 12 then
cairo_select_font_face (cr,"mono",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr,10)
cairo_set_source_rgba (cr,.8,.8,.8,1)
cairo_move_to (cr,(center_x-6.25),(center_y+3.25))
cairo_show_text (cr,ampm)
cairo_stroke (cr)
else
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,5,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_fill(cr)
end--am & pm

I can post the code because I don't really understand your explanation. I've got a little English level smile :
SimplyClock.lua:

--[[drawing a clock in conkyrc
by mrpeachy - 12 March 2010
Edited by Sector11 for personal use - 12 Mar 2012

lua_load /path/clock.lua
lua_draw_hook_pre main
TEXT
]]

require 'cairo'

function conky_main()
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)
--##############################################################################
--   SETTINGS AREA
--##############################################################################
-- image
-- how do I add images.
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")


--12 OR 24
-- local clock_type=24
local clock_type=12

--CLOCK SETTINGS
local clock_radius=175
local clock_centerx=237
local clock_centery=237

-- SET MARKS
--how many marks around edge
local number_marks=12 --24
--set mark length
local m_length=10
--set mark line width
local m_width=1
--set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
--set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1  --opaque white

--SET BORDER OPTIONS
local clock_border_width=0 --2
--set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1  --full opaque white
--gap from clock border to hour marks
local b_to_m=5

--SECONDS HAND SETUP
--set length of seconds hand
local sh_length=12
--set hand width
local sh_width=1
--set hand line cap
local sh_cap=CAIRO_LINE_CAP_ROUND
--set seconds hand color
local shr,shg,shb,sha=0,1,1,0  --fully opaque cyan

--MINUTE HAND SETUP
--set length of minutes hand
local mh_length=165
--set hand width
local mh_width=1
--set hand line cap
local mh_cap=CAIRO_LINE_CAP_ROUND
--set minute hand color
local mhr,mhg,mhb,mha=1,1,1,1  --fully opaque white

--HOUR HAND SETUP
--set length of hour hand
local hh_length=110
--set hand width
local hh_width=1
--set hand line cap
local hh_cap=CAIRO_LINE_CAP_ROUND
--set hour hand color
local hhr,hhg,hhb,hha=1,1,1,1  --fully opaque white
--##############################################################################
--   END SETTINGS AREA
--##############################################################################

--DRAWING CODE
--draw border
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)

--DRAW MARKS
--stuff that can be moved outside of the loop, needs only be set once
--calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length
--set line cap type
cairo_set_line_cap  (cr, m_cap)
--set line width
cairo_set_line_width (cr,m_width)
--set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
--start for loop
for i=1,number_marks do
--drawing code using the value of i to calculate degrees
--calculate start point for 12 oclock mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
--calculate end point for 12 oclock mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--draw the line
cairo_stroke (cr)
end--of for loop

--TIME CALCULATIONS ###########################
if clock_type==12 then
hours=tonumber(os.date("%I")) --12 hour clock
--convert hours to seconds
h_to_s=hours*60*60
elseif clock_type==24 then
hours=tonumber(os.date("%H")) --24 hour clock
--convert hours to seconds
h_to_s=hours*60*60
end

minutes=tonumber(os.date("%M"))
--convert minutes to seconds
m_to_s=minutes*60
--get current seconds
seconds=tonumber(os.date("%S"))

--DRAW HOUR HAND ############################
--convert hours, minutes & seconds to seconds
hsecs=h_to_s+m_to_s+seconds
--calculate number of degrees for each hand per second
hsec_degs=hsecs*(360/(60*60*clock_type)) -- USING AN EQUATION INSTEAD OF TYPING THE CALCULATION IN BECAUSE THE RESULT OF 360/43200 HAS DECIMAL PLACES
--set radius we will use to calculate hand points
radius=hh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of minutes hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,hh_width)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)

--DRAW MINUTES HAND ############################
--convert minutes & seconds to seconds
msecs=m_to_s+seconds
--calculate degrees for the hand each second
msec_degs=msecs*0.1
--set radius we will use to calculate hand points
radius=mh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of minutes hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,mh_width)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)

--DRAW SECOND HAND #############################
--calculate degrees for each second the hand moves
sec_degs=seconds*6
--set radius we will use to calculate hand points
radius=sh_length
--set our starting line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
--calculate coordinates for end of second hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
--describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
--set up line attributes and draw line
cairo_set_line_width (cr,sh_width)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap  (cr, sh_cap)
cairo_stroke (cr)

--##############################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

Thanks

Last edited by ragamatrix (2013-02-21 14:55:02)

Offline

#4785 2013-02-21 17:43:52

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

@ragamatrix That is ok, I will get started on it here in a little bit. I should have it done by to night


You can find my work here

Make everything ok button

Offline

#4786 2013-02-21 19:41:21

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i have different views (webcams) which should be displayed to the same time.
during the first minutes webcam1, next five minutes webcam2, etc.

is it possible to create such a 'slideshow'?

Offline

#4787 2013-02-21 20:05:56

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

So the fastest way to make your clock for you, was to just add what the hands were missing. So I added the hour lines and increased the size / position to that of the clock script you showed me. So this should work for what you wanted, I think.

require 'cairo'
function conky_main()
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
--################################
center_x=237
center_y=237
outer_radius=175
hours=12
hand_width=3
hands_red=.75
hands_green=0
hands_blue=0
hands_alpha=1
hands_ired=.7
hands_igreen=.7
hands_iblue=.7
hands_ialpha=1
mr,mg,mb,ma=1,1,1,1
ampm=conky_parse("${time %p}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then hour=tonumber(conky_parse("${time %I}")) else hour=tonumber(conky_parse("${time %H}")) end
hour_hand_radius1=outer_radius-40
hour_hand_radius2=outer_radius-60
hour_position=(-90*(math.pi/180))+(((360/(hours*60*60))*((hour*60*60)+(minute*60)+second))*(math.pi/180))
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(hour_position-(15*(math.pi/180))),(hour_position+(15*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position+(hand_width*(math.pi/180))),(hour_position+(hand_width*(math.pi/180))))
cairo_arc(cr,center_x,center_y,hour_hand_radius1,hour_position,hour_position)
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position-(hand_width*(math.pi/180))),(hour_position-(hand_width*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
minute_hand_radius1=outer_radius-15
minute_hand_radius2=outer_radius-35
minute_position=(-90*(math.pi/180))+(((360/(60*60))*((minute*60)+second))*(math.pi/180))
cairo_arc(cr,center_x,center_y,10,(minute_position-(15*(math.pi/180))),(minute_position+(15*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position+(hand_width*(math.pi/180))),(minute_position+(hand_width*(math.pi/180))))
cairo_arc(cr,center_x,center_y,minute_hand_radius1,minute_position,minute_position)
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position-(hand_width*(math.pi/180))),(minute_position-(hand_width*(math.pi/180))))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_ialpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
second_hand_radius=outer_radius-5
second_position=(-90*(math.pi/180))+(((360/60)*second)*(math.pi/180))
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,center_y)
cairo_arc(cr,center_x,center_y,second_hand_radius,second_position,second_position)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
--[[am & pm
if hours == 12 then
cairo_select_font_face (cr,"mono",CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr,10)
cairo_set_source_rgba (cr,.8,.8,.8,1)
cairo_move_to (cr,(center_x-6.25),(center_y+3.25))
cairo_show_text (cr,ampm)
cairo_stroke (cr)
else
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,5,(0*(math.pi/180)),(360*(math.pi/180)))
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_fill(cr)
end]]
for i=1,hours do
cairo_arc(cr,center_x,center_y,(outer_radius-5),((-90*(math.pi/180))+(((i-1)*(360/hours))*(math.pi/180))),((-90*(math.pi/180))+(((i-1)*(360/hours))*(math.pi/180))))
cairo_arc(cr,center_x,center_y,(outer_radius-15),((-90*(math.pi/180))+(((i-1)*(360/hours))*(math.pi/180))),((-90*(math.pi/180))+(((i-1)*(360/hours))*(math.pi/180))))
cairo_set_source_rgba(cr,mr,mg,mb,ma)
cairo_stroke(cr)
end
--################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end

If this doesn't work, let me know and I will continue with the conversion to packrat's clock from where I stopped.

Last edited by ansem_of_nexus (2013-02-21 20:10:08)


You can find my work here

Make everything ok button

Offline

#4788 2013-02-21 21:09:02

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

check if this routine give you idea of how to do it:

function test(loops, seconds, camerasNo)
   local i, x, cameraTab = 0, 0, {}
   for i=1, camerasNo do cameraTab[i]="Camera No.: "..i end
   i=0
   while i<loops do
      if (i%seconds) == 0 then x=x+1 end
      print(cameraTab[((x-1)%camerasNo)+1])
      i=i+1
   end
end

and test it like that (you can copy&paste function definition into the LUA terminal and use it there after):

test(20,3,5)

tongue  ]:D  cool

Last edited by dk75 (2013-02-21 21:10:31)


Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#4789 2013-02-21 21:51:43

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

@ansem_of_nexus:

It works; a bit large though - which lines control the radius?

I changed:

outer_radius=175

but it looked like I lost a bit of the proportions. There a quick fix to resize?

acqv0Tcc.jpg


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#4790 2013-02-21 22:23:59

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

PackRat wrote:

@ansem_of_nexus:

It works; a bit large though - which lines control the radius?

I changed:

outer_radius=175

but it looked like I lost a bit of the proportions. There a quick fix to resize?

http://t.imgbox.com/acqv0Tcc.jpg

hand_width=3, I would say 5 should do it. The hand width is double the number, like cairo set line width does.


You can find my work here

Make everything ok button

Offline

#4791 2013-02-21 22:54:56

el
New Member
Registered: 2013-02-21
Posts: 1

Re: Conky v1.9 Thread

Hello, I'm fresh here. Can I create active space in conky, where I could write? I want to create reminder.

Offline

#4792 2013-02-22 00:10:17

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

@ansem_of_nexus - thanks

@pzl - nice one.

Edit - that worked; messed around with some other parts. Four conkies; system, weather, tao, and a clock:

abfhZXqY.jpg

Last edited by PackRat (2013-02-22 02:35:13)


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#4793 2013-02-22 09:22:10

Naik
#! Die Hard
From: Leipzig
Registered: 2012-11-16
Posts: 595

Re: Conky v1.9 Thread

hey hey!

love my clock_ring_lua and all, but ever since i am using it text-align-ing above it doesn`t work anymore.... any suggestions?

.conkyrc

# Conky settings #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
#imlib_cache_size 0
# Window specifications #
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 400 700
alignment tr
gap_x 3
gap_y 13
# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# Text settings #
use_xft yes
xftfont Larabifont:size=8
xftalpha 0.9
uppercase no
default_shade_color cccccc
default_color 122342
# Lua Load  #
lua_load ~/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings
TEXT
${color cccccc}${font Larabifont:size=20}${goto 23}${time %e}  ${time %b} ${font Larabifont:size=10}${color 308280}${voffset -7}${goto 367}${time %A}${font}
${voffset -6}${goto 133}${hr}
${alignr}${font TakaoPMincho:size=9}一期一会  ${font Larabifont:size=6}${kernel} - ${battery_time}  -${if_up wlan0}wlan ${wireless_link_qual wlan0}% @ ${execpi 360 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}${endif}
${goto 303}${voffset 62}${color 016796}${downspeed wlan0}
${goto 250}${voffset 72}${color 011C96}${cpu cpu0}%
${goto 240}${color 013596}${cpu cpu1}%
${goto 210}${voffset 113}${color 019694}${mem}${font}${color}
${voffset 66}
${if_match ${battery_percent} < 13}${exec ~/scripts/batlow.sh}${color FF0000}${font BaileysCar:pixelsize=43}${blink AKKU: ${battery}}${color}${font}${else}${exec bash -c 'if [ -e /run/lock/batlow ]; then rm -f /run/lock/batlow; fi'}${endif}
${if_match ${exec sensors | grep 'Core 0'|awk '{print $3}' | cut -c2-3} > 93}${exec ~/scripts/temp.sh}${color FF0000}${font BaileysCar:pixelsize=23}${alignr}${blink CPU-TEMP:${exec sensors | grep 'Core 0'|awk '{print $3}' | cut -c2-3}/${exec sensors | grep 'Core 1'|awk '{print $3}' | cut -c2-3}°C}${font}${color}${endif}${if_match ${exec sensors | grep 'Core 0'|awk '{print $3}' | cut -c2-3} < 75}${exec bash -c 'if [ -e /run/lock/temp ]; then rm -f /run/lock/temp; fi'}${endif}
${if_running mocp}${goto 152}MOC:${goto 185}${exec mocp -Q %state} - ${scroll 28 ${execi 300 ~/scripts/moc_conky.sh}}${endif}
${if_running vlc}${goto 152}VLC:${goto 185}${scroll 33 ${exec xlsclients -l | grep "VLC media player" | cut -c -9 --complement}}${endif}

clock_rings.lua

--[[
Clock Rings by Linux Mint (2011) reEdited by despot77

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/clock_rings.lua
    lua_draw_hook_pre clock_rings
    
Changelog:
+ v1.0 -- Original release (30.09.2009)
   v1.1p -- Jpope edit londonali1010 (05.10.2009)
*v 2011mint -- reEdit despot77 (18.02.2011)
]]

settings_table = {

    
    --[[{
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
        name='time',
        -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
        arg='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=12,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xffffff,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.1,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0x014D96,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.2,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
        x=200, y=250,
        -- "radius" is the radius of the ring.
        radius=50,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=5,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
        end_angle=360
    },
    {
        name='time',
        arg='%M.%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x014D96,
        fg_alpha=0.4,
        x=200, y=250,
        radius=56,
        thickness=5,
        start_angle=0,
        end_angle=360
    },--]]

    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=359,
        end_angle=2
    },
    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=29,
        end_angle=31
    },
    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=59,
        end_angle=61
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=89,
        end_angle=91
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=119,
        end_angle=121
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.1,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=149,
        end_angle=151
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=179,
        end_angle=181
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=209,
        end_angle=211
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=239,
        end_angle=241
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=269,
        end_angle=271
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=299,
        end_angle=301
    },{
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x7A7F9C,
        bg_alpha=0.5,
        fg_colour=0xC3CEFF,
        fg_alpha=0.0,
        x=220, y=240,
        radius=172,
        thickness=4,
        start_angle=329,
        end_angle=331
    },--[[
    {
        name='time',
        arg='%d',
        max=31,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x014D96,
        fg_alpha=0.7,
        x=200, y=250,
        radius=70,
        thickness=5,
        start_angle=-90,
        end_angle=90
    },
    {
        name='time',
        arg='%m',
        max=12,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x014D96,
        fg_alpha=1,
        x=200, y=250,
        radius=76,
        thickness=5,
        start_angle=-90,
        end_angle=90
    },--]]
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.3,
        fg_colour=0x011C96,
        fg_alpha=0.7,
        x=220, y=240,
        radius=50,
        thickness=7,
        start_angle=45,
        end_angle=360
    },
    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.3,
        fg_colour=0x013596,
        fg_alpha=0.7,
        x=220, y=240,
        radius=42,
        thickness=7,
        start_angle=45,
        end_angle=360
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.3,
        fg_colour=0x019694,
        fg_alpha=0.7,
        x=220, y=240,
        radius=95,
        thickness=5,
        start_angle=90,
        end_angle=270
    },
    --[[
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x014D96,
        fg_alpha=0.7,
        x=100, y=400,
        radius=25,
        thickness=5,
        start_angle=-90,
        end_angle=210
    },        --]]
    {
        name='battery_percent',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x00E6FF,
        fg_alpha=0.7,
        x=220, y=240,
        radius=123,
        thickness=10,
        start_angle=0,
        end_angle=360
    },

        {
        name='downspeedf',
        arg='wlan0',
        max=1512,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x016796,
        fg_alpha=0.7,
        x=220, y=240,
        radius=150,
        thickness=7,
        start_angle=35,
        end_angle=215
    },
        {
        name='upspeedf',
        arg='wlan0',
        max=712,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x014D96,
        fg_alpha=0.7,
        x=220, y=240,
        radius=142,
        thickness=7,
        start_angle=45,
        end_angle=225
    },
}

-- Use these settings to define the origin and extent of your clock.

clock_r=170

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=220
clock_y=240

show_seconds=false

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height
    
    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local angle_0=sa*(2*math.pi/360)-math.pi/2
    local angle_f=ea*(2*math.pi/360)-math.pi/2
    local t_arc=t*(angle_f-angle_0)

    -- Draw background ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
    cairo_set_line_width(cr,ring_w)
    cairo_stroke(cr)
    
    -- Draw indicator ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)        
end

function draw_clock_hands(cr,xc,yc)
    local secs,mins,hours,secs_arc,mins_arc,hours_arc
    local xh,yh,xm,ym,xs,ys
    
    secs=os.date("%S")    
    mins=os.date("%M")
    hours=os.date("%I")
        
    secs_arc=(2*math.pi/60)*secs
    mins_arc=(2*math.pi/60)*mins+secs_arc/60
    hours_arc=(2*math.pi/12)*hours+mins_arc/12
        
    -- Draw hour hand
    
    xh=xc+0.7*clock_r*math.sin(hours_arc)
    yh=yc-0.7*clock_r*math.cos(hours_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xh,yh)
    
    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_width(cr,5)
    cairo_set_source_rgba(cr,0.2,0.2,0.2,0.7)
    cairo_stroke(cr)
    
    -- Draw minute hand
    
    xm=xc+clock_r*math.sin(mins_arc)
    ym=yc-clock_r*math.cos(mins_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xm,ym)
    
    cairo_set_line_width(cr,3)
    cairo_stroke(cr)
    
    -- Draw seconds hand
    
    if show_seconds then
        xs=xc+clock_r*math.sin(secs_arc)
        ys=yc-clock_r*math.cos(secs_arc)
        cairo_move_to(cr,xc,yc)
        cairo_line_to(cr,xs,ys)
    
        cairo_set_line_width(cr,1)
        cairo_stroke(cr)
    end
end

function conky_clock_rings()
    local function setup_rings(cr,pt)
        local str=''
        local value=0
        
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        
        value=tonumber(str)
        pct=value/pt['max']
        
        draw_ring(cr,pct,pt)
    end
    
    -- Check that Conky has been running for at least 5s

    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)
    
    local cr=cairo_create(cs)    
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    
    draw_clock_hands(cr,clock_x,clock_y)
end

screenie:
2013-02-15--1360966612_124x93-thumb_zpsbbddf5dd.png

thanks @ all!


*kaum macht man es richtig, funktioniert es sofort*

Offline

#4794 2013-02-22 09:38:20

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

ansem_of_nexus wrote:

@ragamatrix That is ok, I will get started on it here in a little bit. I should have it done by to night

Thanks a lot for your spending time on it  ansem_of_nexus !
You Rock; It's works fine.
I will change the colors and little things I'm able to do.
Things hard for me easy for you wink
clockhandz

Offline

#4795 2013-02-22 10:12:52

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i want to display images with a static width and with flexible width. but unfortunately my function only display 'normal' images.

function image(im)
x=nil
x=(im.x or 0)
y=nil
y=(im.y or 0)
w=nil
w=(im.w or default_image_width)
h=nil
h=(im.h or default_image_height)
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then width=imlib_image_get_width() 
else width=tonumber(w) end
if tonumber(h)==0 then height=imlib_image_get_height() 
else height=tonumber(h) end
----------------------------------------------
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image_and_decache()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image_and_decache()
show=nil
end--of function

----------------------------------------------
function extern(wb) -- display external images
----------------------------------------------
img_nw=nil
img_x=nil
img_y=nil
img_w=nil
img_h=nil
s=nil
----------------------------------------------
img_x=(wb.posx or 0)
img_y=(wb.posy or 0)
img_w=(wb.imgw or 200)
img_h=(wb.imgh or 200)
----------------------------------------------
img_nw=(wb.imghdd or "external_img.jpg")
s=wb.imgurl -- url of the webcam
img_file='/home/'..username.."/"..img_nw
img_intervall=(wb.imgiv or 60)
hubble=(wb.hubble or 'no')
-- grab external image from url and save it to hdd
local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, img_intervall) == 0) then
os.execute("wget  -q -O "..img_file..' "'..s..'"')
end
------------------------------------------------
if img_file==nil then print("set image file") end
image({x=img_x,y=img_y,w=img_w,h=img_h,file=img_file})
end

end--of function 

function potw_uri()
	local uri = 'http://feeds.feedburner.com/hubble_potw?format=xml'
	local f = assert(io.popen('curl -s '..uri, 'r'))
	local s = assert(f:read('*a'))
	f:close()
	local b = nil
	local e = nil
	b,e,s = string.find(s,'(http://www%.spacetelescope%.org/static/archives/images/news/potw%d-.%.jpg)')
	return(s)
end

how can i display + scale external photos?

please help me something doing this.

Last edited by lionhead (2013-02-22 10:52:48)

Offline

#4796 2013-02-23 10:12:13

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

Just needing some help, my conky keeps flickering in #!, here are my configs:

.conkyrc

# Use Xft?
use_xft yes
xftfont AvantGarde LT ExtraLight:size=8
xftalpha 0.8
text_buffer_size 2048
uppercase yes

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 182 0
maximum_width 202

# Draw shades?
draw_shades no
default_color ffffff #4D4D4D
# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_margin 5
draw_graph_borders no
# border width
border_width 0

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 25
gap_y 40

#	Distric-Thin			fonts
#	Blue Highway
#	Raleway
#	Zekton
#	Calibri
#	Engebrechtre
#	Opeln2001
#	AvantGarde LT ExtraLight
#	AvantGarde LT ExtraLight

# -- Lua Load -- #
lua_load ~/.draw_bg.lua
#lua_draw_hook_pre draw_bg

lua_load ~/.bargraph_small.lua
lua_draw_hook_post main_bars

imlib_cache_size 0

#OPTIONS
#${font AvantGarde LT ExtraLight:pixelsize=10}RAM ${alignr}${mem} ${color #FBAA35}/ ${color #ffffff}${memmax}${alignr}${memperc} ${color #FBAA35}%${font
#DATE ALIGN${alignc -10}${color #FBAA35}${font Neuropolitical:pixelsize=11}${time %a %d %b %Y}${font}
TEXT
${lua conky_draw_bg}
${alignc}${image ~/.conky/logo.png -p 49,20 160x160}








${font Neuropolitical:pixelsize=50}${time %H:%M}${font}
${alignc -5}${color #FBAA35}${font Neuropolitical:pixelsize=11}${time %a %d %b %Y}${font}
${color #FBAA35}${font Neuropolitical:size=8:bold}DETAILS ${color #ffffff}${hr 2} ${font}
${font AvantGarde LT ExtraLight:pixelsize=10}USER: ${alignr}${nodename}
${font AvantGarde LT ExtraLight:pixelsize=10}DISTRO:  ${alignr}${pre_exec cat /etc/issue.net}
${font AvantGarde LT ExtraLight:pixelsize=10}KERNEL: ${alignr}${kernel} 
${font AvantGarde LT ExtraLight:pixelsize=10}ARCH: ${alignr}$machine
${font AvantGarde LT ExtraLight:pixelsize=10}UPTIME: ${alignr}$uptime
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}PROCESSES: ${alignr}$processes ($running_processes running)
${font Neuropolitical:size=8:bold}${color #FBAA35}SYSTEM ${color #ffffff}${hr 2} ${font}
${font AvantGarde LT ExtraLight:pixelsize=10}CPU1:${offset 5}${cpu cpu1}%${font}
${font AvantGarde LT ExtraLight:pixelsize=10}CPU2:${offset 5}${cpu cpu2}%${font}
${font AvantGarde LT ExtraLight:pixelsize=10}CPU3:${offset 5}${cpu cpu3}%${font}
${font AvantGarde LT ExtraLight:pixelsize=10}CPU4:${offset 5}${cpu cpu4}%${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}RAM:   ${memperc}%${font}
${color #FBAA35}${font Neuropolitical:size=8:bold}TOP PROCESSES ${color #ffffff}${hr 2} ${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 1}${alignc -40}${top_mem mem_res 1}${alignr}${top_mem mem 1}${color #FBAA35} %${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 2}${alignc -40}${top_mem mem_res 2}${alignr}${top_mem mem 2}${color #FBAA35} %${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 3}${alignc -40}${top_mem mem_res 3}${alignr}${top_mem mem 3}${color #FBAA35} %${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 4}${alignc -40}${top_mem mem_res 4}${alignr}${top_mem mem 4}${color #FBAA35} %${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 5}${alignc -40}${top_mem mem_res 5}${alignr}${top_mem mem 5}${color #FBAA35} %${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}${top_mem name 6}${alignc -40}${top_mem mem_res 6}${alignr}${top_mem mem 6}${color #FBAA35} %${font}
${color #FBAA35}${font Neuropolitical:size=8:bold}TEMP ${color #ffffff}${hr 2} ${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}CPU TEMP0: ${alignr}${execp sensors coretemp-isa-0000 | grep 'Core 0' | cut -c16-17} ${color #FBAA35}°C${color #ffffff} / ${color #ffffff}105${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}CPU TEMP1: ${alignr}${execp sensors coretemp-isa-0000 | grep 'Core 2' | cut -c16-17} ${color #FBAA35}°C${color #ffffff} / ${color #ffffff}105${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}TEMP2: ${alignr}${exec sensors it8721-isa-0a10 | grep 'temp2' | cut -c16-17} ${color #FBAA35}°C${color #ffffff} / ${color #ffffff}127${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}TEMP3: ${alignr}${exec sensors it8721-isa-0a10 | grep 'temp3' | cut -c16-17} ${color #FBAA35}°C${color #ffffff} / ${color #ffffff}127${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}M-BOARD TEMP: ${alignr}${exec sensors it8721-isa-0a10 | grep 'temp1' | cut -c16-17} ${color #FBAA35}°C${color #ffffff} / ${color #ffffff}80${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}HD-DISK TEMP:${alignr}${exec hddtemp /dev/sda -n --unit=C}${color #FBAA35} °C${color #ffffff} / ${color #ffffff}70${color #FBAA35} °C$color
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}FAN SPEED: ${alignr}${exec sensors it8721-isa-0a10 | grep 'fan1' | cut -c12-18}${font}${color #FBAA35} RPM
${color #FBAA35}${font Neuropolitical:size=8:bold}DATA ${color #ffffff}${hr 2} ${font}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}DL SPEED: ${downspeed eth0} kb/s ${alignr}${downspeedgraph eth0 4,80 000000 000000}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}UL SPEED: ${upspeed eth0} kb/s ${alignr}${upspeedgraph eth0 4,80 000000 000000}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}TOTAL DL ${alignr}${totaldown eth0}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}TOTAL UL ${alignr}${totalup eth0}
${font AvantGarde LT ExtraLight:pixelsize=10}${color #ffffff}Public IP${alignr}${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}${font}
${color #FBAA35}${font Neuropolitical:size=8:bold}AUDACIOUS ${color #ffffff}${hr 2} ${font}

${if_running audacious}${execpi 3 ~/.conky/shell-scripts/audacious-info.sh}
${image ~/.conky/img.png -p ,4 -s 112x114}${endif}

lua code:

--[[	Background by londonali1010 (2009)
	VinDSL Background Hack (2010-2011)

This script draws a background to the Conky window. It covers the whole of the Conky window, but you can specify rounded corners, if you wish.

To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
	lua_load ~/scripts/draw_bg.lua
	lua_draw_hook_pre draw_bg

Changelog:
	+ v3.1	VinDSL Hack (12.01.2011) Added more shading example(s).
	+ v3.0	VinDSL Hack (01.28.2011) Killed memory leak.
	+ v2.4	VinDSL Hack (01.25.2011) Declared all variables in local.
	+ v2.3	VinDSL Hack (12.31.2010) Added shading example(s).
	+ v2.2	VinDSL Hack (12.30.2010) Cleaned up the code a bit.
	+ v2.1	VinDSL Hack (12.24.2010) Added cairo destroy function(s).
	+ v2.0	VinDSL Hack (12.21.2010) Added height adjustment variable.
	+ v1.0	Original release (07.10.2009)

]]

--------------START OF PARAMETERS ------------
-- Change these settings to affect your background:

-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.

	local corner_r = 13

-- Set the colour and transparency (alpha) of your background (0.00 - 0.99).

--	(Light Shading Example)
--	local bg_colour = 0x4d4d4d
--	local bg_alpha = 0.01

--	(Medium Shading Example)
--	local bg_colour = 0x222222
--	local bg_alpha = 0.08

--	(Dark Shading Example)
	local bg_colour = 0x000000
	local bg_alpha = 0.45

--	(Brown Shading Example)
--	local bg_colour = 0x330000
--	local bg_alpha = 0.15

--	(Ivory Black Shading Example)
--	local bg_colour = 0x292421
--	local bg_alpha = 0.05

--	(Metallic Gold Shading Example)
--	local bg_colour = 0xd4af37
--	local bg_alpha = 0.01

--	(Navy Blue Shading Example)
--	local bg_colour = 0x33339F
--	local bg_alpha = 0.11

--	(Olive Green Shading Example)
--	local bg_colour = 0x333319
--	local bg_alpha = 0.08

--	(Silver Shading Example)
--	local bg_colour = 0xc0c0c0
--	local bg_alpha = 0.01

-- Tweaks the height of your background, in pixels. If you don't need to adjust the height, use 0.

--	(Default Setting)
--	local vindsl_hack_height = 0

	local vindsl_hack_height = 0

---------------END OF PARAMETERS -------------

require 'cairo'
local	cs, cr = nil

local function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end

function conky_draw_bg()
	if conky_window == nil then return end
	if cs == nil then cairo_surface_destroy(cs) end
	if cr == nil then cairo_destroy(cr) end
	local w = conky_window.width
	local h = conky_window.height
	local v = vindsl_hack_height
	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	local cr = cairo_create(cs)
	
	cairo_move_to(cr,corner_r,0)
	cairo_line_to(cr,w-corner_r,0)
	cairo_curve_to(cr,w,0,w,0,w,corner_r)
	cairo_line_to(cr,w,h+v-corner_r)
	cairo_curve_to(cr,w,h+v,w,h+v,w-corner_r,h+v)
	cairo_line_to(cr,corner_r,h+v)
	cairo_curve_to(cr,0,h+v,0,h+v,0,h+v-corner_r)
	cairo_line_to(cr,0,corner_r)
	cairo_curve_to(cr,0,0,0,0,corner_r,0)
	cairo_close_path(cr)

	cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
	cairo_fill(cr)

	cairo_surface_destroy(cs)
	cairo_destroy(cr)
	end

Cheers

Offline

#4797 2013-02-23 13:56:48

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Dobbie03 wrote:

Just needing some help, my conky keeps flickering in #!, here are my configs:

Hi Dobbie03

I don't think it's because it's #! but because of a few other factors.

One you are using a minimum and maximum width that are different allowing the conky window to "resize" (width) when certain conditions are met.

ie: using a large non-mono font for your clock you can see the differences in the clock here:
abgu2NOT.jpg
BTW: 10:24 is the real clock time the others are hard coded.

That 23:23 is wider than your: "minimum_size 182 0" so it will "expand" the width of your conky window, causing a redraw.

Look what happens to the width when I remove the fake times (set minimum_width to 150 for this just to show you):
adbv5sjx.jpg

So some solutions for your code:

minimum_size 205 0
maximum_width 205

should fix that "blinking problem".  More reading on the subject.

Next another fix for you: border_margin is defunct, try these:

# border margins
border_inner_margin 5
border_outer_margin 0

And a neat thing to know.  Before reading on try, a "right click" on your conky to get at the OpenBox menu - doesn't work does it.  Here's a fix:

own_window_type normal #desktop

Now you should be able to right click on your conky for the OB menu.

Another:

${alignc}${image ~/.conky/logo.png -p 49,20 160x160}

${alignc} does not work on images. The "-p" command positions the images.  As for the size you need a -s in front of that 160x160.  IF that 160x160 is the actual size of the image you are using you can just eliminate it I believe.  --- I have never used an image at actual size.

${image ~/.conky/logo.png -p 49,20 -s 160x160}

BTW:  min - max set to 205:
abn3SAfx.jpg

Hope this helps.

Last edited by Sector11 (2013-02-23 13:59:11)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#4798 2013-02-23 18:17:53

Dobbie03
Resident Metaller
From: New Zealand
Registered: 2009-08-15
Posts: 1,591

Re: Conky v1.9 Thread

@Sector11, it does more than help. Wow, thanks so much for the tips.  I was in full on "hope this works" mode when I made this conky and I don't know how many other conky configs I had to borrow little parts from.  Thanks for the help!

Offline

#4799 2013-02-23 18:58:54

ichase
#! CrunchBanger
Registered: 2011-03-16
Posts: 146

Re: Conky v1.9 Thread

Greetings all,
Has been quite some time since I have been able to get back on here and back to playing with Conky.  At the request of Sector 11, I am posting the scripts and configs to the conkys in the screenshot below.
a76155238928740.jpg

The date on the bottom was the creation of mobilediesel, I have been using this for a very long time:

.conkyrc_date

alignment bottom_right
background no
gap_x 0
gap_y 0
minimum_size 280 
maximum_width 280

update_interval 1
total_run_times 0
double_buffer yes
no_buffers yes
text_buffer_size 1248

cpu_avg_samples 2
net_avg_samples 2

use_xft yes
xftfont HanelGotD:size=9
xftalpha 0.5
override_utf8_locale yes

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints below,undecorated,sticky,skip_taskbar,skip_pager
#below,  normal  override

draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

#default_color 86b5ea
default_color red
#default_color firebrick
#default_color green
#default_color blue
#default_color deeppink
#default_color yellow
#default_color darkslateblue
#default_color darkviolet
color1 white
default_shade_color 7a999c
default_outline_color green

TEXT
${alignr 5}${font digitalk:size=30}${color1}${goto 8}${time %C}${goto 203}${time %y}${color}${font}
${alignr 5}${goto 63}${voffset -25}${execpi 3600 ~/Scripts/week_2.sh}

${alignr 5}${font monospace:bold:size=16}${goto 50}${color1}${time %a}${goto 160}${time %b}${color1}${voffset -55}

The script that makes it happen:

#!/bin/bash

font=("\${voffset -10}\${font digitalk:size=4}" "\${voffset -0}\${font digitalk:size=8}" "\${voffset -0}\${font digitalk:size=12}" "\${voffset -3}\${font digitalk:size=30}\${color 00FFFF}" "\${voffset -15}\${font digitalk:size=12}" "\${voffset -4}\${font digitalk:size=7}" "\${voffset -2}\${font digitalk:size=4}")
color=("" "" "" "\${color}" "" "" "")

for i in $(seq -3 3); do
echo -n "${font[$[i+3]]}$(date '+%d' -d "$i days")${color[3]}\${offset 3}"
done

The conky on the right is nothing to brag about, just simple info though I am trying to figure out how to get rid of the strange "A" symbol that shows up before Farenheit in the TEMPS section.

.conkyrc

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 400
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_right
gap_x 15
gap_y 5
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

#default_color 86b5ea
default_color blue
#default_color firebrick
#default_color green
#default_color blue
#default_color deeppink
#default_color yellow
#default_color darkslateblue
#default_color darkviolet
color1 white
default_shade_color 7a999c
default_outline_color green

TEXT
${color1}${font Radio Space:bold:size=10:}SYSTEM${hr 2}
${font sans-serif:normal:size=8}$sysname $kernel $alignr $machine
Host:$alignr$nodename
Uptime:$alignr$uptime
File System: $alignr${fs_type}

${font Radio Space:bold:size=10}${color1}PROCESSORS ${hr 2}${font sans-serif:normal:size=8}${color1}
${color1}CPU0: ${cpu cpu0}% ${color}${cpubar cpu0}
${color1}CPU1: ${cpu cpu1}% ${color}${cpubar cpu1}
${color1}CPU2: ${cpu cpu2}% ${color}${cpubar cpu2}
${color1}CPU3: ${cpu cpu3}% ${color}${cpubar cpu3}
${color1}CPU4: ${cpu cpu4}% ${color}${cpubar cpu4}

${font Radio Space:bold:size=10}${color1}TEMPS ${hr 2}${font sans-serif:normal:size=8}${color1}
${color1}CORE 1: ${color red}${exec sensors -f | grep "Core 0" | cut -c8-24}
${color1}CORE 2: ${color red}${exec sensors -f | grep "Core 2" | cut -c8-24}

${font Radio Space:bold:size=10}${color1}BATTERY ${hr 2}${font sans-serif:normal:size=8}${color1}
${color1}ACPI Battery: ${color}${battery_short}   ${battery_bar 11,0}
${color1}Remaining Time: ${color1}$battery_time

${font Radio Space:bold:size=10}${color1}MEMORY ${hr 2}
${font sans-serif:normal:size=8}${color1}RAM $alignc $mem / $memmax $alignr $memperc% 
${color}$membar

${font Radio Space:bold:size=10}${color1}DISK SPACE ${hr 2} 
${font sans-serif:normal:size=8}${color1}/ $alignc ${fs_used /} / ${fs_size /} $alignr${fs_used_perc /}%
${color}${fs_bar /}

${font Radio Space:bold:size=10}${color1}TOP PROCESSES ${hr 2}
${color red}${font sans-serif:normal:size=8}${color red}${top_mem name 1}${alignr}${top mem 1} %
${color1}${top_mem name 2}${alignr}${top mem 2} %
${color1}$font${top_mem name 3}${alignr}${top mem 3} %
${color1}$font${top_mem name 4}${alignr}${top mem 4} %
${color1}$font${top_mem name 5}${alignr}${top mem 5} %

${font Radio Space:bold:size=10}${color1}NETWORK ${hr 2}
${font sans-serif:normal:size=8}${color1}IP address: $alignr ${addr wlan0}
ESSID: $alignr ${wireless_essid wlan0}
Connection Quality: $alignr ${wireless_link_qual_perc wlan0}%

#${font Radio Space:bold:size=10}${color1}CURRENT WEATHER ${hr 2}
#${color1}${execi 300 /home/ichase02/weather.sh 23454}
#$alignr Download
#${color}${downspeedgraph wlan0}
#${color}${downspeed wlan0}/s $alignr ${totaldown wlan0}

#${color1}$alignr Upload
#${color}${upspeedgraph wlan0}
#${color}${upspeed wlan0}/s $alignr ${totalup wlan0}

You will notice some stuff commented out because it was not fitting on the screen and running into the date conky below it.  Also, I play around with the text colors alot so you will notice a lot of color references in this config file as well.

The awesome weather conky of course is from TeoBigusGeekus' Conky Weather scripts thread.

Hope everyone is doing well and that 2013 has been a good year for you so far.

All the best

Ian

Last edited by ichase (2013-02-23 19:00:53)

Offline

Be excellent to each other!

#4800 2013-02-23 18:59:30

sevensage
#! CrunchBanger
Registered: 2012-11-10
Posts: 134

Re: Conky v1.9 Thread

Sector11, wow!  I'll be reading that 2 or 3 more times. Thank-you!


dig +short txt crunchbang.wp.dg.cx

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo