Re: My Conky Config

heres my first attempt to put animation in conky to a practical purpose...
battery indicator
http://blip.tv/file/3156969

from tawan's tip above about using if_existing this object has 3 modes

if the battery is plugged in and charging (ie battery_percent < 100)
then you get the charging animation in the above link

if the battery is plugged in and is fully charged
then you get a solid green fill

if the battery is unplugged you get a red fill that is proportional to current battery_percent

the object should be fully scalable and placeable via the setup in the lua file

battery.lua

--[[battery indicator by mrpeachy (2010) uses code from Background by londonali1010]]
--set rectangle corner
rc=10
--set rectangle width
rw=25
--set rectangle height
rh=50
--set line width
lw=4
--set translation point
down=50
across=50

require 'cairo'
function conky_draw_battery()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

local batperc=conky_parse('${battery_perc}')
batpercnum=tonumber(batperc)
local batnum=(rh/100)*batpercnum
local timer=(update_num % 4)+1
local onoff=conky_parse('${if_existing /sys/class/power_supply/ACAD/online}1${else}0${endif}')

if (batpercnum == 100 and onoff == 1) then
--plugged in but fully charged
cairo_set_source_rgba (cr, 0, 1, 0, 1);
cairo_set_line_width (cr, rw-lw);
cairo_move_to (cr, (rw/2)+across, rh+down-(lw/2));
cairo_rel_line_to (cr, 0, -batnum+lw);
cairo_stroke (cr);
elseif onoff == 1 then
--battery charging animation
cairo_set_source_rgba (cr, 0, 1, 0, 1);
cairo_set_line_width (cr, rw-lw);
cairo_move_to (cr, (rw/2)+across, rh+down-(lw/2));
cairo_rel_line_to (cr, 0, -timer*(batpercnum/4)+lw);
cairo_stroke (cr);
else
--battery unplugged indicator
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_set_line_width (cr, rw-lw);
cairo_move_to (cr, (rw/2)+across, rh+down-(lw/2));
cairo_rel_line_to (cr, 0, -batnum+lw);
cairo_stroke (cr);
end
--battery outline
cairo_translate (cr, across, down);
cairo_set_source_rgba(cr, 0, 0, 0, 1)
cairo_set_line_width (cr, lw);
cairo_move_to(cr,rc,0);
cairo_line_to(cr,rw-rc,0);
cairo_curve_to(cr,rw,0,rw,0,rw,rc);
cairo_line_to(cr,rw,rh-rc);
cairo_curve_to(cr,rw,rh,rw,rh,rw-rc,rh);
cairo_line_to(cr,rc,rh);
cairo_curve_to(cr,0,rh,0,rh,0,rh-rc);
cairo_line_to(cr,0,rc);
cairo_curve_to(cr,0,0,0,0,rc,0);
cairo_close_path (cr);
cairo_stroke (cr);
end
end

and in conky you need

lua_load /~path to file~/battery.lua
lua_draw_hook_pre draw_battery
TEXT

if you try it out, let me know if it works for you
edit - i just thought that if you substitute (batnum/4) for (rh/4) in line 42 then the charging animation will also show you current charge level
edit2 - i just thought again that line 30 is missing an "and"... otherwise when battery is at 100% the indicator will stay green even if you unplug
just have to look into putting and's in lua smile --- think i fixed it
edit3 - made minor change so that indicator bar was not covered by outline

Last edited by mrpeachy (2010-02-23 05:04:38)

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: My Conky Config

good job mrpeachy, your scripts are definitely improving big_smile

I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Re: My Conky Config

iggykoopa wrote:

good job mrpeachy, your scripts are definitely improving big_smile

thank you very much... still got a long way to go before i can claim that i know what im doing
like French... i can ask somone the way to the library... but beyond that its just noise smile

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: My Conky Config

http://omploader.org/tM2Zubg

fullscreen conky

screen.lua

--[[fullscreen with edited outputs by mrpeachy (2010)]]
require 'cairo'

function addzero100(num)
    if tonumber(num) < 10 then
        return "00" .. num
    elseif tonumber(num) <100 then
        return "0" .. num
    else
        return num
    end
end
function addzero10(num)
    if tonumber(num) < 10 then
        return "0" .. num
    else
        return num
    end
end

function string:split(delimiter)
  local result = { }
  local from  = 1
  local delim_from, delim_to = string.find( self, delimiter, from  )
  while delim_from do
    table.insert( result, string.sub( self, from , delim_from-1 ) )
    from  = delim_to + 1
    delim_from, delim_to = string.find( self, delimiter, from  )
  end
  table.insert( result, string.sub( self, from  ) )
  return result
end

function conky_draw_it()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
--this section generates numbers only uptime ddhhmm
local uptime=conky_parse("${uptime}")
utdcalc=string.gsub(uptime, "[%d ]", "")
utime=string.split(uptime, "%a ")
for index,today in pairs(utime) do
end
if utdcalc=="hms" then 
utd="00"
uth=addzero10(utime[1])
utm=addzero10(utime[2])
else
utd=addzero10(utime[1])
uth=addzero10(utime[2])
utm=addzero10(utime[3])
end
cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 200);
cairo_set_source_rgba (cr, 0, 0, 0, 0.3);
cairo_move_to (cr, 261, 480);
cairo_show_text (cr, (utd .. uth .. utm))
--this section prints number only kernel information 
local kernel1=conky_parse("${kernel}")
kernel=string.gsub(kernel1, "[%a .-]", "")
cairo_move_to (cr, 0, 800);
cairo_show_text (cr, (kernel))
--this section formats downspeed
local downspeed=conky_parse("${downspeed}")
downnum=string.gsub(downspeed, "[%a ]", "")
dwnspcalc=string.split(downnum, "%p")
for index,today in pairs(dwnspcalc) do
end
dwnumunit1=string.gsub(downspeed, "[%p%d]", "")
dwnumunit=string.gsub(dwnumunit1, "iB", "")
if dwnumunit=="M" then
dspmb=string.gsub(downnum, ".$", "")
cairo_move_to (cr, 784, 800);
cairo_show_text (cr, (dspmb) .. (dwnumunit));
else
cairo_move_to (cr, 784, 800);
cairo_show_text (cr, (addzero100(dwnspcalc[1]) .. dwnumunit));
end
--this section formats upspeed
local upspeed=conky_parse("${upspeed}")
upnum=string.gsub(upspeed, "[%a ]", "")
upspcalc=string.split(upnum, "%p")
for index,today in pairs(upspcalc) do
end
upumunit1=string.gsub(upspeed, "[%p%d]", "")
upumunit=string.gsub(upumunit1, "iB", "")
cairo_move_to (cr, 261, 320);
cairo_show_text (cr, (addzero100(upspcalc[1]) .. upumunit));
--this section formats top process
local topproc1=conky_parse("${top name 1}")
topproc=string.gsub(topproc1, "[%p]", "")
top1=string.upper(topproc)
top2=string.gsub(top1, "%a", "%1-")
top=string.split(top2, "%p")
for index,today in pairs(top) do
end
cairo_move_to (cr, 0, 640);
cairo_show_text (cr, (top[1]) .. (top[2]) .. (top[3]) .. (top[4]));
--this section formats time outputs
--hours
hrs=os.date("%H")
--minutes
min=os.date("%M")
--seconds
sec=os.date("%S")
--year
yr=os.date("%y")
--month
mnt=os.date("%m")
--day
day=os.date("%d")
--this sectiion formats common conky outputs
--cpu
local cpunum=conky_parse("${cpu}")
cpu=tonumber(cpunum)
--mem
local memnum=conky_parse("${memperc}")
mem=tonumber(memnum)
--hdd
local hddnum=conky_parse("${fs_used_perc /}")
hdd=tonumber(hddnum)
--swap
local swapnum=conky_parse("${swapperc}")
swap=tonumber(swapnum)

cairo_move_to (cr, 0, 160);
cairo_show_text (cr, (hrs) .. (addzero100(swap)) .. (mnt) .. (addzero100(cpu)) .. "L");
cairo_move_to (cr, 0, 320);
cairo_show_text (cr, (min))
cairo_move_to (cr, 784, 320);
cairo_show_text (cr, (day) .. "20I")
cairo_move_to (cr, 0, 480);
cairo_show_text (cr, (sec))
cairo_move_to (cr, 1043, 480);
cairo_show_text (cr, (yr) .. "N")
cairo_move_to (cr, 522, 640);
cairo_show_text (cr, (addzero100(hdd)) .. (addzero100(mem)) .. "U")
cairo_move_to (cr, 1307, 800);
cairo_show_text (cr, "X")
end
end

and in conky

lua_load /~path to file/screen.lua
lua_draw_hook_pre draw_it
TEXT

this display is set for a 1440x900 ratio so it wont translate very well to other ratios.
also this assumes that your download speed will not exceed 9.9MB/s and upload will not exceed 999KB/s

Last edited by mrpeachy (2010-02-23 04:59:20)

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.

855

Re: My Conky Config

the whole screen looks like this
http://omploader.org/tM2ZudQ

the conky does stuff like this (this was downloading and the speed never went above 2 ninja stars but can reach 3. One CPU peaked once or twice.

This is an animation, if it is not moving then it is loading (under 200kb)
http://omploader.org/vM2Zvcg/conky.gif

#  Settings
##############################################
# Use XftD
use_xft yes
xftfont Bauhaus Md BT:size=8
xftalpha 1.0
text_buffer_size 2048
if_up_strictness address

# 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 no
own_window_transparent yes
own_window_type normal
#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 350
#maximum_width 350

# Draw shadesD
draw_shades no

# Draw outlinesD
draw_outline no

# Draw borders around text
draw_borders no

# Stippled bordersD
stippled_borders 0

# border margins
border_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color FFFFDD
#good blue 1994d1
color1 000000
color2 1994d1
color3 e40022
color4 fcf322
#default_shade_color 888888
#default_outline_color 888888
own_window_colour 000000

# Text alignment, other possible values are commented
alignment tl

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

# Subtract file system buffers from used memoryD
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 1

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2


# Force UTF8D note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving aboutD  This only affects certain objects.
use_spacer none

TEXT


${goto 100}${color3}${font Radio space:size=72}${time %l:%M}${font Radio space:size=22}${time %P}${font}
${goto 105}${color4}${font Jura:size=16}${time %A %e %B}${font}${color}










































${font pizzadude bullets:size=14}${color2}
${goto 224}${voffset -6}${if_match ${upspeedf wlan0} >= 90}?${else} ${endif}    ${goto 254}${if_match ${downspeedf wlan0} >= 90}?${else} ${endif}
${goto 224}${voffset -6}${if_match ${upspeedf wlan0} >= 40}?${else} ${endif}    ${goto 254}${if_match ${downspeedf wlan0} >= 40}?${else} ${endif}
${goto 224}${voffset -6}${if_match ${upspeedf wlan0} >= 20}?${else} ${endif}    ${goto 254}${if_match ${downspeedf wlan0} >= 20}?${else} ${endif}${font}
${if_up wlan0}${if_existing /home/tawan/mybin/conky-on}${goto 190}${color1}${offset -3}${voffset -15}${font Rebecca:size=37}${execpi 900 python ~/.conky/gmail_parser.py NAME PASSWORD 1}${font}    ${goto 220}${voffset -15}${font pizzadude bullets:size=20}${if_match ${upspeedf wlan0} >= 20}${color2}w${else}${if_match ${upspeedf wlan0} >= 2}${color2}v${else}${color1}v${endif}${endif}${color1}    ${goto 250}${if_match ${downspeedf wlan0} >= 40}${color2}s${else}${if_match ${downspeedf wlan0} >= 2}${color2}r${else}${color1}r${endif}${endif}${color1}    ${goto 280}${execpi 5000 ~/mybin/tawan-check-updates}${endif}${endif}    ${goto 310}${font StyleBats:size=22}${if_match ${fs_used_perc /home/tawan/Data} >= 75}${color3}${else}${if_match ${diskio /dev/sda} >= 1}${color2}${else}${color1}${endif}8${endif}${color1}    ${goto 340}${voffset 2}${if_match ${memperc} >= 80}${color3}${else}${if_match ${memperc} >= 40}${color2}${else}${color1}${endif}${endif}y${color1}    ${goto 370}${voffset -2}${if_match ${cpu cpu1} >= 90}${color3}${else}${if_match ${cpu cpu1} >= 40}${color2}${else}${color1}${endif}${endif}a${color1}    ${goto 400}${if_match ${cpu cpu2} >= 90}${color3}${else}${if_match ${cpu cpu2} >= 40}${color2}${else}${color1}${endif}${endif}a${color1}    ${goto 430}${voffset 1}${font StyleBats:size=22}${if_match ${acpitemp} >= 70}${color3}${else}${if_match ${acpitemp} >= 60}${color2}${else}${color1}${endif}${endif}p${color1}    ${goto 460}${if_match ${battery_percent BAT0} <= 20}${color3}O${else}${if_existing /sys/class/power_supply/ACAD/online 1}${color1}I${else}${color2}O${endif}${endif}















































${if_existing /sys/class/power_supply/ACAD/online 0}${if_match ${battery_percent BAT0} <= 11}${if_match ${battery_percent BAT0} > 8}${execi 300 ~/mybin/tawan-warn-shutdown}${endif}${endif}${if_match ${battery_percent BAT0} <= 8}${execi 200 ~/mybin/tawan-shutdown-now}${endif}${endif}

Last edited by tawan (2010-02-03 08:38:30)

I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

Re: My Conky Config

random number generates the alpha for each piece of information
dont know if this will give me a seizure... but I'll shall find out

http://omploader.org/tM2Z6OQ 

watch
http://blip.tv/file/3172477


changed colors and made the random alpha range much narrower
get a much more subtle and gentle effect.  calculation is (math.random(5,25) instead of (math.random(20,50) below
http://omploader.org/tM2Z6bA

screen.lua

--[[fullscreen with edited outputs version 2 by mrpeachy (2010)]]
require 'cairo'

function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
function addzero10(num)
if tonumber(num) < 10 then
return "0" .. num
else
return num
end
end

function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
function conky_draw_it()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
--sets font,  font size and color
cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 200);
cairo_set_source_rgba (cr, 1, 1, 1, 1);
--this section generates numbers only uptime ddhhmm
local uptime=conky_parse("${uptime}")
utdcalc=string.gsub(uptime, "[%d ]", "")
utime=string.split(uptime, "%a ")
if utdcalc=="hms" then 
utd="00"
uth=addzero10(utime[1])
utm=addzero10(utime[2])
else
utd=addzero10(utime[1])
uth=addzero10(utime[2])
utm=addzero10(utime[3])
end
--this section prints number only kernel information 
local kernel1=conky_parse("${kernel}")
kernel=string.gsub(kernel1, "[%a .-]", "")
--this section formats downspeed
local downspeed=conky_parse("${downspeed}")
downnum=string.gsub(downspeed, "[%a ]", "")
dwnspcalc=string.split(downnum, "%p")
dwnumunit1=string.gsub(downspeed, "[%p%d]", "")
dwnumunit=string.gsub(dwnumunit1, "iB", "")
if dwnumunit=="M" then
dspmb=string.gsub(downnum, ".$", "")
dsnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, dsnum);
cairo_move_to (cr, 784, 800);
cairo_show_text (cr, (dspmb) .. (dwnumunit));
else
dsnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, dsnum);
cairo_move_to (cr, 784, 800);
cairo_show_text (cr, (addzero100(dwnspcalc[1]) .. dwnumunit));
end
--this section formats upspeed
local upspeed=conky_parse("${upspeed}")
upnum=string.gsub(upspeed, "[%a ]", "")
upspcalc=string.split(upnum, "%p")
upumunit1=string.gsub(upspeed, "[%p%d]", "")
upumunit=string.gsub(upumunit1, "iB", "")
--this section formats top process
local topproc1=conky_parse("${top name 1}")
topproc=string.gsub(topproc1, "[%p]", "")
top1=string.upper(topproc)
top2=string.gsub(top1, "%a", "%1-")
top=string.split(top2, "%p")
--this section formats time outputs
--hours
hrs=os.date("%H")
--minutes
min=os.date("%M")
--seconds
sec=os.date("%S")
--year
yr=os.date("%y")
--month
mnt=os.date("%m")
--day
day=os.date("%d")
--this sectiion formats common conky outputs
--cpu
local cpunum=conky_parse("${cpu}")
cpu=tonumber(cpunum)
--mem
local memnum=conky_parse("${memperc}")
mem=tonumber(memnum)
--hdd
local hddnum=conky_parse("${fs_used_perc /}")
hdd=tonumber(hddnum)
--swap
local swapnum=conky_parse("${swapperc}")
swap=tonumber(swapnum)

--prints text
--uptime
utmnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, utmnum);
cairo_move_to (cr, 261, 480);
cairo_show_text (cr, (utd .. uth .. utm))
--kernel
knum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, knum);
cairo_move_to (cr, 0, 800);
cairo_show_text (cr, (kernel))
--upspeed
upsdnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, upsdnum);
cairo_move_to (cr, 261, 320);
cairo_show_text (cr, (addzero100(upspcalc[1]) .. upumunit));
--top process
tpnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, tpnum);
cairo_move_to (cr, 0, 640);
cairo_show_text (cr, (top[1]) .. (top[2]) .. (top[3]) .. (top[4]));
--time hours
thnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, thnum);
cairo_move_to (cr, 0, 160);
cairo_show_text (cr, (hrs));
--swapperc
swnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, swnum);
cairo_move_to (cr, 261, 160);
cairo_show_text (cr, (addzero100(swap)));
--month
monnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, monnum);
cairo_move_to (cr, 653, 160);
cairo_show_text (cr, (mnt));
--cpu
cnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, cnum);
cairo_move_to (cr, 915, 160);
cairo_show_text (cr, (addzero100(cpu)));
--time minutes
cairo_set_source_rgba (cr, 1, 1, 1, thnum);
cairo_move_to (cr, 0, 320);
cairo_show_text (cr, (min));
--day
cairo_set_source_rgba (cr, 1, 1, 1, monnum);
cairo_move_to (cr, 784, 320);
cairo_show_text (cr, (day));
--year 20
yrnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, yrnum);
cairo_move_to (cr, 1043, 320);
cairo_show_text (cr, "20");
--time seconds
cairo_set_source_rgba (cr, 1, 1, 1, thnum);
cairo_move_to (cr, 0, 480);
cairo_show_text (cr, (sec));
--year 10
cairo_set_source_rgba (cr, 1, 1, 1, yrnum);
cairo_move_to (cr, 1043, 480);
cairo_show_text (cr, (yr));
--hdd used
hdnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, hdnum);
cairo_move_to (cr, 522, 640);
cairo_show_text (cr, (addzero100(hdd)));
--memory
mnum=(math.random(20,50))/100
cairo_set_source_rgba (cr, 1, 1, 1, mnum);
cairo_move_to (cr, 915, 640);
cairo_show_text (cr, (addzero100(mem)));
end
end

conky

color1 grey


lua_load /~path to file/screen.lua
lua_draw_hook_pre draw_it
TEXT
${voffset 12}${color1}${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=0}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --datatype=WF}${font Mono:size=10}
${goto 1315}Temp : ${execi 3600 conkyForecast --location=USMO0787 --datatype=HT --imperial}
${goto 1315}Feels: ${execi 3600 conkyForecast --location=USMO0787 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --datatype=HM}
${goto 1315}Wind: ${execi 3600 conkyForecast --location=USMO0787 --datatype=WS --imperial},${execi 3600 conkyForecast --location=USMO0787 --datatype=WD}
${goto 1315}${font Mono:size=10}Sunset: ${execi 3600 conkyForecast --location=USMO0787 --datatype=SS}
${font Mono:size=5}
${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=1}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=WF}${font Mono:size=10}
${goto 1315}High : ${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=HT --imperial}
${goto 1315}Low  : ${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=HM}
${font Mono:size=5}
${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=2}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=WF}${font Mono:size=10}
${goto 1315}High : ${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=HT --imperial}
${goto 1315}Low  : ${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=HM}
${font Mono:size=5}
${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=3}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=WF}${font Mono:size=10}
${goto 1315}High : ${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=HT --imperial}
${goto 1315}Low  : ${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=HM}
${font Mono:size=5}
${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=4}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=WF}${font Mono:size=10}
${goto 1315}High : ${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=HT --imperial}
${goto 1315}Low  : ${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=HM}
${font Mono:size=5}
${font Mono:size=12}${goto 1315}${execi 3600 conkyForecast --datatype=DW --startday=5}${font Mono:size=12}
${font ConkyWeather:size=26}${goto 1315}${execi 3600 conkyForecast --location=USMO0787 --startday=5 --datatype=WF}${font Mono:size=10}
${goto 1315}High : ${execi 3600 conkyForecast --location=USMO0787 --startday=5 --datatype=HT --imperial}
${goto 1315}Low  : ${execi 3600 conkyForecast --location=USMO0787 --startday=5 --datatype=LT --imperial}
${goto 1315}Rain : ${execi 3600 conkyForecast --location=USMO0787 --startday=5 --datatype=PC}
${goto 1315}Humid: ${execi 3600 conkyForecast --location=USMO0787 --startday=5 --datatype=HM}

Last edited by mrpeachy (2010-02-23 04:59:38)

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: My Conky Config

Hi,
I'm following this thread for a while and now i want to show you my desktop:
http://bildupload.sro.at/a/thumbs/8-screenshot.jpg

system:
+ crunchbang 9.04
+ gtk-theme is a modified perfection 3.0
+ icons are simple-mobilin
+ conky-all 1.8
+ rings-v1.2.1.lua

It works, but I've got a problem with the cpu-cores in the rings-v1.2.1.lua-script. Every time i change the cpu-variable from cpu0 to cpu1 I've got an error:

Conky: obj->data.i 1 info.cpu_count 0
Conky: attempting to use more CPUs than you have!

i hope here is somebody who can help me, because google doesn't...

----
PS: Sorry for my bad english. It's not my native language.

Greetings Lomion


.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 desktop
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
 
border_inner_margin 0
border_outer_margin 0
 
minimum_size 350 50
maximum_width 1000
 
alignment tl
gap_x 0
gap_y 0
 
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
 
# -- Text settings -- #
use_xft yes
xftfont Sans:size=7
xftalpha 0.8
 
uppercase no
 
default_color 666666


lua_load ~/.scripts/rings-v1.2.1.lua
lua_draw_hook_pre ring_stats


##############################################
#  Output 
##############################################
TEXT

${goto 60}Temperatur:${goto 125}${color 0090B4}${acpitemp}°C$color${goto 160}Up:${goto 195}${if_up wlan0}${color 0090B4}${upspeed wlan0}$color${else}${color 0090B4}${upspeed eth0}$color${endif}${goto 240}j.schmahl@sign9.de:${goto 342}${color 0090B4}${execi 1800 conkyEmail --template=~/.scripts/conkyemail_jschmahl.template}$color
${voffset -10}${goto 60}Updates:${goto 125}${color 0090B4}${execi 3600 aptitude search "~U" | wc -l | tail}$color${goto 160}Down:${goto 195}${if_up wlan0}${color 0090B4}${downspeed wlan0}$color${else}${color 0090B4}${downspeed eth0}$color${endif}${goto 240}info@sign9.de:${goto 315}${color 0090B4}${execi 1800 conkyEmail --template=~/.scripts/conkyemail_info.template}$color

rings-v1.2.1.lua

--[[
Ring Meters by londonali1010 (2009)
 
This script draws percentage meters as rings. It is fully customisable; all options are described in the 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/rings-v1.2.1.lua
    lua_draw_hook_pre ring_stats
 
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
 
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='cpu',
        -- "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='cpu0',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=100,
        -- "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.2,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0x0090B4,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=1,
        -- "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=25, y=25,
        -- "radius" is the radius of the ring.
        radius=14,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=2,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=20,
        -- "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 (e.g. more clockwise) than start_angle.
        end_angle=270
    },
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x0090B4,
        fg_alpha=1,
        x=25, y=25,
        radius=10,
        thickness=2,
        start_angle=190,
        end_angle=460
    },
    {
        name='battery_percent',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x0090B4,
        fg_alpha=1,
        x=25, y=25,
        radius=22,
        thickness=2,
        start_angle=40,
        end_angle=240
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x0090B4,
        fg_alpha=1,
        x=25, y=25,
        radius=18,
        thickness=2,
        start_angle=190,
        end_angle=460
    },
}
 
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 conky_ring_stats()
    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)
        if value == nil then value = 0 end
        pct=value/pt['max']
 
        draw_ring(cr,pct,pt)
    end
 
    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
end

tint2-config

# Tint2 config file
# Generated by tintwizard (http://code.google.com/p/tintwizard/)

# For information on manually configuring tint2 see http://code.google.com/p/tint2/wiki/Configure

# To use this as default tint2 config: save as $HOME/.config/tint2/tint2rc

# Background definitions
# ID 1
rounded = 2
border_width = 0
background_color = #FFFFFF 5
border_color = #FFFFFF 40

# ID 2
rounded = 2
border_width = 0
background_color = #FFFFFF 15
border_color = #0090B4 100

# ID 3
rounded = 2
border_width = 0
background_color = #FFFFFF 5
border_color = #FFFFFF 0

# ID 4
rounded = 2
border_width = 1
background_color = #FFFFFF 5
border_color = #FFFFFF 10

# Panel
panel_monitor = all
panel_position = bottom center horizontal
panel_size = 95% 30
panel_margin = 0 1
panel_padding = 3 3
wm_menu = 0
panel_background_id = 0

# Taskbar
taskbar_mode = multi_desktop
taskbar_padding = 2 2 3
taskbar_background_id = 1
taskbar_active_background_id =4 

# Tasks
urgent_nb_of_blink = 7
task_icon = 0
task_text = 1
task_centered = 0
task_maximum_size = 100 0
task_padding = 5 2
task_background_id = 3
task_active_background_id = 2

# Fonts
task_font = Sans 7
task_font_color = #FFFFFF 19
task_active_font_color = #0090B3 100
font_shadow = 0

# Systray
systray_padding = 3 3 2
systray_sort = ascending
systray_background_id = 1

# Clock
time1_format = %H:%M
time1_font = Sans 7
time2_format = %a %d %b
time2_font = Sans 6
clock_font_color = #FFFFFF 19
clock_padding = 0 0
clock_background_id = 0

# Mouse
mouse_middle = none
mouse_right = none
mouse_scroll_up = none
mouse_scroll_down = none

# Battery
battery = 0
battery_low_status = 20
battery_low_cmd = notify-send "battery low"
bat1_font = Sans 7
bat2_font = Sans 7
battery_font_color = #FFFFFF 19
battery_padding = 0 0
battery_background_id = 0

# End of config

Last edited by lomion (2010-02-06 10:52:46)

Re: My Conky Config

For valentines day here's a valentines conky...it went a bit goth with the font and colors smile
and as an entry in the conky blog Feb contest
http://blog.conky.be/2010/02/03/februar … ymassacre/

http://omploader.org/tM2dlaw


the heart border is animated (record my desktop made everything dark and settings are on the low end so quality isn't the best)
http://blip.tv/file/3177952

heart.lua (there is probably a more compact way to achieve the same effect... i dont think i even used the string split function)

--[[valentine by mrpeachy (2010) incorporates air clock by londonali1010 ]]
require 'cairo'
function string_split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end

function conky_draw_heart()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

--clock
local clock_r=30
local xc=190
local yc=137
shadow_width=5
shadow_xoffset=0
shadow_yoffset=2
show_seconds=true
-- Grab time
local hours=os.date("%I")
local mins=os.date("%M")
local secs=os.date("%S")
    
secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins
hours_arc=(2*math.pi/12)*hours+mins_arc/12
    
-- Set clock face
cairo_arc(cr,xc,yc,clock_r,0,2*math.pi)
cairo_close_path(cr)
    
cairo_set_source_rgba(cr, 1 ,0 ,0 ,1)
cairo_set_line_width(cr, 1)
cairo_stroke (cr)
    
-- 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,1,0,0,0.5)
cairo_stroke(cr)
    
-- Draw minute hand
xm=xc+0.9*clock_r*math.sin(mins_arc)
ym=yc-0.9*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+0.9*clock_r*math.sin(secs_arc)
ys=yc-0.9*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

--background
corner_r=15
height=531
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,height-corner_r)
cairo_curve_to(cr,w,height,w,height,w-corner_r,height)
cairo_line_to(cr,corner_r,height)
cairo_curve_to(cr,0,height,0,height,0,height-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, 0, 0, 0, 0.4)
cairo_fill(cr)
    
--calculates animation
timer=(update_num % 4)+1
if timer == 1 then
n1=0.2
n2=0.4
n3=0.6
n4=0.8
elseif timer == 2 then
n1=0.4
n2=0.6
n3=0.8
n4=0.2
elseif timer == 3 then
n1=0.6
n2=0.8
n3=0.2
n4=0.4
elseif timer == 4 then
n1=0.8
n2=0.2
n3=0.4
n4=0.6
end

--prints hear border
scale=0.2
--top left
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_rotate (cr, -45*math.pi/180)
cairo_translate (cr, -40, -5)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_rotate (cr, 45*math.pi/180)
--(cr x = horizontal, y = vertical)
--top right
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_rotate (cr, 45*math.pi/180)
cairo_translate (cr, 397, -477)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_rotate (cr, -45*math.pi/180)
--(cr x = horizontal, y = vertical)
--bottom right
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_rotate (cr, 135*math.pi/180)
cairo_translate (cr, 341, -421)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_rotate (cr, -135*math.pi/180)
--(cr x = horizontal, y = vertical)
--bottom left
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_rotate (cr, -135*math.pi/180)
cairo_translate (cr, 397, -477)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_rotate (cr, 135*math.pi/180)

--top row
side=44
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, -0.5, -584)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, side, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)

--right side
sider=45
cairo_rotate (cr, 90*math.pi/180)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider-1, -123)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
--bottom row
sider=44
cairo_rotate (cr, 90*math.pi/180)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, -123)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
--left side
sider=45
cairo_rotate (cr, 90*math.pi/180)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider-1, -123)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n2)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n1)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n4)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
cairo_set_source_rgba (cr, 1, 0, 0, n3)
cairo_translate (cr, sider, 0)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)
end
end

conky

##############################################
#  Settings
##############################################
max_specials 10000
max_user_text 150000
background yes
use_xft yes
xftfont mono:size=12
xftalpha 1
update_interval 1
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 600, 640
maximum_width 600
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_middle
gap_x 10
gap_y 40
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
default_color 000000
color1 735046
lua_load /home/mcdowall/lua/clock.lua
lua_draw_hook_pre draw_clock


lua_load /home/mcdowall/lua/heart.lua
lua_draw_hook_pre draw_heart
TEXT
${font Romance Fatal Goth:size=36}${color darkred}${goto 50}${voffset 40}Time and Date${font Romance Fatal Goth:size=6}
${goto 50}_________________________${font Romance Fatal Goth:size=6}
${font Romance Fatal Goth:size=18}${goto 50}${font Romance Fatal Goth:size=18}${time %I:%M %P}
${goto 50}Central
${goto 50}${time %A  %B  %d}
${goto 50}${time %m / %d / %Y}${font Romance Fatal Goth:size=6}

${goto 50}${font Romance Fatal Goth:size=22}Weather${font Romance Fatal Goth:size=6}
${goto 50}_________________________${font Romance Fatal Goth:size=12}
${goto 50}Today${goto 120}${execi 3600 conkyForecast --datatype=DW --startday=1 --shortweekday}${goto 170}${execi 3600 conkyForecast --datatype=DW --startday=2 --shortweekday}${goto 220}${execi 3600 conkyForecast --datatype=DW --startday=3 --shortweekday}${goto 270}${execi 3600 conkyForecast --datatype=DW --startday=4 --shortweekday}
${goto 50}${font ConkyWeather:size=26}${execi 3600 conkyForecast --location=USMO0787 --datatype=WF}${goto 120}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=WF}${goto 170}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=WF}${goto 220}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=WF}${goto 270}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=WF}
${goto 50}${font Romance Fatal Goth:size=10}DAY${goto 100}HGH${goto 150}LOW${goto 200}PPT${goto 250}HUM
${goto 50}${execi 3600 conkyForecast --datatype=DW --startday=0 --shortweekday}${goto 100}${execi 3600 conkyForecast --location=USMO0787 --startday=0 --datatype=HT --imperial}${goto 150}${execi 3600 conkyForecast --location=USMO0787 --startday=0 --datatype=LT --imperial}${goto 200}${execi 3600 conkyForecast --location=USMO0787 --startday=0 --datatype=PC}${goto 250}${execi 3600 conkyForecast --location=USMO0787 --startday=0 --datatype=HM}
${goto 50}${execi 3600 conkyForecast --datatype=DW --startday=1 --shortweekday}${goto 100}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=HT --imperial}${goto 150}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=LT --imperial}${goto 200}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=PC}${goto 250}${execi 3600 conkyForecast --location=USMO0787 --startday=1 --datatype=HM}
${goto 50}${execi 3600 conkyForecast --datatype=DW --startday=2 --shortweekday}${goto 100}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=HT --imperial}${goto 150}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=LT --imperial}${goto 200}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=PC}${goto 250}${execi 3600 conkyForecast --location=USMO0787 --startday=2 --datatype=HM}
${goto 50}${execi 3600 conkyForecast --datatype=DW --startday=3 --shortweekday}${goto 100}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=HT --imperial}${goto 150}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=LT --imperial}${goto 200}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=PC}${goto 250}${execi 3600 conkyForecast --location=USMO0787 --startday=3 --datatype=HM}
${goto 50}${execi 3600 conkyForecast --datatype=DW --startday=4 --shortweekday}${goto 100}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=HT --imperial}${goto 150}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=LT --imperial}${goto 200}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=PC}${goto 250}${execi 3600 conkyForecast --location=USMO0787 --startday=4 --datatype=HM}

${voffset -443}${font Romance Fatal Goth:size=22}${goto 340}System Monitor${font Romance Fatal Goth:size=6}
}${goto 340}_________________________
${font Romance Fatal Goth:size=14}${goto 340}CPU: ${cpu cpu1}%${alignr 60}${cpubar cpu1 10,115}
${goto 340}RAM: ${memperc}%  ${alignr 60}${membar 10,115}
${goto 340}HDD: ${fs_used_perc /}%${alignr 60}${fs_bar 10,115 /}
${goto 340}SWP: ${swapperc}%${alignr 60}${swapbar 10,115}
${goto 340}USP: ${upspeed eth0}${alignr 60}${upspeedgraph eth0 10,115}
${goto 340}DSP: ${downspeed eth0}${alignr 60}${downspeedgraph eth0 10,115}
${goto 340}ULD: ${totalup eth0}
${goto 340}DLD: ${totaldown eth0}
${goto 340}${font Romance Fatal Goth:size=22}Processes${font Romance Fatal Goth:size=6}
${goto 340}_________________________
${font Romance Fatal Goth:size=14}${goto 340}NAME ${alignr 60} PID    CPU 
${goto 340}${top name 1} ${alignr 60} ${top pid 1} ${top cpu 1}
${goto 340}${top name 2} ${alignr 60} ${top pid 2} ${top cpu 2}
${goto 340}${top name 3} ${alignr 60} ${top pid 3} ${top cpu 3}
${goto 340}${top name 4} ${alignr 60} ${top pid 4} ${top cpu 4}
${goto 340}${top name 5} ${alignr 60} ${top pid 5} ${top cpu 5}

Last edited by mrpeachy (2010-02-23 05:01:32)

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: My Conky Config

another valentines themed conky from me.

http://omploader.org/tM2gwaw

the flowers change color in relation to the outputs of the various functions.
the lua file will be much smaller when i work out how to get multiple indicators from a single instance of the function.
...maybe i'll change that pink heart to a flower...

and with some tweaking of the circle writing function i now have this:
http://omploader.org/tM2gyOQ
updated code below

flowe.lua

--[[valentine flowers by mrpeachy (2010)]]
require 'cairo'
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end

function circlewriting(text, char, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, variable)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i=1,char do
--calculations
deg=360/((char-1)*2)
text_arc=(2*math.pi/((char-1)*2)*(i)+variable)
txs=1+radi*(math.sin(text_arc))
tys=1-radi*(math.cos(text_arc))
--print (deg)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, ((270+(deg*(i-1)))*math.pi/180))
cairo_show_text (cr, (texttable[i]))
cairo_rotate (cr, ((-270-(deg*(i-1)))*math.pi/180))
end
end

function conky_draw_flower()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)


--FLOWER 1----------------------------------------------------------------------------
--FLOWER 1
--color
f1r=1
f1g=0
f1b=0
--size
cairo_scale (cr, 0.5, 0.5)
--position
cairo_translate (cr, 500, 250)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f1r, f1g, f1b, .5);
cairo_fill (cr);
--draw indicator circle
local fl1num=conky_parse('${cpu}')
fl1=tonumber(fl1num)
circrad=(fl1*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, 1, 0, 0, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);
--FLOWER 2----------------------------------------------------------------------------
--FLOWER 2
--color
f2r=0
f2g=1
f2b=1
--size
cairo_scale (cr, 1, 1)
--position across then up (translate is relative to last translate position)
cairo_translate (cr, 350, 200)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f2r, f2g, f2b, .5);
cairo_fill (cr);
--draw indicator circle
local fl2num=conky_parse('${memperc}')
fl2=tonumber(fl2num)
circrad=(fl2*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f2r, f2g, f2b, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);
--FLOWER 3----------------------------------------------------------------------------
--FLOWER 3
--color
f3r=0.6
f3g=0.0
f3b=1
--size
cairo_scale (cr, 1, 1)
--position across then up (translate is relative to last translate position)
cairo_translate (cr, -700, 0)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f3r, f3g, f3b, .5);
cairo_fill (cr);
--draw indicator circle
local fl3num=conky_parse('${fs_used_perc /}')
fl3=tonumber(fl3num)
circrad=(fl3*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f3r, f3g, f3b, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);
--FLOWER 4----------------------------------------------------------------------------
--FLOWER 4
--color
f4r=1
f4g=0
f4b=1
--size
cairo_scale (cr, 1, 1)
--position across then up (translate is relative to last translate position)
cairo_translate (cr, 0, 400)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f4r, f4g, f4b, .5);
cairo_fill (cr);
--draw indicator circle
local fl4num=conky_parse('${swapperc}')
fl4=tonumber(fl4num)
circrad=(fl4*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f4r, f4g, f4b, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);
--FLOWER 5----------------------------------------------------------------------------
--FLOWER 5
--color
f5r=1
f5g=1
f5b=0
--size
cairo_scale (cr, 1, 1)
--position across then up (translate is relative to last translate position)
cairo_translate (cr, 350, 200)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f5r, f5g, f5b, .5);
cairo_fill (cr);
--draw indicator circle
local fl5num=conky_parse('${cpu}')
fl5=tonumber(fl5num)
circrad=(fl5*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f5r, f5g, f5b, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);
--FLOWER 6----------------------------------------------------------------------------
--FLOWER 6
--color
f6r=1
f6g=.5
f6b=0
--size
cairo_scale (cr, 1, 1)
--position across then up (translate is relative to last translate position)
cairo_translate (cr, 350, -200)
--draw background circle
circrad=200
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f6r, f6g, f6b, .5);
cairo_fill (cr);
--draw indicator circle
local fl6num=conky_parse('${cpu}')
fl6=tonumber(fl6num)
circrad=(fl5*1.5)+50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
--fill
cairo_set_source_rgba (cr, f6r, f6g, f6b, .5);
cairo_fill (cr);
--flower shape
cairo_move_to (cr, 100, 100);
cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);
cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);
cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);
cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);
cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);
cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);
cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);
cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);
cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);
cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);
cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);
cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);
cairo_close_path (cr);
--draw circle
circrad=205
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_new_sub_path (cr); cairo_close_path(cr)
--fill
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_fill (cr);
--draw center circle
circrad=50
circx=100
circy=0
cairo_move_to (cr, 100, 100);
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba (cr, 1, 1, 0, 1);
cairo_fill (cr);

-----description of variables for circlewriting function
--eg circlewriting(A, B, C, D, E, F, G, H, I, J, K, L)
--A = text to be written, place straight text in quotes.
--B = total number of characters, including spaces and punctuation
--C = font, place font in quotes
--D = font size
--E = radius of the circle
--F = horizontal position
--G = vertical position
--H = color red
--I = color green
--J = color blue
--K = a variable to get the text lined up.  I havn't quite figured out how this number is generated!
--but without it the text will no line up correctly.  For text along top of circle this number is -ve
--start at about half of B, increasing negative moves text counter clockwise 
--circlewriting("TEXT TEXT TEXT", 14, "Mono", 18, 100, 150, 150, 1, 1, 1, 1, -8.16)

--FLOWER 1 TITLE
cairo_translate (cr, -260, -590)
test=circlewriting("PROCESSOR", 9, "White Rabbit", 30, 205, 7, -10, f1r, f1g, f1b, 0.8, -2)
--FLOWER 2 TITLE
cairo_translate (cr, 348, 200)
test=circlewriting("MEMORY", 6, "White Rabbit", 30, 205, 9, -10, f2r, f2g, f2b, 0.8, -2.24)
--FLOWER 3 TITLE
cairo_translate (cr, -698, 0)
test=circlewriting("FILESYSTEM USED", 15, "White Rabbit", 30, 205, 7, -10, f3r, f3g, f3b, 0.8, -8.12)
--FLOWER 4 TITLE
cairo_translate (cr, 0, 400)
test=circlewriting("SWAP PARTITION", 14, "White Rabbit", 30, 205, 7, -11, f4r, f4g, f4b, 0.8, -8.13)
--FLOWER 5 TITLE
cairo_translate (cr, 350, 200)
test=circlewriting("BATTERY", 7, "White Rabbit", 30, 205, 7, -10, f5r, f5g, f5b, 0.8, -8.41)
--FLOWER 6 TITLE
cairo_translate (cr, 350, -200)
test=circlewriting("CONNECTION", 10, "White Rabbit", 30, 205, 7, -10, f6r, f6g, f6b, 0.8, -8.25)
--draw center clock heart
scale=1.75
cairo_set_source_rgba (cr, 255/255, 100/255, 130/255, 1)
cairo_translate (cr, -690, -570)
cairo_move_to (cr, 200*scale, 150*scale);
cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);
cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);
cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);
cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);
cairo_close_path (cr);
cairo_fill (cr)

--clock
local clock_r=85
local xc=350
local yc=390
shadow_width=5
shadow_xoffset=0
shadow_yoffset=2
show_seconds=true
-- Grab time
local hours=os.date("%I")
local mins=os.date("%M")
local secs=os.date("%S")    
secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins
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,0,0,0.5)
cairo_stroke(cr)
    
-- Draw minute hand
xm=xc+0.9*clock_r*math.sin(mins_arc)
ym=yc-0.9*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+0.9*clock_r*math.sin(secs_arc)
ys=yc-0.9*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
end

conkyrc_flower

lua_load /home/mcdowall/lua/flower.lua
lua_draw_hook_pre draw_flower

TEXT
${goto 239}${voffset 270}${font clockfaces:size=90}Q

only problem im having is that xorg is freaking out with this setup and driving cpu usage up

Last edited by mrpeachy (2010-02-23 05:13:46)

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: My Conky Config

# Conky configuration
# set to yes if you want Conky to be forked in the background
background no

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Terminus:size=9

# Text alpha when using Xft
xftalpha 0.8

# Update interval in seconds
update_interval 1.0

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

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

# Minimum size of text area
minimum_size 283 400
maximum_width 300

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no
draw_graph_borders yes

# Stippled borders?
stippled_borders 0

# border margins
border_margin 0

# border width
border_width 0

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white

# own window options
own_window        yes
own_window_transparent    yes
own_window_type desktop

own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager



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

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

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase none

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale no
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no

TEXT
${font cure:size=6}${color #73986E}Control Panel
${hr}
${font cure:size=6}${color #73986E}* Host: ${color #A6BF1B}$nodename
${font cure:size=6}${color #73986E}* Uptime: ${color #A6BF1B}$uptime
${font cure:size=6}${color #73986E}* Mail: ${color #A6BF1B}${pop3_unseen pop.gmail.com your_login your_pass [-i 3]} nouveau(x) mail(s)
#thanks for the pass changing ;)
${font cure:size=6}${color #73986E}* IP locale:   ${color #A6BF1B}${if_existing /proc/net/route wlan0}${addr wlan0}${endif} ${if_existing /proc/net/route eth0}${addr eth0}${endif} ${if_existing /proc/net/route ppp0}${addr ppp0}${endif}
${font cure:size=6}${color #73986E}* IP publique: ${color #A6BF1B}${execi 3600 wget -O - http://whatismyip.org/ | tail}
${font cure:size=6}${color #73986E}* RAM:  ${color #A6BF1B}$memperc% ${membar 3,60}
${font cure:size=6}${color #73986E}* CPU:  ${color #A6BF1B}${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C"}
${font cure:size=6}${color #73986E}* HDD/root:    ${color #A6BF1B}${fs_bar 3,100 /}
${font cure:size=6}${color #73986E}* HDD/home:  ${color #A6BF1B}${fs_bar 3,100}
${font cure:size=6}${color #73986E}* HDD/media: ${color #A6BF1B}${fs_bar 3,100 /windows}
${font cure:size=6}${color #73986E}* Down: ${color #A6BF1B}${downspeed eth0}KB/s ${color #73986E}Up: ${color #A6BF1B}${upspeed eth0}KB/s
${font cure:size=6}${color #73986E}* Time: ${color #A6BF1B}${time %H:%M}  ${time %A %d %m %Y}
${font cure:size=6}${color #73986E}* Battery: ${color #A6BF1B}${battery_bar 3,60 BAT1}

${font cure:size=6}${color #73986E}Shortcuts keys
${hr}
${font cure:size=6}${color #73986E}Alt+F2$alignr Run Dialog
${font cure:size=6}${color #73986E}Alt+F3$alignr Alt Menu
${font cure:size=6}${color #73986E}Super+space$alignr Main Menu
${font cure:size=6}${color #73986E}Super+tab$alignr Client Menu
${font cure:size=6}${color #73986E}Super+t$alignr Terminal
${font cure:size=6}${color #73986E}Super+f$alignr File Manager
${font cure:size=6}${color #73986E}Super+e$alignr Editor
${font cure:size=6}${color #73986E}Super+m$alignr Media Player
${font cure:size=6}${color #73986E}Super+w$alignr Web Browser
${font cure:size=6}${color #73986E}Super+c$alignr Clock
${font cure:size=6}${color #73986E}Super+l$alignr Lock Screen
${font cure:size=6}${color #73986E}Super+v$alignr Volume Control
${font cure:size=6}${color #73986E}Super+u$alignr System Update
${font cure:size=6}${color #73986E}Super+x$alignr Logout
${font cure:size=6}${color #73986E}PrtSc$alignr Screenshot

http://users.skynet.be/fb624689/images/screen1.jpg

Last edited by R41z3n (2010-03-25 08:36:33)

Re: My Conky Config

http://omploader.org/tM2hzdg

guitar amp schematic conky

this image tells you what is what
http://omploader.org/tM2h0dw

scematic.lua

--[[schematics by mrpeachy (2010) based on a schematic drawing by pvsage incorporates code from Background by londonali1010 (2009)]]
require 'cairo'
function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
function addzero10(num)
if tonumber(num) < 10 then
return "0" .. num
else
return num
end
end
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
function conky_draw_schematic()
 local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
--background
corner_r=15
height=290
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,height-corner_r)
cairo_curve_to(cr,w,height,w,height,w-corner_r,height)
cairo_line_to(cr,corner_r,height)
cairo_curve_to(cr,0,height,0,height,0,height-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, 1, 1, 1, 1)
cairo_fill(cr)

cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 12.0);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
--schematc drawing
cairo_set_source_rgba (cr, 0, 0, 0, 1);
local lw=2
cairo_set_line_width (cr, lw);
cairo_move_to (cr, 25, 100);
cairo_rel_line_to (cr, 561, 0);
local cn=15
--bumps
cairo_rel_curve_to (cr,0,0,cn,0,cn,cn)
cairo_rel_curve_to (cr,0,0,0,cn,-cn,cn)
cairo_rel_curve_to (cr,0,0,cn,0,cn,cn)
cairo_rel_curve_to (cr,0,0,0,cn,-cn,cn)
cairo_rel_curve_to (cr,0,0,cn,0,cn,cn)
cairo_rel_curve_to (cr,0,0,0,cn,-cn,cn)
cairo_rel_curve_to (cr,0,0,cn,0,cn,cn)
cairo_rel_curve_to (cr,0,0,0,cn,-cn,cn)
cairo_rel_line_to (cr, -80, 0)
cairo_rel_line_to (cr, 0, -120)
cairo_rel_move_to (cr, -80, -20)
cairo_rel_line_to (cr, 0, 60)
cairo_rel_move_to (cr, -120, -60)
cairo_rel_line_to (cr, 0, 60)
cairo_rel_move_to (cr, -40, -40)
cairo_rel_line_to (cr, 0, 20)
cairo_rel_move_to (cr, -120, -40)
cairo_rel_line_to (cr, 0, 60)
cairo_rel_move_to (cr, -120, -60)
cairo_rel_line_to (cr, 0, 60)
cairo_stroke (cr)
cairo_rectangle (cr, 10, 140, 30, 10)
cairo_set_source_rgba (cr, 1, 1, 1, 1)
cairo_fill (cr)
cairo_rectangle (cr, 10, 140, 30, 10)
cairo_set_source_rgba (cr, 0, 0, 0, 1)
cairo_stroke (cr)
cairo_rectangle (cr, 130, 140, 30, 10)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 130, 140, 30, 10)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_rectangle (cr, 290, 140, 30, 10)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 290, 140, 30, 10)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_rectangle (cr, 410, 140, 30, 10)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 410, 140, 30, 10)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_move_to (cr, 10, 160)
cairo_rel_line_to (cr, 30, 0)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 0, 30)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 30, 0)
cairo_stroke (cr)
cairo_move_to (cr, 130, 160)
cairo_rel_line_to (cr, 30, 0)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 0, 30)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 30, 0)
cairo_stroke (cr)
cairo_move_to (cr, 290, 160)
cairo_rel_line_to (cr, 30, 0)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 0, 70)
cairo_stroke (cr)
cairo_move_to (cr, 410, 160)
cairo_rel_line_to (cr, 30, 0)
cairo_rel_move_to (cr, -15, 0)
cairo_rel_line_to (cr, 0, 50)
cairo_rel_line_to (cr, -159, 0)
cairo_rel_line_to (cr, 0, -20)
cairo_stroke (cr)
cairo_move_to (cr, 15, 200)
cairo_rel_line_to (cr, 20, 0)
cairo_stroke (cr)
cairo_move_to (cr, 22, 210)
cairo_rel_line_to (cr, 6, 0)
cairo_stroke (cr)
cairo_move_to (cr, 135, 200)
cairo_rel_line_to (cr, 20, 0)
cairo_stroke (cr)
cairo_move_to (cr, 142, 210)
cairo_rel_line_to (cr, 6, 0)
cairo_stroke (cr)
--dots
circrad=5
circx=26
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=146
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=266
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=306
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=426
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=506
circy=100
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
circx=305
circy=210
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
cairo_move_to (cr, 530, 80)
cairo_rel_line_to (cr, 0, 40)
cairo_stroke (cr)
cairo_move_to (cr, 530, 200)
cairo_rel_line_to (cr, 0, 40)
cairo_stroke (cr)
cairo_move_to (cr, 570, 160)
cairo_rel_line_to (cr, 20, 0)
cairo_stroke (cr)
cairo_move_to (cr, 550, 80)
cairo_rel_line_to (cr, 0, 40)
cairo_rel_line_to (cr, -20, -20)
cairo_rel_line_to (cr, 20, -20)
cairo_close_path (cr)
cairo_fill (cr)
cairo_move_to (cr, 550, 200)
cairo_rel_line_to (cr, 0, 40)
cairo_rel_line_to (cr, -20, -20)
cairo_rel_line_to (cr, 20, -20)
cairo_close_path (cr)
cairo_fill (cr)
cairo_move_to (cr, 285, 230)
cairo_rel_line_to (cr, 40, 0)
cairo_rel_line_to (cr, -20, 20)
cairo_rel_line_to (cr, -20, -20)
cairo_close_path (cr)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_move_to (cr, 285, 230)
cairo_rel_line_to (cr, 40, 0)
cairo_rel_line_to (cr, -20, 20)
cairo_rel_line_to (cr, -20, -20)
cairo_close_path (cr)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
--indicator bars backgrounds
cairo_rectangle (cr, 46, 90, 80, 20)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 46, 90, 80, 20)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_rectangle (cr, 166, 90, 80, 20)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 166, 90, 80, 20)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_rectangle (cr, 326, 90, 80, 20)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 326, 90, 80, 20)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
cairo_rectangle (cr, 256, 115, 20, 80)
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_fill (cr)
cairo_rectangle (cr, 256, 115, 20, 80)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_stroke (cr)
--static text
cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14);
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_move_to (cr, 20, 75)
cairo_show_text (cr, "D")
cairo_move_to (cr, 70, 80)
cairo_show_text (cr, "DLD")
cairo_move_to (cr, 140, 75)
cairo_show_text (cr, "C")
cairo_move_to (cr, 190, 80)
cairo_show_text (cr, "ULD")
cairo_move_to (cr, 300, 75)
cairo_show_text (cr, "B")
cairo_move_to (cr, 350, 80)
cairo_show_text (cr, "RAM")
cairo_move_to (cr, 420, 75)
cairo_show_text (cr, "A")
cairo_move_to (cr, 527, 75)
cairo_show_text (cr, "D1")
cairo_move_to (cr, 527, 195)
cairo_show_text (cr, "D2")
cairo_move_to (cr, 200, 140)
cairo_show_text (cr, "FSY")
cairo_move_to (cr, 460, 140)
cairo_show_text (cr, "CPU")
cairo_move_to (cr, 340, 140)
cairo_show_text (cr, "T0P")
cairo_move_to (cr, 45, 140)
cairo_show_text (cr, "LINUX")
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 45, 155)
cairo_show_text (cr, "CRUNCHBANG")
cairo_move_to (cr, 45, 170)
cairo_show_text (cr, "09.04.01")
local uptime=conky_parse("${uptime}")
utdcalc=string.gsub(uptime, "[%d ]", "")
utime=string.split(uptime, "%a ")
for index,today in pairs(utime) do
end
if utdcalc=="hms" then 
utd="00"
uth=addzero10(utime[1])
utm=addzero10(utime[2])
else
utd=addzero10(utime[1])
uth=addzero10(utime[2])
utm=addzero10(utime[3])
end
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_move_to (cr, 410, 55);
cairo_show_text (cr, (utd .. uth .. utm))
local kernel1=conky_parse("${kernel}")
kernel=string.gsub(kernel1, "[%a .-]", "")
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 509, 60);
cairo_show_text (cr, (kernel))
local topcpu1=conky_parse("${top cpu 1}")
tcpu1num=tonumber(topcpu1)
tcpu1=string.split(tcpu1num, "%p")
for index,today in pairs(tcpu1) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 460, 155)
cairo_show_text (cr, (addzero100(tcpu1[1])))
local topcpu2=conky_parse("${top cpu 2}")
tcpu2num=tonumber(topcpu2)
tcpu2=string.split(tcpu2num, "%p")
for index,today in pairs(tcpu2) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 460, 170)
cairo_show_text (cr, (addzero100(tcpu2[1])))
local topcpu3=conky_parse("${top cpu 3}")
tcpu3num=tonumber(topcpu3)
tcpu3=string.split(tcpu3num, "%p")
for index,today in pairs(tcpu3) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 460, 185)
cairo_show_text (cr, (addzero100(tcpu3[1])))
--this section formats top process
local topproc1=conky_parse("${top name 1}")
topproc=string.gsub(topproc1, "[%p]", "")
top1=string.upper(topproc)
top2=string.gsub(top1, "%a", "%1-")
top=string.split(top2, "%p")
for index,today in pairs(top) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 340, 155)
cairo_show_text (cr, (top[1]) .. (top[2]) .. (top[3]) .. (top[4]));
local topproc12=conky_parse("${top name 2}")
topproc2=string.gsub(topproc12, "[%p]", "")
top12=string.upper(topproc2)
top22=string.gsub(top12, "%a", "%1-")
top2=string.split(top22, "%p")
for index,today in pairs(top2) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 340, 170)
cairo_show_text (cr, (top2[1]) .. (top2[2]) .. (top2[3]) .. (top2[4]));
local topproc13=conky_parse("${top name 3}")
topproc3=string.gsub(topproc13, "[%p]", "")
top13=string.upper(topproc3)
top23=string.gsub(top13, "%a", "%1-")
top3=string.split(top23, "%p")
for index,today in pairs(top2) do
end
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 340, 185)
cairo_show_text (cr, (top3[1]) .. (top3[2]) .. (top3[3]) .. (top3[4]));
--time
time=os.date("%H%M")
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_move_to (cr, 5, 55)
cairo_show_text (cr, (time))
--date
date=os.date("%m%d")
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_move_to (cr, 127, 55)
cairo_show_text (cr, (date))
--date
year=os.date("%G")
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_move_to (cr, 287, 55)
cairo_show_text (cr, (year))
--this section formats total dld and downspeed
local download=conky_parse("${totaldown eth0}")
dwnldcalc1=string.gsub(download, "[%a ]", "")
dwnldcalc=string.split(dwnldcalc1, "%p")
for index,today in pairs(dwnldcalc) do
end
dwnldunit1=string.gsub(download, "[%p%d ]", "")
dwnldunit=string.gsub(dwnldunit1, "iB", "")
local downspeed=conky_parse("${downspeed}")
downnum=string.gsub(downspeed, "[%a ]", "")
dwnspcalc=string.split(downnum, "%p")
for index,today in pairs(dwnspcalc) do
end
dwnumunit1=string.gsub(downspeed, "[%p%d ]", "")
dwnumunit=string.gsub(dwnumunit1, "iB", "")
if dwnumunit=="M" then
dspmb=string.gsub(downnum, ".$", "")
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 46, 65);
cairo_show_text (cr, (dspmb) .. (dwnumunit) .. "/" .. (addzero100(dwnldcalc[1])) .. (dwnldunit));
else
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 46, 65);
cairo_show_text (cr, (addzero100(dwnspcalc[1])) .. (dwnumunit) .. "/" .. (addzero100(dwnldcalc[1])) .. (dwnldunit));
end
--uploaded and upload speed
local upload=conky_parse("${totalup eth0}")
upldcalc1=string.gsub(upload, "[%a ]", "")
upldcalc=string.split(upldcalc1, "%p")
for index,today in pairs(dwnldcalc) do
end
upldunit1=string.gsub(upload, "[%p%d ]", "")
upldunit=string.gsub(upldunit1, "iB", "")
local upspeed=conky_parse("${upspeed}")
upnum=string.gsub(upspeed, "[%a ]", "")
upspcalc=string.split(upnum, "%p")
for index,today in pairs(upspcalc) do
end
upumunit1=string.gsub(upspeed, "[%p%d ]", "")
upumunit=string.gsub(upumunit1, "iB", "")
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 166, 65);
cairo_show_text (cr, (addzero100(upspcalc[1])) .. (upumunit) .. "/" .. (addzero100(upldcalc[1])) .. (upldunit));
--formats and diplays ram/ram total
local memnum1=conky_parse("${mem}")
memnum=string.gsub(memnum1, "[%a ]", "")
memunit=string.gsub(memnum1, "[%d%p iB]", "")
local memmaxnum1=conky_parse("${memmax}")
memmaxnum=string.gsub(memmaxnum1, "[%iB ]", "")
if memunit == "M" then
cairo_move_to (cr, 326, 65);
cairo_show_text (cr, (addzero100(memnum)) .. (memunit) .. "/" .. (memmaxnum));
elseif memunit == "G" then
cairo_move_to (cr, 326, 65);
cairo_show_text (cr, (memnum) .. (memunit) .. "/" .. (memmaxnum));
end
local fsys1=conky_parse("${fs_size /}")
fsys=string.gsub(fsys1, "[iB ]", "")
local fsys2=conky_parse("${fs_used /}")
fsused=string.gsub(fsys2, "[iB ]", "")
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_move_to (cr, 200, 155);
cairo_show_text (cr, (fsused) .. "/");
cairo_move_to (cr, 200, 170);
cairo_show_text (cr,(fsys));
local fsperc1=conky_parse("${fs_used_perc /}")
fsperc2=tonumber(fsperc1)
fsperc=(fsperc2*0.8)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_set_line_width (cr, 20)
cairo_move_to (cr, 266, 195)
cairo_rel_line_to (cr, 0, -fsperc)
cairo_stroke (cr)

--ring
arg1=conky_parse("${cpu}")
arg=tonumber(arg1)
xc=550 
yc=161
ring_r=20
ring_w=3
sa=0
ea=360    
--print (arg)
local w,h=conky_window.width,conky_window.height
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=(arg/100)*(angle_f-angle_0)
-- Draw background ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,0,0,0,1)
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,1,0,0,1)
cairo_stroke(cr)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_move_to (cr, 537, 165)
cairo_show_text (cr, (addzero100(arg)))
end
end

conkyrc_scematic

lua_load /home/mcdowall/lua/scematic.lua
lua_draw_hook_pre draw_schematic

TEXT
${voffset 60}
${goto 46}${downspeedgraph eth0 20,80}${goto 166}${upspeedgraph eth0 20,80}${goto 326}${membar 20,80}

Last edited by mrpeachy (2010-02-24 19:40:45)

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: My Conky Config

^ I recognize that RC-filtered power supply!  Actually, it's the same kind of RC-filtered supply you'll find in any DC electronic device that is powered from mains AC (assuming it uses a power transformer and not a switch-mode supply), but that specific schematic layout has a very familiar fingerprint.

Hey, whatever works for ya. cool

while ( ! ( succeed = try() ) );

Re: My Conky Config

pvsage wrote:

^ I recognize that RC-filtered power supply!  Actually, it's the same kind of RC-filtered supply you'll find in any DC electronic device that is powered from mains AC (assuming it uses a power transformer and not a switch-mode supply), but that specific schematic layout has a very familiar fingerprint.

Hey, whatever works for ya. cool

that's because it is yours smile  I borrowed it
I had no idea what it did.

Last edited by mrpeachy (2010-02-09 04:44:50)

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: My Conky Config

here are some bars
they are fully configurable...
you can change
which output to display
background color and alpha
indicator color and alpha
border color and alpha
size
position
rotation
via a settings table
...currently only for objects that have percentage outputs
but i could make them so that they can take into account a minimum to maximum range

note - watch out when you apply a rotation... it rotates from 0,0 (i think) so your bar may disappear from view.   x and y values are also rotated and it can take some tweaking to get them to the right position.

i haven't worked out how to get rotation to apply "locally"... 

UPDATE.... see post below that fixes the issue with rotation and makes it much easier.

http://omploader.org/tM2kzeA

EDIT - updated code so that the border line size modifies the background and indicator lines so that the border does not overlap so you can get things like this:
http://omploader.org/tM2k2Mw

bars.lua

--[[custom bars by mrpeachy (2010)]]
require "cairo"

table = {
{
--conky object for output
co='cpu',
--rectangle width
rw=150,
--rectangle height
rh=20,
--NOTE about width and height.  For a bordered rectangle with line width lw (specified below)
--the border is drawn 1/2 lw inside and 1/2 lw outside the boundary of the rectangle, so that
--final width=rw+lw and final height=rh+lw.  I did not automate this below as it is possible 
--to specify a line width (lw) greater than either width (rw) or height (rh).  
--eg if you want a rectangle 200 pixels long and a border line width of 8, then rw=100-8=92

--background rectangle color set
bg_red=1,
bg_green=0,
bg_blue=0,
--background rectangle alpha
rab=0.5,
--indicator rectangle color set
in_red=0,
in_green=1,
in_blue=0,
--indicator rectangle alpha
rai=1,
--border line width
lw=10,
--border line color set
l_red=1,
l_green=0,
l_blue=1,
--border line alpha
la=0.2,
--position, x and y
rx=200,
ry=100,
--set rotation in degrees (will require x and y to be reconfigured)
rot=0
},
{
--conky object for output
co='memperc',
--rectangle width
rw=80,
--rectangle height
rh=20,
--background rectangle color set
bg_red=0,
bg_green=0,
bg_blue=1,
--background rectangle alpha
rab=0.6,
--indicator rectangle color set
in_red=0,
in_green=1,
in_blue=1,
--indicator rectangle alpha
rai=0.5,
--border line width
lw=2,
--border line color set
l_red=1,
l_green=1,
l_blue=0,
--border line alpha
la=0.8,
--position, x and y
rx=-100,
ry=140,
--set rotation in degrees (will require x and y to be reconfigured)
rot=270
},
{
--conky object for output
co='fs_used_perc /',
--rectangle width
rw=80,
--rectangle height
rh=20,
--background rectangle color set
bg_red=1,
bg_green=1,
bg_blue=1,
--background rectangle alpha
rab=1,
--indicator rectangle color set
in_red=0,
in_green=0,
in_blue=0,
--indicator rectangle alpha
rai=0.6,
--border line width
lw=2,
--border line color set
l_red=1,
l_green=1,
l_blue=1,
--border line alpha
la=0,
--position, x and y
rx=100,
ry=40,
--set rotation in degrees (will require x and y to be reconfigured)
rot=30
},
}

function draw_table(cr, pt, value)
local width=pt['rw']
local height=pt['rh']
local bgalpha=pt['rab']
local indalpha=pt['rai']
local across=pt['rx']
local down=pt['ry']
local lwide=pt['lw']
local lalpha=pt['la']
local bgcolr=pt['bg_red']
local bgcolg=pt['bg_green']
local bgcolb=pt['bg_blue']
local incolr=pt['in_red']
local incolg=pt['in_green']
local incolb=pt['in_blue']
local lcolr=pt['l_red']
local lcolg=pt['l_green']
local lcolb=pt['l_blue']
local rotate=pt['rot']
--indicator calculation
local inum=(((width-lwide)/100)*value)
--set initial rotation
cairo_rotate (cr, rotate*math.pi/180)
--background bar
cairo_rectangle (cr, (across+(lwide/2)), (down+(lwide/2)), (width-lwide), (height-lwide))
cairo_set_source_rgba (cr, bgcolr, bgcolg, bgcolb, bgalpha);
cairo_fill (cr)
--indicator bar
cairo_rectangle (cr, (across+(lwide/2)), (down+(lwide/2)), inum, (height-lwide))
cairo_set_source_rgba (cr, incolr, incolg, incolb, indalpha);
cairo_fill (cr)
--indicator bar
cairo_set_line_width (cr, lwide);
cairo_rectangle (cr, across, down, width, height)
cairo_set_source_rgba (cr, lcolr, lcolg, lcolb, lalpha);
cairo_stroke (cr)
--resets rotation
cairo_rotate (cr, (rotate*-1)*math.pi/180)
end



function conky_draw_shape()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

local function parse(cr,pt)
local str=''
local value=0
str=string.format('${%s}',pt['co'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
draw_table(cr,pt,value)
end

for i in pairs(table) do
parse(cr, table[i])
end
end
end

this is how to get them in your conkyrc

lua_load /home/mcdowall/lua/bars.lua
lua_draw_hook_pre draw_shape
TEXT

Last edited by mrpeachy (2010-02-23 04:56:32)

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: My Conky Config

nothing too groundbreaking.  Just some more bits and pieces to use in a conky construction (you don't have to have the indicators nearly as gaudy as I have them smile )

http://omploader.org/tM2lpbA

the rings are taken from londonali1010's ring lua script (many many thanks to her for all her inspirational work!).  I have just re-gigged the lua script to make it more compact and added the ability to put outer and inner boundary lines.  The reconfigured script is a little less user friendly that the original but should be pretty self explanatory - all the settings are put in at the bottom instead of the top

UPDATE - code below now allows rotation to be applied to the lines much more easily.
they will rotate in place and not relative to 0,0

ringsandbars.lua

--[[improved bars and rings by mrpeachy (2010) ring meters based on londonali1010's ring meters script]]
require "cairo"
function draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la, rotate)
--indicator calculation
conum=tonumber(co)
local inum=(((width-lw)/100)*conum)
--background bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, bgr, bgg, bgb, bga);
cairo_rectangle (cr, 0, 0, (width-lw), (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--indicator bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, inr, ing, inb, ina);
cairo_rectangle (cr, 0, 0, inum, (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--boundary line
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_line_width (cr, lw);
cairo_set_source_rgba (cr, lr, lg, lb, la);
cairo_rectangle (cr, -lw/2, -lw/2, width, height)
cairo_stroke (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 

end
function draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia)
local angle_0=rstart*(2*math.pi/360)-math.pi/2
local angle_f=rend*(2*math.pi/360)-math.pi/2
local t_arc=(co/100)*(angle_f-angle_0)
-- Draw background ring
cairo_arc(cr,across,down,rad,angle_0,angle_f)
cairo_set_source_rgba(cr,bgr,bgg,bgb,bga)
cairo_set_line_width(cr,inlw)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr,across,down,rad,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,inr,ing,inb,ina)
cairo_stroke(cr)
--boundary rings
--outside boundary
cairo_arc(cr,across,down,(rad+(inlw/2)+(bolw/2)),angle_0,angle_f)
cairo_set_source_rgba(cr,bor,bog,bob,boa)
cairo_set_line_width(cr,bolw)
cairo_stroke(cr)
--inside boundary
cairo_arc(cr,across,down,(rad-(inlw/2)-(bilw/2)),angle_0,angle_f)
cairo_set_source_rgba(cr,bir,big,bib,bia)
cairo_set_line_width(cr,bilw)
cairo_stroke(cr)
end

function conky_draw_shape()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
--settings below
--setup which conky objects to parse
cpu=conky_parse('${cpu}')
mem=conky_parse('${memperc}')
--draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la, rotate)
draw_bar(cpu, 150, 20, 75, 50, 0, 1, 0, 0.5, 0, 1, 0, 1, 10, 1, 0, 0, 0.5, -45)
draw_bar(mem, 150, 40, 250, 30, 0, 0, 1, 0.5, 0, 0, 1, 1, 20, 0, 1, 0, 0.5, 90)
--draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia)
draw_ring(cpu, 150, 170, 50, 30, 0, 360, 0, 1, 0, 0.5, 0, 1, 0, 1, 20, 1, 0, 0, 0.5, 30, 0, 1, 1, 0.8) 
draw_ring(mem, 325, 170, 50, 30, 0, 360, 0, 0, 1, 0.5, 0, 0, 9, 1, 10, 1, 1, 0, 0.5, 10, 1, 0, 1, 0.8) 
end 
end

for conky, do the usual... 
lua_load ~path to file
lua_draw_hook_pre function_name (draw_shape for the above)

Last edited by mrpeachy (2010-02-23 04:56:02)

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: My Conky Config

sooner or later I'm bound to get bored of lua cairo and conky...
but until that day comes... heres something new...

tired of that little pointy cpu graph that conky draws for you?

of course you are!

so here
http://omploader.org/tM2owZQ

in action (in red with the conky cpu graph above) http://blip.tv/file/3203953

EDIT and I can think of a number of ways to reconfigure the output... like this:
http://omploader.org/tM2owZA
in action:  http://blip.tv/file/3208338

here is how it works (its a long one)(code below outputs the bars)
timerbars.lua

--[[moving graphs by mrpeachy (2010)]]
require 'cairo'

function cpugraph(across, down, width, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)

local function returner(cpua, cpub, cpuc, cpud, cpue, cpuf, cpug, cpuh, cpui)
cpu192=cpua
cpu193=cpub
cpu194=cpuc
cpu195=cpud
cpu196=cpue
cpu197=cpuf
cpu198=cpug
cpu199=cpuh
cpu200=cpui
end
--draw background
cairo_set_source_rgba (cr, bgr, bgg, bgb, bga);
cairo_rectangle (cr, across, down, width*10, 100*-1)
cairo_fill (cr)
--draw indicator lines
cairo_set_source_rgba (cr, inr, ing, inb, ina);
local timer=(update_num % 20)+1
local cpu_num=conky_parse('${cpu}')
cpu=tonumber(cpu_num)
if timer == 1 then
cpu1=cpu192
cpu2=cpu193
cpu3=cpu194
cpu4=cpu195
cpu5=cpu196
cpu6=cpu197
cpu7=cpu198
cpu8=cpu199
cpu9=cpu200
cpu10=cpu
cairo_rectangle (cr, across, down, width, cpu1*-1)
cairo_rectangle (cr, (across+width), down, width, cpu2*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu3*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu4*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu5*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu6*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu7*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu8*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu9*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu10*-1)
cairo_fill (cr)
else
if timer == 2 then
cpu11=cpu2
cpu12=cpu3
cpu13=cpu4
cpu14=cpu5
cpu15=cpu6
cpu16=cpu7
cpu17=cpu8
cpu18=cpu9
cpu19=cpu10
cpu20=cpu
cairo_rectangle (cr, across, down, width, cpu11*-1)
cairo_rectangle (cr, (across+width), down, width, cpu12*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu13*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu14*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu15*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu16*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu17*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu18*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu19*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu20*-1)
cairo_fill (cr)
else
if timer == 3 then
cpu21=cpu12
cpu22=cpu13
cpu23=cpu14
cpu24=cpu15
cpu25=cpu16
cpu26=cpu17
cpu27=cpu18
cpu28=cpu19
cpu29=cpu20
cpu30=cpu
cairo_rectangle (cr, across, down, width, cpu21*-1)
cairo_rectangle (cr, (across+width), down, width, cpu22*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu23*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu24*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu25*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu26*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu27*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu28*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu29*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu30*-1)
cairo_fill (cr)
else
if timer == 4 then
cpu31=cpu22
cpu32=cpu23
cpu33=cpu24
cpu34=cpu25
cpu35=cpu26
cpu36=cpu27
cpu37=cpu28
cpu38=cpu29
cpu39=cpu30
cpu40=cpu
cairo_rectangle (cr, across, down, width, cpu31*-1)
cairo_rectangle (cr, (across+width), down, width, cpu32*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu33*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu34*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu35*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu36*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu37*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu38*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu39*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu40*-1)
cairo_fill (cr)
else
if timer == 5 then
cpu41=cpu32
cpu42=cpu33
cpu43=cpu34
cpu44=cpu35
cpu45=cpu36
cpu46=cpu37
cpu47=cpu38
cpu48=cpu39
cpu49=cpu40
cpu50=cpu
cairo_rectangle (cr, across, down, width, cpu41*-1)
cairo_rectangle (cr, (across+width), down, width, cpu42*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu43*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu44*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu45*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu46*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu47*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu48*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu49*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu50*-1)
cairo_fill (cr)
else
if timer == 6 then
cpu51=cpu42
cpu52=cpu43
cpu53=cpu44
cpu54=cpu45
cpu55=cpu46
cpu56=cpu47
cpu57=cpu48
cpu58=cpu49
cpu59=cpu50
cpu60=cpu
cairo_rectangle (cr, across, down, width, cpu51*-1)
cairo_rectangle (cr, (across+width), down, width, cpu52*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu53*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu54*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu55*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu56*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu57*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu58*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu59*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu60*-1)
cairo_fill (cr)
else
if timer == 7 then
cpu61=cpu52
cpu62=cpu53
cpu63=cpu54
cpu64=cpu55
cpu65=cpu56
cpu66=cpu57
cpu67=cpu58
cpu68=cpu59
cpu69=cpu60
cpu70=cpu
cairo_rectangle (cr, across, down, width, cpu61*-1)
cairo_rectangle (cr, (across+width), down, width, cpu62*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu63*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu64*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu65*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu66*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu67*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu68*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu69*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu70*-1)
cairo_fill (cr)
else
if timer == 8 then
cpu71=cpu62
cpu72=cpu63
cpu73=cpu64
cpu74=cpu65
cpu75=cpu66
cpu76=cpu67
cpu77=cpu68
cpu78=cpu69
cpu79=cpu70
cpu80=cpu
cairo_rectangle (cr, across, down, width, cpu71*-1)
cairo_rectangle (cr, (across+width), down, width, cpu72*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu73*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu74*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu75*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu76*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu77*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu78*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu79*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu80*-1)
cairo_fill (cr)
else
if timer == 9 then
cpu81=cpu72
cpu82=cpu73
cpu83=cpu74
cpu84=cpu75
cpu85=cpu76
cpu86=cpu77
cpu87=cpu78
cpu88=cpu79
cpu89=cpu80
cpu90=cpu
cairo_rectangle (cr, across, down, width, cpu81*-1)
cairo_rectangle (cr, (across+width), down, width, cpu82*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu83*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu84*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu85*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu86*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu87*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu88*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu89*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu90*-1)
cairo_fill (cr)
else
if timer == 10 then
cpu91=cpu82
cpu92=cpu83
cpu93=cpu84
cpu94=cpu85
cpu95=cpu86
cpu96=cpu87
cpu97=cpu88
cpu98=cpu89
cpu99=cpu90
cpu100=cpu
cairo_rectangle (cr, across, down, width, cpu91*-1)
cairo_rectangle (cr, (across+width), down, width, cpu92*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu93*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu94*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu95*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu96*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu97*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu98*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu99*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu100*-1)
cairo_fill (cr)
else
if timer == 11 then
cpu101=cpu92
cpu102=cpu93
cpu103=cpu94
cpu104=cpu95
cpu105=cpu96
cpu106=cpu97
cpu107=cpu98
cpu108=cpu99
cpu109=cpu100
cpu110=cpu
cairo_rectangle (cr, across, down, width, cpu101*-1)
cairo_rectangle (cr, (across+width), down, width, cpu102*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu103*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu104*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu105*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu106*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu107*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu108*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu109*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu110*-1)
cairo_fill (cr)
else
if timer == 12 then
cpu111=cpu102
cpu112=cpu103
cpu113=cpu104
cpu114=cpu105
cpu115=cpu106
cpu116=cpu107
cpu117=cpu108
cpu118=cpu109
cpu119=cpu110
cpu120=cpu
cairo_rectangle (cr, across, down, width, cpu111*-1)
cairo_rectangle (cr, (across+width), down, width, cpu112*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu113*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu114*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu115*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu116*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu117*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu118*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu119*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu120*-1)
cairo_fill (cr)
else
if timer == 13 then
cpu121=cpu112
cpu122=cpu113
cpu123=cpu114
cpu124=cpu115
cpu125=cpu116
cpu126=cpu117
cpu127=cpu118
cpu128=cpu119
cpu129=cpu120
cpu130=cpu
cairo_rectangle (cr, across, down, width, cpu121*-1)
cairo_rectangle (cr, (across+width), down, width, cpu122*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu123*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu124*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu125*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu126*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu127*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu128*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu129*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu130*-1)
cairo_fill (cr)
else
if timer == 14 then
cpu131=cpu122
cpu132=cpu123
cpu133=cpu124
cpu134=cpu125
cpu135=cpu126
cpu136=cpu127
cpu137=cpu128
cpu138=cpu129
cpu139=cpu130
cpu140=cpu
cairo_rectangle (cr, across, down, width, cpu131*-1)
cairo_rectangle (cr, (across+width), down, width, cpu132*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu133*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu134*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu135*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu136*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu137*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu138*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu139*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu140*-1)
cairo_fill (cr)
else
if timer == 15 then
cpu141=cpu132
cpu142=cpu133
cpu143=cpu134
cpu144=cpu135
cpu145=cpu136
cpu146=cpu137
cpu147=cpu138
cpu148=cpu139
cpu149=cpu140
cpu150=cpu
cairo_rectangle (cr, across, down, width, cpu141*-1)
cairo_rectangle (cr, (across+width), down, width, cpu142*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu143*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu144*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu145*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu146*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu147*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu148*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu149*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu150*-1)
cairo_fill (cr)
else
if timer == 16 then
cpu151=cpu142
cpu152=cpu143
cpu153=cpu144
cpu154=cpu145
cpu155=cpu146
cpu156=cpu147
cpu157=cpu148
cpu158=cpu149
cpu159=cpu150
cpu160=cpu
cairo_rectangle (cr, across, down, width, cpu151*-1)
cairo_rectangle (cr, (across+width), down, width, cpu152*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu153*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu154*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu155*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu156*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu157*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu158*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu159*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu160*-1)
cairo_fill (cr)
else
if timer == 17 then
cpu161=cpu152
cpu162=cpu153
cpu163=cpu154
cpu164=cpu155
cpu165=cpu156
cpu166=cpu157
cpu167=cpu158
cpu168=cpu159
cpu169=cpu160
cpu170=cpu
cairo_rectangle (cr, across, down, width, cpu161*-1)
cairo_rectangle (cr, (across+width), down, width, cpu162*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu163*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu164*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu165*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu166*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu167*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu168*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu169*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu170*-1)
cairo_fill (cr)
else
if timer == 18 then
cpu171=cpu162
cpu172=cpu163
cpu173=cpu164
cpu174=cpu165
cpu175=cpu166
cpu176=cpu167
cpu177=cpu168
cpu178=cpu169
cpu179=cpu170
cpu180=cpu
cairo_rectangle (cr, across, down, width, cpu171*-1)
cairo_rectangle (cr, (across+width), down, width, cpu172*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu173*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu174*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu175*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu176*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu177*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu178*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu179*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu180*-1)
cairo_fill (cr)
else
if timer == 19 then
cpu181=cpu172
cpu182=cpu173
cpu183=cpu174
cpu184=cpu175
cpu185=cpu176
cpu186=cpu177
cpu187=cpu178
cpu188=cpu179
cpu189=cpu180
cpu190=cpu
cairo_rectangle (cr, across, down, width, cpu181*-1)
cairo_rectangle (cr, (across+width), down, width, cpu182*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu183*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu184*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu185*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu186*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu187*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu188*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu189*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu190*-1)
cairo_fill (cr)
else
if timer == 20 then
cpu191=cpu182
cpu192=cpu183
cpu193=cpu184
cpu194=cpu185
cpu195=cpu186
cpu196=cpu187
cpu197=cpu188
cpu198=cpu189
cpu199=cpu190
cpu200=cpu
cairo_rectangle (cr, across, down, width, cpu191*-1)
cairo_rectangle (cr, (across+width), down, width, cpu192*-1)
cairo_rectangle (cr, (across+(width*2)), down, width, cpu193*-1)
cairo_rectangle (cr, (across+(width*3)), down, width, cpu194*-1)
cairo_rectangle (cr, (across+(width*4)), down, width, cpu195*-1)
cairo_rectangle (cr, (across+(width*5)), down, width, cpu196*-1)
cairo_rectangle (cr, (across+(width*6)), down, width, cpu197*-1)
cairo_rectangle (cr, (across+(width*7)), down, width, cpu198*-1)
cairo_rectangle (cr, (across+(width*8)), down, width, cpu199*-1)
cairo_rectangle (cr, (across+(width*9)), down, width, cpu200*-1)
cairo_fill (cr)
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
--draw line
cairo_set_source_rgba (cr, lr, lg, lb, la);
cairo_set_line_width (cr, lw)
cairo_rectangle (cr, (across-(lw/2)), (down+(lw/2)), ((width*10)+lw), ((100+lw)*-1))
cairo_stroke (cr)
returner(cpu192, cpu193, cpu194, cpu195, cpu196, cpu197, cpu198, cpu199, cpu200)
end
end
--this is the function that you call in conky
--the numbers set all of the placement, size and color parameters (currently graph height is set to 100)
function conky_draw_graph()
--cpugraph(across, down, width, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la)
cpugraph(100, 200, 20, 1, 0, 1, 1, 1, 1, 0, 1, 10, 0, 1, 0, 0.5)
end

Last edited by mrpeachy (2010-02-23 04:55:15)

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: My Conky Config

Hi  mrpeachy,

I read your note on your blog and I see I tried to do something like you this morning.
The capture:
http://img638.imageshack.us/img638/4880/equalizerwidget.png

this moving graph in action

an example of code to obtain the move (it remembers the last 20 values), it doen't depend on the shape you want to draw:

    local updates=tonumber(conky_parse('${updates}'))
    if updates==1 then     
        len_t=20
        t1={} 
    end
    if updates> 3 then
        for i = 1, tonumber(len_t) do
            if t1[i+1]==nil then t1[i+1]=0 end
            t1[i]=t1[i+1]    
            if i==len_t then
                t1[len_t]=tonumber(conky_parse('${cpu cpu0}'))
            end
            your_function_to_draw_one_bar_here(x,y,value)
        end
    end        

As it uses arrays, this code is shorter than yours but it can be improved for shifting the array.
On the capture, the bars were drawn with a widget from my blog with some minors changed. If tou are interesting for the full working code, let me know.
hth

Re: My Conky Config

wlourf wrote:

Hi  mrpeachy,

an example of code to obtain the move (it remembers the last 20 values), it doen't depend on the shape you want to draw:

    local updates=tonumber(conky_parse('${updates}'))
    if updates==1 then     
        len_t=20
        t1={} 
    end
    if updates> 3 then
        for i = 1, tonumber(len_t) do
            if t1[i+1]==nil then t1[i+1]=0 end
            t1[i]=t1[i+1]    
            if i==len_t then
                t1[len_t]=tonumber(conky_parse('${cpu cpu0}'))
            end
            your_function_to_draw_one_bar_here(x,y,value)
        end
    end        

As it uses arrays, this code is shorter than yours but it can be improved for shifting the array.
On the capture, the bars were drawn with a widget from my blog with some minors changed. If tou are interesting for the full working code, let me know.
hth

Hi wlourf
very nice smile
i suspected there was a way to do something similar without going through so many lines of code
i just don't have the code writing experience to use things like arrays as you have above. (but looking at what you posted I do understand how it works)
in terms of coding im still a total noob big_smile

EDIT - but come to think of it it makes sense to separate the data capturing from the image drawing functions.  So that each widget draws 1 bar and is fed one value..so you don't have to worry about working with a timer or compensating for a reset.  (It was on my to do list to see if i could redo that script using the "for i" thingy)

please go ahead and post the whole code, I'm sure others would be interested in using this graphic (i would certainly like to see it and see how the strings generated by the above array are sent to the widget and how the widget puts the image on the screen)

some tinkering and I have this to draw a dot line:
http://omploader.org/tM2pqeg

--[[dotgraph version 2 by mrpeachy (2010) incorporating code by wlourf based on original moving graph script by mrpeachy]]
require 'cairo'

function dotdraw(cr, num, across)
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_arc(cr,20*across,(100-num),3,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
end

function conky_draw_schematic()
    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==1 then     
        len_t=20
        t1={}   
    end
    if updates> 3 then
      for i = 1, tonumber(len_t) do
            if t1[i+1]==nil then t1[i+1]=0 end
            t1[i]=t1[i+1]    
            if i==len_t then
                t1[len_t]=tonumber(conky_parse('${cpu}'))
            end
            dotdraw(cr, t1[i], i)
      end        
      cairo_destroy(cr)
      cairo_surface_destroy(cs)
   end
end

thats a couple of hundred lines shorter--- works now having looked at wlourf's code more closely smile .. gonna have to figure out for myself exactly what's going on

Last edited by mrpeachy (2010-02-23 04:54:43)

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: My Conky Config

Ok, I start with the  conky :

# -- Conky settings -- #
background no
update_interval 0.5

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 desktop
own_window_transparent yes
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_title equalizer widget

border_inner_margin 0
border_outer_margin 0

minimum_size 300 400

alignment tl
gap_x 0
gap_y 0

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

# -- Text settings -- #
use_xft yes
xftfont Santana:size=10
xftalpha 0.8

uppercase no

default_color FFFFFF


# -- Lua Load -- #
# SET THE PATH TO THE SCRIPT HERE
lua_load ~/scripts/cpu/equalizer.lua
lua_draw_hook_pre main

TEXT
${time}
update_interval=0.5
updates=${updates}
cpu0&1=${cpu cpu0} - ${cpu cpu1}

mem=${memperc }% (${mem })

Nothing complicated here, just set the path to the Lua script in it.


And here is the Lua script:

require 'cairo'

--[[ EQUALIZER WIDGET
    v1.1 by wlourf (13 Feb. 2010)
    This widget draw a simple bar like (old) equalizers on hi-fi systems.
    http://u-scripts.blogspot.com/
    
    The arguments are :
    - "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'...
      or you can set it to "" if you want to display a numeric value with arg=numeric_value
    - "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 ''.
    - "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100.
    - "nb_blocks" is the umber of block to draw
    - "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT
      see http://www.cairographics.org/samples/set_line_cap/
    - "xb" and "yb" are the coordinates of the bottom left point of the bar
    - "w" and "h" are the width and the height of a block (without caps)
    - "space" is the space betwwen two blocks, can be null or negative
    - "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF
    - "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON
    - "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON
    - "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100)
    - "led_effect" true or false : to show a block with a led effect
    - "led_alpha" alpha of the center of the led (values from 0 to 1)
    - "smooth" true or false : colors in the bar has a smooth effect
    - "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil)
    - "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar
v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value    
]]

function equalizer(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation)
     local function rgb_to_r_g_b(colour, alpha)
        return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
    
    local function setup_equalizer()

        local value = 0
        if name ~="" then
            local str = conky_parse(string.format('${%s %s}', name, arg))
            value = tonumber(str)
        else
            value = arg
        end
        if value==nil then value =0 end
        local pct = 100*value/max
        local pcb = 100/nb_blocks
        
        cairo_set_line_width (cr, h)
        cairo_set_line_cap  (cr, cap)
        
        local angle= rotation*math.pi/180
        for pt = 1,nb_blocks do  
            local light_on=false
            --set colors
            local col,alpha = bgc,bga
            if pct>=(100/nb_blocks/2) then --start after an half bloc
                if pct>=(pcb*(pt-1)) then 
                    light_on=true
                    col,alpha = fgc,fga
                    if pct>=alarm and (pcb*pt)>alarm then col,alpha = alc,ala end
                end
            end

            --vertical points
            local x1=xb
            local y1=yb-pt*(h+space)
            local radius0 = yb-y1
    
            local x2=xb+radius0*math.sin(angle)
            local y2=yb-radius0*math.cos(angle)
            
            --line on angle
            local a1=(y2-yb)/(x2-xb)
            local b1=y2-a1*x2

            --line perpendicular to angle
            local a2=-1/a1
            local b2=y2-a2*x2
            
            --dots on perpendicular
            local xx0,xx1,yy0,yy1=0,0,0,0
            if rotation == 90  or rotation == 270 then
                xx0,xx1=x2,x2
                yy0=yb
                yy1=yb+w
            else
                xx0,xx1=x2,x2+w*math.cos(angle)
                yy0=xx0*a2+b2
                yy1=xx1*a2+b2
            end

            --perpendicular segment
            cairo_move_to (cr, xx0 ,yy0)
            cairo_line_to (cr, xx1 ,yy1)
        
            --colors
            local xc,yc=(xx0+xx1)/2,(yy0+yy1)/2
            if light_on and led_effect then
                local pat = cairo_pattern_create_radial (xc, yc, 0, xc,yc,w/1.5)
                cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col,led_alpha))
                cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col,alpha))
                cairo_set_source (cr, pat)
                cairo_pattern_destroy(pat)
            else
                cairo_set_source_rgba(cr, rgb_to_r_g_b(col,alpha))
            end 

            if light_on and smooth then
                local radius = (nb_blocks+1)*(h+space)
                if pt==1 then 
                    xc0,yc0=xc,yc --remember the center of first block
                end
                cairo_move_to(cr,xc0,yc0)
                local pat = cairo_pattern_create_radial (xc0, yc0, 0, xc0,yc0,radius)
                cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fgc,fga))
                cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(alc,ala))
                if mid_color ~=nil then
                    cairo_pattern_add_color_stop_rgba (pat, 0.5,rgb_to_r_g_b(mid_color,mid_alpha))
                end
                cairo_set_source (cr, pat)
                cairo_pattern_destroy(pat)
            end 
        
            cairo_stroke (cr);

        end
    end    
    --prevent segmentation error
    local updates=tonumber(conky_parse('${updates}'))
    if updates> 3 then
        setup_equalizer()
    end
end





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 x0,y0 = 10,  conky_window.height-10
    local blocks = 20
    local cap_round = CAIRO_LINE_CAP_ROUND
    local cap_square = CAIRO_LINE_CAP_SQUARE
    local cap_butt = CAIRO_LINE_CAP_BUTT
    local w,h=5,5
    local s=1
    local bgc,bga = 0x00CC66, 0.215
    local fgc,fga = 0x66FF00, 1
    local alc,ala = 0xFF00FF, 1
    local mid_color,mid_alpha = 0xFFFF00, 1.0
    local led_effect, led_alpha = true ,  1.0
    local alarm = 50
    local smooth = true
    

    local updates=tonumber(conky_parse('${updates}'))
    if updates==1 then     
        len_t=20
        t1={} 
        t2={}
        len_t3=50
        t3={}
    end
    if updates> 3 then
        for i = 1, tonumber(len_t) do
            if t1[i+1]==nil then t1[i+1]=0 end
            if t2[i+1]==nil then t2[i+1]=0 end
            t1[i]=t1[i+1]    
            t2[i]=t2[i+1]
            if i==len_t then
                t1[len_t]=tonumber(conky_parse('${cpu cpu0}'))
                t2[len_t]=tonumber(conky_parse('${cpu cpu1}'))
            end
            --(reminder
            --(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation)    
            equalizer('', t1[i],    100,    blocks, cap_butt, x0+i*(w+s), y0,     w,h,s,bgc,bga, fgc,fga, alc,ala, alarm, false, led_alpha,smooth,mid_color,mid_alpha,0)
            equalizer('', t2[i],    100,    blocks, cap_round, x0+i*5+2, y0-150,     0,h,s,bgc,0, 0x99FFFF,fga, 0xFF0000,ala, 75, led_effect, led_alpha,smooth,0xFFCCCC,mid_alpha,0)
        end
        for i = 1, len_t3 do
            if t3[i+1]==nil then t3[i+1]=0 end
            t3[i]=t3[i+1]
            if i==len_t then
                t3[len_t3]=tonumber(conky_parse('${cpu}'))
            end
            --(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation)    
            equalizer('', t3[i],    100,    blocks, cap_butt,150+x0, y0-i,     1,5,-1,bgc,1, 0x99FFFF,fga, 0xFF0000,50, 100, false, led_alpha,true,0xFFFF00,mid_alpha,90)
        end        
    end        
    
    cairo_destroy(cr)
    cairo_surface_destroy(cs)

end

The first 136 lines are the widget itself, and the code to call the widget is in the function conky_main().
It's just an example but it can burn some cpu. Code can be optimized because I have a graph with 20 bars (len_t=20) and one vertical graph with 50 bars (len_t3=50) and two 'for loop' for that.
I let you try and if you have questions, don't hesitate (but speak slowly as english is not my native langage smile

--------------
Edit, I read your script : very nices, theses dancing dots ! You can remove the second loop ans write the code in the previous loop.
Also with conky 1.7.2, I had to initialize the cpunum variable with
if update_num==1 then cpunum={} end
and in the dotdraw function, I had to check the num variable
if num==nil then num=0 end
elsewhere I get errors when running your script.

Last edited by wlourf (2010-02-13 21:36:52)

Re: My Conky Config

wlourf wrote:

Edit, I read your script : very nices, theses dancing dots ! You can remove the second loop ans write the code in the previous loop.
Also with conky 1.7.2, I had to initialize the cpunum variable with
if update_num==1 then cpunum={} end
and in the dotdraw function, I had to check the num variable
if num==nil then num=0 end
elsewhere I get errors when running your script.

i have updated my code above and it should work... I stuck more closely to your code as  I have not  figured out the bits and pieces you mention above yet. smile
like "initializing the variable"... not quite sure what that means or why it is necessary.

Last edited by mrpeachy (2010-02-13 23:01:54)

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: My Conky Config

using a similar approach I was able to create a continuous scroll function in conky
no empty spaces, it just keeps scrolling (unlike the regular scroll you can get in conky which scrolls your message then scrolls a whole lot of of nothing)

http://omploader.org/tM2pwdQ

and watch here: http://blip.tv/file/3215879 (record my desktop made it all jumpy)

scroll.lua

--[[continuous scroll by mrpeachy (2010)]]
require 'cairo'
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
function textdraw(cr, txt, across, length)
size=length
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, size);
cairo_move_to (cr,((size/1.5)*across),100)
cairo_show_text (cr, txt)
end
function conky_draw_textline()
    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}'))
--set font size
fons=40
--this section formats time outputs
--time
hrs=os.date("%H:%M")
--date
mnt=os.date("%m/%d/%y")
--this sectiion formats common conky outputs
--cpu
local cpunum=conky_parse("${cpu}")
cpu=tonumber(cpunum)
--mem
local memnum=conky_parse("${memperc}")
mem=tonumber(memnum)
--hdd
local hddnum=conky_parse("${fs_used_perc /}")
hdd=tonumber(hddnum)
--formats text output and sets timer
text1=("time " .. hrs .. " date " .. mnt .. " HDD USED " .. hdd .. "% ")
texlen=string.len(text1)
text2=string.upper(text1)
text3=string.gsub(text2, ".", "%1|")
textsp=string.split(text3, "|")
timer=(updates % tonumber(texlen))+1
for i = 1, texlen do
if timer == i then
txst=textsp[i]
end
end


    if updates==5 then     
        len_t=20
        t1={} 
    end
    if updates> 10 then
--draws background
cairo_set_source_rgba (cr, 0, 0, 0, 1);
cairo_rectangle (cr, (fons/2), 106, (len_t*(fons/1.47)), -(fons))
cairo_fill (cr)   
      for i = 1, len_t do
            if t1[i+1]==nil then t1[i+1]=0 end
            t1[i]=t1[i+1]    
            if i==len_t then
                t1[len_t]=txst
            end
 
            textdraw(cr, t1[i], i, fons)
      end        
      cairo_destroy(cr)
      cairo_surface_destroy(cs)
   end
end

conky

lua_load /home/mcdowall/lua/scroll.lua
lua_draw_hook_pre draw_textline
TEXT

unfortunately it has its drawbacks.  Principally that the information isn't "live" so that if you display cpu usage in the scroll it will not update as it makes its way across.  Would be good for one of those music title scrolls.
...the code needs some prettying up smile

Last edited by mrpeachy (2010-02-23 04:53:02)

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: My Conky Config

tawan wrote:

the whole screen looks like this
http://omploader.org/tM2ZudQ


That "moshimoshi" watermark cracks me up dude

873

Re: My Conky Config

p0rksh3d wrote:

That "moshimoshi" watermark cracks me up dude

I just asked the Mrs as she speaks some Japanese and she said it mean 'hello' or similar.

I had no idea, the graphic is straight from the gmail ninja theme, I didn't make it. wink

I blog too much....       geek stuff LinuxMintDebian | linux noob stuff LinuxMintNoob | spiritual stuff Daily Cup of Tao

874

Re: My Conky Config

mrpeachy wrote:

in terms of coding im still a total noob big_smile

HAHAHAHAHAHAHAHAHAHAHAHAHAHA!!!

You a code noob that is soooooooooo good, and "total" no less!!

IMHO, do you ever need to look up the meaning of: noob, nOOb, NooB, n00b.

I can't speak for others but I've beem impressed with a lot of your stuff, and I'm fully aware you are learning (rapidly) but a "code noob" you are NOT!

Now take me on the other hand, if you look up the definition of noob it ends with:

See: Bruce

Have a nice day.
Bruce

875

Re: My Conky Config

wlourf wrote:

I read your note on your blog and I see I tried to do something like you this morning.
The capture:

I'd like to see the conky - the code and everything that did that.  It's great.

How did you get the graph sideways?

Have a nice day.
Bruce

Last edited by Bruce (2010-02-14 13:31:41)