SEARCH

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

You are not logged in.

#5126 2013-04-18 21:05:58

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

Re: The New Monster Conky Thread

Greetings all Conky Masters   monkey
Having an issue that is a result of my own lack of knowledge.  As posted earlier on page 204 (post #5083)I moved my disk space down to the bottom and using a lua script have the status bars.  I am using {offset} vice {voffset} which may be my problem.  When I finally got the offsets correct to line the text up with the status bars I had this:
201d6d249714137.jpg

Over the next few days, the text has been creeping to the left:
b66a84249715489.jpg

I am sure a few of you can tell me in a heartbeat why this is happening.

Also, how hard would it be to add these lua status bars into my present info conky in place of the standard ones I am using for CPU and RAM.
Info_Conky
dca621249714750.jpg

conkyrc:
http://pastebin.com/LhTt1vTd

Thanks in advance for any guidance, info, and education you can provide.

All the best,

Ian

Last edited by ichase (2013-04-18 21:12:46)

Offline

Help fund CrunchBang, donate to the project!

#5127 2013-04-18 21:43:10

damionhh
Member
Registered: 2012-10-11
Posts: 37

Re: The New Monster Conky Thread

i know people have plenty of these but i just couldnt find one i liked.  heres mine

# !/usr/bin/bash
METRIC=0 #Should be 0 or 1; 0 for F, 1 for C
if [ -z $1 ]; then
    echo "USAGE: weather.sh <locationcode>"
    exit 0;
fi

wget -q http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 -O - | gawk \
'/Currently:/ {CurWeather=$0}
/[0-9][0-9][0-9][0-9] Forecast<\/title>/ {nr=NR+3; split($0,z," "); split(z[1],r,"/|>"); DateIndx[x+1]=mktime(sprintf("%s %s %s 0 0 0",r[4],r[2],r[3]))} 
NR==nr   {postIndx[++x]=$0}
# x>2    {exit}
END{
    split(CurWeather,tmp,"Currently: ")
    split(tmp[2],tmp1,"<")
    CurWeather=sprintf("%s",tmp1[1])
    sub(":",",",CurWeather)
    
    for(x in postIndx){
		split(postIndx[x],tmp,";|&")
		split(tmp[1],tmp,">")
		split(tmp[2],statement," F ") # substitute C for F if metric differs
		split(tmp[2],temp)
		forecast[++y]=sprintf("%s %d-%dF %-15s",strftime("%a",DateIndx[x]),temp[5],temp[2],statement[3])
    }
    printf("Now %s\n%s\n%s\n",CurWeather,forecast[1],forecast[2])
}'

and you call it from conky by using this line in your .conkyrc
you must have gawk installed also.  (thanks for pointing that out monica)

${execi 1800 /path/to/weather.sh 90011}

make sure to cut the script code and paste it into weather.sh and make the file executable.  replace 90011 with your actual zipcode.  checks every 30 minutes.  i modified this script i found over in the ArchLinux forums.

Last edited by damionhh (2013-04-25 00:38:00)

Offline

#5128 2013-04-18 23:22:59

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 12,022
Website

Re: The New Monster Conky Thread

@ ichase ....

1. you are not using a "mono font" and that 140 is wider that the 141 in the second image.

2. voffset is for "vertical" and "offset" for horizontal - however, from where you use it, so when 140 because 141 it shifted a bit ...

Best bet is to use a mono font, may I suggest: monofur,  and ${goto xx} for exact positioning.

Check this out: Goto/offset/voffset

We need the conky file AND the LUA script to show you how to add that to your conky.

I think you'll need to have them like this though:

/                   140Gib / 360GiB
OOOOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXX

/server             140Gib / 360GiB
OOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

/external           140Gib / 360GiB
OOOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Also "where" you want it added.

Last edited by Sector11 (2013-04-18 23:24:37)


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy | IcyBlack | LinuxBBQ

Offline

#5129 2013-04-19 01:54:45

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

Re: The New Monster Conky Thread

Greetings S11,
voffset offset, yeah yeah, I knew that, just testing you.  LOL  ops ops ops
Here is the conkyrc_fs for the disk space:  http://pastebin.com/9GcZyQf5

And here is the lua script for the status bars:  http://pastebin.com/atHGWYny  I grabbed this script on the Arch linux Conky page and modified it to only have the 3 I required.

I would like replace the existing status bars in my info conky with the lau bars in the exact place the existing standard bars are

Does that even make sense?  big_smile

Thanks for the voffset, offset, goto link.  Bookmarking that to my conky folder in FF. 

All the best,

Ian

Offline

#5130 2013-04-19 02:14:24

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

Re: The New Monster Conky Thread

ichase wrote:

And here is the lua script for the status bars:  http://pastebin.com/atHGWYny  I grabbed this script on the Arch linux Conky page and modified it to only have the 3 I required.

I would like replace the existing status bars in my info conky with the lau bars in the exact place the existing standard bars are

Does that even make sense?  big_smile

Ian

Thanks for posting that script; lost mine a while back. And yes, you can replace the existing standard bars with the lua bars easy enough. Just need to change the x= and y= values in the lua script to place the bars where you want them. I think there is an example at Conky Pitstop - or maybe a link to wlourf's website with all his conky lua work.

Last edited by PackRat (2013-04-19 02:17:01)


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

Offline

#5131 2013-04-19 02:24:16

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 12,022
Website

Re: The New Monster Conky Thread

ichase wrote:

Greetings S11,
voffset offset, yeah yeah, I knew that, just testing you.  LOL  ops ops ops

Say what!!!!  A test!!!!   Did I pass??  big_smile

ichase wrote:

Does that even make sense?  big_smile

Yup, perfect sense.  I don't have time at the moment but will look at it tomorrow.
Have the three files and three images here.

Basically you will call it into your existing "conkyrc" the same way, then "tweak" the LUA script to put the output where your want it.

lua_load ~/bargraph_small_fs.lua
lua_draw_hook_post main_bars

TEXT

Until tomorrow ... unless someone else answers first.


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy | IcyBlack | LinuxBBQ

Offline

#5132 2013-04-19 02:45:42

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: The New Monster Conky Thread

lionhead wrote:

i'm using a part of mrpeachys script to draw bars:


Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/v9000.lua:1746: attempt to perform arithmetic on global 'conum' (a nil value)

this is the 'problem-row':

local inum=(((width-lw)/100)*conum)

actually that isn't the problem line it is just the line where the error is occurring (if you see the distinction)
this is where some detective work will come in useful
(and its the detective work and the figuring out of stuff like this that makes you a better script writer in my opinion)

use print

put a print command above that line like this

print (conum)
local inum=(((width-lw)/100)*conum)

watch the termnial and it will spit out "nil"

so go find the line where the variable conum is being set
what other variables or calculations go into the conum variable?

use print to test each of the inputs and trace those down if need be

are you taking data from conky_parse and performing calculations on them?
try using tonumber on the conky_parse lines to make sure they are being recognized as numbers
or tostring if it is the opposite problem

detect, track and solve!  FTW

Last edited by mrpeachy (2013-04-19 02:50:17)

Offline

#5133 2013-04-19 08:05:29

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

Finally I'll do somethin like that:radioplayer

Offline

#5134 2013-04-19 09:30:16

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

Re: The New Monster Conky Thread

hello

the script works but it shows the error-message only three times (maybe after function gets the necessary datas?).

this is the call of the function (example):

draw_bar({var="cpu",dev="cpu0", w=150,h=10, x=15,y=400, bgc=0xffff00, indc=0x0000ff, lc=0x000000,lw=2})

i use conky_parse:

conum=conky_parse("${"..var..' '..dev.."}")
conum=tonumber(conum)

local inum=(((width-lw)/100)*conum)

btw: i tried the command 'print' at first smile

regards, alex

Offline

#5135 2013-04-19 10:17:47

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

Re: The New Monster Conky Thread

S11,  Thanks for the advice and guidance  smile
I have removed the {offset} and added {goto} with spacing and got it pretty darn close.  Did not get to study in depth your link but with the little time I have I got it close.  Used the monofur font as suggested.
3c9dc4249787861.jpg

This is what I did with the .conkyrc_fs:
http://pastebin.com/bbZHaKmX

Though with pastebin, it word wrapped so this may be a moot point.  Am sure there is a setting in pastebin where you can disable word wrap.

Offline

#5136 2013-04-19 10:49:16

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

Re: The New Monster Conky Thread

ragamatrix wrote:

I'm trying but when one is lanched the other freeze "error in lua"
I did this:
loadAll.lua:

package.path = "/home/climatix/.conky/conky6/?.lua"
require 'weathercircle' --for scriptA.lua ".lua" is not required here
require 'thermometer3'

function conky_main()
     conky_weather()
     conky_quadrants()
end

thermometer3.lua:

--[[weather display by mrpeachy nov 2011
version 4
-cleaned up a bit
-temp scale changing
-set mid point temp for color change
-added forecast display
-added wind speed guage
-added hi lo thermometers
]]
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=300--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=SZXX0014"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="C"--set units for C or F
mid=75--this is the temp at which temp scale is yellow, ie mid point in color change scale
----###weathericons="~/v9000/additional_files/weathericons/"
--#########################################################################################################

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_quadrants()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
local timer=(updates %secs)+1
if timer==1 or updates==6 then
local f=io.popen("curl '"..web.."' | grep -A62 'As of ' | gawk -F'>' -v RS='</' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e '/^$/d' -e 's/&deg;//g' -e 's/%//g' -e 's/  / /g' -e 's/Thunderstorms/T.Storms/g'")
local data1=f:read("*a")
f:close()
local data2=string.split(data1,"\n")
local data={}
for i,v in pairs(data2) do
if string.find(v,"[%a%d]")~=nil then
table.insert(data,data2[i])
end
end
--##############################################
--current
local wdr=string.split(data[25]," ")
now={con=string.gsub(data[2],"[\r\n]",""),tmp=string.gsub(data[4],units,""),flk=string.gsub(data[5],"Feels Like: ",""),wch=data[7],cel=data[10],hid=data[12],vis=string.gsub(data[15],"[ %a]",""),dpt=data[17],wsp=string.gsub(data[20],"[ %a]",""),wdg=(wdr[1]),wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),wgs=string.gsub(data[30],"[ %a]",""),hum=data[22],prs=string.gsub(data[27],"\"","")}
--############################################
--forecast
local f=io.popen("curl '"..web.."' | grep -A554 'View the Calendar Forecast' | gawk -F'>' -v RS='<' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e 's/&deg;//g' -e 's/  / /g' -e 's/%//g' -e 's/&deg//g' -e 's/Thunderstorms/T.Storms/g'")
local fdata1=f:read("*a")
f:close()
local fdata=string.split(fdata1,"\n")
local fdata2={}
for i,v in pairs(fdata) do
if string.find(v,"[%a%d]")~=nil then
table.insert(fdata2,fdata[i])
end
end
local uvi=string.split(fdata2[20]," ")
local wsp=string.split(fdata2[32]," ")
local wdr=string.split(fdata2[34]," ")
day1={day=fdata2[2],con=fdata2[3],hih=fdata2[4],low=fdata2[5],sri=fdata2[8],sst=fdata2[10],mri=fdata2[12],mst=fdata2[14],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[22],ppt=fdata2[24],snw=fdata2[26],cld=fdata2[28],mph=fdata2[30],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day2
local uvi=string.split(fdata2[53]," ")
local wsp=string.split(fdata2[65]," ")
local wdr=string.split(fdata2[67]," ")
day2={day=fdata2[35],con=fdata2[36],hih=fdata2[37],low=fdata2[38],sri=fdata2[41],sst=fdata2[43],mri=fdata2[45],mst=fdata2[47],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[55],ppt=fdata2[57],snw=fdata2[59],cld=fdata2[61],mph=fdata2[63],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day3
local start=68
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day3={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day4
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day4={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day5
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day5={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day6
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day6={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day7
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day7={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=wmh,wkm=wkm,wkt=wkt,wdg=wdg,wdi=wdi}
--day8
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day8={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day9
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day9={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day10
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day10={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
end--timer section
display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--################################################################3
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--print (now.con,now.tmp,now.flk,now.wch,now.cel,now.hid,now.vis,now.dpt,now.wsp,now.wdg,now.wgi,now.wgs,now.hum,now.prs)
--[[
--forecast information, 10 day, options
--use like this  dayX.option (where X=day number (1=today,2=tomorrow))
--eg day1.day
day=forecast day and date
con=conditions summary
hih=high temp
low=low temp
sri=sunrise
sst=sunset
mri=moon rise
mst=moon set
uvi=ultraviolet index
hum=humidity
ppt=chance of precipitation
snw=chance of snow
cld=cloud cover
mph=moon phase
wmh=wind speed in mph
wkm=wind speed in km/h
wkt=wind speed in knots
wdg=wind direction in degrees
wdi=wind direction in nesw
]]
--#####################################
--setup text type and color
local font="Mono"
local fsize=10
local red,green,blue,alpha=1,1,1,1
local xpos=430
local ypos=30--first line
local gap1=fsize+2
--TEST
--ypos=490--first line
--xpos=200
--gap1=fsize+2
--gap=0
--text=day2.day;txt(text,xpos,ypos,font,10,red,green,blue,alpha)
--text="    Conditions: "..day2.con;gap=gap1+4;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Max: "..day2.hih.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Min: "..day2.low.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="     Indice UV: "..day2.uvn.." ("..day1.uvt..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Humidité: "..day2.hum.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob pluie: "..day2.ppt.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob Neige: "..day2.snw.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text=" Couv.Nuageuse: "..day2.cld.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="  Vent vitesse: "..day2.wmh.."kmh";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="Vent direction: "..day2.wdg.."° ("..day2.wdi..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)

--#############################################
--wind direction compass
compass(145,240,50,tonumber(now.wdg),now.wsp,now.wgs)
--windspeed dial
wspeed_dial(now.wsp,305,300)
--################################################################3
--pressure barometer
barometer(tonumber(now.prs),110,395)
--#########################################
--humidity bar
humidity(430.5,315.5,tonumber(now.hum))
--#########################################
--current conditions display
--text="Conditions:";txt(text,240,430,"Mono",12,1,1,1,1)
--text="Température: "..now.tmp.."°, Plafond: "..now.cel;txt(text,240,445,"Mono",10,1,1,1,1)
--text=now.con;txt(text,270,465,"Mono",15,1,1,1,1)

end--display
--#############################################################################################################################################################
function wspeed_dial(ws,px,py)
--0 to 60 mph
--draw circle
cairo_set_line_width (cr,1)
local router=110
cairo_set_source_rgba (cr,0.1,0.1,0.1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
-------------------------------------------
--mph scale
local rout1=80
local rin1=rout1-10
for i=0,60 do
if i==5 or i==15 or i==25 or i==35 or i==45 then
rin=rin1--set line length for 5s
cairo_set_line_width (cr,1)
elseif i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 then
rin=rin1+7--set line length for 10's
cairo_set_line_width (cr,3)
else
rin=rin1+5--set other lines
cairo_set_line_width (cr,1)
end--if i==
arc=(math.pi/180)*(210+(i*(300/60)))
ppx=0+rout1*(math.sin(arc))
ppy=0-rout1*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/60))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i=
--mph reading
mph={0,10,20,30,40,50,60}
local rin=rin1-2
for i=1,#mph do
arc=(math.pi/180)*(210+((i-1)*(300/6)))
ppx=0+rin*(math.sin(arc))
ppy=0-rin*(math.cos(arc))
text=mph[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--for i= print inches
--kmh lines and numbers
--60kmh=96.5606
cairo_set_line_width (cr,1)
local m1=300/96.5606
local rout2=60
local rin2=rout2-5
local num=95
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 or i==70 or i==80 or i==90 then
rin=rin2-5--set length for 10s
elseif i==5 or i==15 or i==25 or i==35 or i==45 or i==55 or i==65 or 1==75 or i==85 or i==95 then
rin=rin2-2--set length for 5's
else
rin=rin2
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
kmh={0,10,20,30,40,50,60,70,80,90}
local rout=rin2-18
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=kmh[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--kmh lines and numbers
--knots
--60kmh=52.1386
cairo_set_line_width (cr,1)
local m1=300/52.1386
local rout3=90
local rin3=rout3-5
local num=50
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
rout=rout3-1--set length for 10s
cairo_set_line_width (cr,3)
elseif i==5 or i==15 or i==25 or i==35 or i==45 then
rout=rout3+4--set length for 5's
cairo_set_line_width (cr,1)
else
rout=rout3
cairo_set_line_width (cr,1)
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin3*(math.sin(arc))
piy=0-rin3*(math.cos(arc))
cairo_move_to (cr,px+pix,py+piy)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
knot={0,10,20,30,40,50}
local rout=rin3+15
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=knot[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="mph"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="kmh"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Noeuds"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Mesures Vent"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3+12)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if ws==nil then ws=0 end
local wspd=ws
local m1=300/60
local m2=wspd*m1
local rout1=rout3
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
end--wspeed dial function
--#############################################################################################################################################################
function circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
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,1,1,1,1);
local inum=string.len(text)
local deg=(finish-start)/(inum-1)
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--circlewriting
--#############################################################################################################################################################
--#############################################################################################################################################################
function humidity(x,y,hval1)
hval=hval1*1.5
yt=y-1
rh=200
rw=30
local pat = cairo_pattern_create_linear (0,yt,0,yt+rh);
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 1, 0);
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 1, 1);
cairo_rectangle (cr,x,yt,rw, rh);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_pattern_destroy (pat);
----------
for i=1,11 do
lwid=-1
cairo_set_source_rgba (cr,1,1,1,1)
cairo_move_to (cr,x+rw,(y+150)-((i-1)*15))
cairo_rel_line_to (cr,lwid,0)
cairo_stroke(cr)
end
----------
cairo_set_source_rgba (cr,1,1,1,1)
hh=5
hw1=19
hw2=hw1+10
if hval==nil then hval=0 end
tx,ty=x+hw1,(y+150)-(hval+hh)
ix,iy=x+hw2,(y+150)-hval
bx,by=x+hw1,(y+150)-(hval-hh)
cairo_move_to (cr,tx,ty)
cairo_line_to (cr,ix,iy)
cairo_line_to (cr,bx,by)
cairo_line_to (cr,tx,ty)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
font="Mono"
fsize=12
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_move_to (cr,x+hw2+3,(y+150)-(hval-hh))
cairo_show_text (cr,hval1.."%")
cairo_stroke (cr)
label="Taux d'humidité"
cairo_move_to (cr,x+12,y+150)
cairo_rotate (cr,(math.pi/180)*(-90))
cairo_show_text (cr,label)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(90))
end--humidity
--#############################################################################################################################################################
--#############################################################################################################################################################
function txt(text,xpos,ypos,font,fsize,red,green,blue,alpha)
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,red,green,blue,alpha)
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--function txt
--#############################################################################################################################################################
--#############################################################################################################################################################
function barometer(pr,px,py)
--baromeer 27 inches to 32 inches = 5 inches
cairo_set_line_width (cr,1)
local router=100
cairo_set_source_rgba (cr,0.1,0.1,0.1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
local rout1=75
local rin1=rout1-10
for i=0,40 do
if i==5 or i==15 or i==25 or i==35 then
rout=rout1-7
cairo_set_line_width (cr,3)
elseif i==0 or i==10 or i==20 or i==30 or i==40 then
rout=rout1
cairo_set_line_width (cr,1)
else
rout=rout1-5
cairo_set_line_width (cr,1)
end
arc=(math.pi/180)*(210+(i*(300/40)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/40))
pix=0+rin1*(math.sin(arc))
piy=0-rin1*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--inches reading
inch={28,29,30,31}
local rout=rout1+2
for i=1,4 do
arc=(math.pi/180)*(210+(300/8)+((i-1)*(300/4)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--942 to 1056
--27.5=931.25
--31.5=1066.70
cairo_set_line_width (cr,1)
local m1=300/135.45
local m2=m1*8.75--931.25+8.75=940
local rout2=60
local rin2=rout2-5
local num=60
for i=0,num do
if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 or i==60 or i==65 then
rin=rin2-5
else
rin=rin2
end
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--millibars reading
inch={940,960,980,1000,1020,1040,1060}
local rout=rin2-18
for i=1,7 do
arc=(math.pi/180)*(210+m2+((i-1)*(m1*20)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="inches hg"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="millibars"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2-height)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Pression"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2+35)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if pr==nil then pr=27.5 end
local pres=pr-27.5
local m1=300/4
local m2=pres*m1
local rout1=rout1
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
----text
local horiz=px
local verti=py
local radi=87
local text="TEMPETE"
local font="Mono"
local fsize=12
local start=250
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Pluie"
local start=300
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Variable"
local start=340
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Beau"
local start=395
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="TRES SEC"
local start=435
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
end--barometer
--#############################################################################################################################################################
--#############################################################################################################################################################
function compass(wx,wy,rout,wdeg,w,wg)
local rin=rout-((rout/100)*10)
cairo_set_source_rgba (cr,0.1,0.1,0.1,1)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_stroke (cr)
for i=1,36 do
arc=(math.pi/180)*(i*10)
wpx=0+rout*(math.sin(arc))
wpy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(i*10)
wix=0+rin*(math.sin(arc))
wiy=0-rin*(math.cos(arc))
cairo_move_to (cr,wx+wpx,wy+wpy)
cairo_line_to (cr,wx+wix,wy+wiy)
cairo_stroke (cr)
end
--print directions
local font="Mono"
local fsize=10
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
dirs={"N","NE","E","SE","S","SO","O","NO"}
local rdir=rout-((rout/100)*25)
for i=1,8 do
arc=(math.pi/180)*((i-1)*(360/8))
wdx=0+rdir*(math.sin(arc))
wdy=0-rdir*(math.cos(arc))
text=dirs[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,wx+wdx-(width/2),wy+wdy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--indicator
local npr=rout-((rout/100)*15)
if wdeg==nil then wdeg=0 end
local arc=(math.pi/180)*(wdeg)
local npx=0+npr*(math.sin(arc))
local npy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+npx,wy+npy)
local nprm=rout-((rout/100)*88)
local arc=(math.pi/180)*(wdeg+90)
local npmrx=0+nprm*(math.sin(arc))
local npmry=0-nprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90)
local npmlx=0+nprm*(math.sin(arc))
local npmly=0-nprm*(math.cos(arc))
cairo_line_to (cr,wx+npmrx,wy+npmry)
cairo_line_to (cr,wx+npmlx,wy+npmly)
cairo_line_to (cr,wx+npx,wy+npy)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
---------------------------------
local arc=(math.pi/180)*(wdeg-180)
local spx=0+npr*(math.sin(arc))
local spy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+spx,wy+spy)
local sprm=nprm
local arc=(math.pi/180)*(wdeg+90-180)
local spmrx=0+sprm*(math.sin(arc))
local spmry=0-sprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90-180)
local spmlx=0+sprm*(math.sin(arc))
local spmly=0-sprm*(math.cos(arc))
cairo_line_to (cr,wx+spmrx,wy+spmry)
cairo_line_to (cr,wx+spmlx,wy+spmly)
cairo_line_to (cr,wx+spx,wy+spy)
cairo_fill (cr)
--------------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_stroke (cr)
------------------------
cairo_set_source_rgba (cr,1,1,1,1)
local text="Rose des Vents"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,wx-(width/10),wy-rout-5)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--compass
--#############################################################################################################################################################
--
--#############################################################################################################################################################
function conky_draw_bg(r,x,y,w,h,color,alpha)
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end

weathercicle.lua:

--even more weather by mrpeachy 12/31/11

require 'cairo'
require 'imlib2'
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_weather()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
local home = os.getenv("HOME")
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=1800--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=SZXX0014"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
--set location of weather images
weathericons="~/v9000/additional_files/weathericons/"
weathericons=string.gsub(weathericons, "~", home)
--set defaults
default_font="mono"--font must be in quotes
default_font_size=10
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
--#########################################################################################################
--############start of timed section#######################################################################
--#########################################################################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %secs)+1
--#######################################
if timer==secs or updates==6 then--######
--#######################################
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
if allweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
end
if allweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
end
allweather=string.gsub(allweather,"[\n\r]","")
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions&nbsp' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
if nowweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions&nbsp' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
end
if nowweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions&nbsp' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
end
nowweather=string.gsub(nowweather,"[\n\r]","")
if allweather==nil then 
allweather=""
nowweather="" 
print "error curl operation failed"
end
--intellicast to conky weather icon conversion
wimage={
wx_65="32",
wx_66="30",
wx_67="26",
wx_68="32",
wx_69="28",
wx_70="20",
wx_71="32",
wx_72="21",
wx_73="36",
wx_74="14",
wx_75="28",
wx_76="18",
wx_77="14",
wx_78="23",
wx_79="05",
wx_80="15",
wx_81="15",
wx_82="11",
wx_83="16",
wx_84="00",
wx_85="32",
wx_86="25",
wx_87="09",
wx_88="05",
wx_89="18",
wx_90="18",
wx_91="39",
wx_92="39",
wx_93="39",
wx_94="39",
wx_95="37",
wx_96="37",
wx_97="31",
wx_98="29",
wx_99="27",
wx_100="47",
wx_101="47",
wx_102="33",
wx_103="26",
wx_104="20",
wx_105="45",
wx_106="45",
wx_107="11",
wx_108="46",
wx_109="46",
wx_110="06",
wx_111="18",
wx_112="06",
wx_113="46",
wx_114="46",
wx_115="31",
wx_116="47",
}--end w image table
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
dayshort={Monday="Lun",Tuesday="Mar",Wednesday="Mer",Thursday="Jeu",Friday="Ven",Saturday="Sam",Sunday="Dim",x=""}
monthshort={January="Jan",February="Fev",March="Mar",April="Avr",May="Mai",June="Jui",July="Jui",August="Aou",September="Sep",October="Oct",November="Nov",December="Dec",x=""}
moonfontt={New="=",Full="@",FirstQuarter="G",LastQuarter="T",WaningGibbous="R",WaningCrescent="V",WaxingCrescent="E",WaxingGibbous="I"}
windfontt={S="9",SSW=":",SW=";",WSW="<",W="=",WNW=">",NW="?",NNW="@",N="1",NNE="2",NE="3",ENE="4",E="5",ESE="6",SE="7",SSE="8"}
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
sun_rise={}
sun_rise_lc={}
moon_rise={}
moon_rise_lc={}
sun_set={}
sun_set_lc={}
moon_set={}
moon_set_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
wind_mph={}
wind_km={}
wind_kts={}
wind_direction={}
wind_font={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
-----------------
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
s,f,t=string.find(allweather,"<td colspan=\"2\"><strong>([%a,%s%d]*)</strong></td>",start)
	if t~=nil then
	--split name from month and date
	a,b,day=string.find(t,"(%a*),%s")
	a,b,month=string.find(t,",%s(%a*)%s")
	a,b,date=string.find(t,"(%d*)$")
	--ser day names, regular, caps, lowercase and short
	table.insert(forecast_day,day)
	table.insert(forecast_day_caps,string.upper(day))
	table.insert(forecast_day_lc,string.lower(day))
	table.insert(forecast_day_short,dayshort[day])
	table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
	table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
	--set month types
	table.insert(forecast_month,month)
	table.insert(forecast_month_caps,string.upper(month))
	table.insert(forecast_month_lc,string.lower(month))
	table.insert(forecast_month_short,monthshort[month])
	table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
	table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
	--set date
	table.insert(forecast_date,date)
	end
--intellicast weather icon match
s,f,t=string.find(allweather,"40_white/(wx_..).png\"",start)
--convert to conkyweather icon
	if t~=nil then
	table.insert(weather_icon,weathericons..wimage[t]..".png")
	--convert to weather font
	table.insert(weather_font,wfont[t])
	end
--match conditions
s,f,t=string.find(allweather," /><br />([%a%s/]*)</td>",start)
	if t~=nil then
	table.insert(conditions,t)
	table.insert(conditions_caps,string.upper(t))
	table.insert(conditions_lc,string.lower(t))
	end
--match high temp
s,f,t=string.find(allweather,"\"Hi\">(%d*)&deg",start)
table.insert(high_temp,t)
--match low temp
s,f,t=string.find(allweather,"\"Lo\">(%d*)&deg",start)
table.insert(low_temp,t)
--match sunrise and set-- alt="Sunrise" style="vertical-align:bottom;" /><strong>Rise:</strong> 7:19 AM</td>            <td><strong>Set:</strong> 4:54 PM</td>
--match sun rise times
s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
	if t~=nil then
	table.insert(sun_rise,t)
	table.insert(sun_rise_lc,string.lower(t))
	end
--match sun set times
s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then	
	table.insert(sun_set,t)
	table.insert(sun_set_lc,string.lower(t))
	end
--moon rise
s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then
	table.insert(moon_rise,t)
	table.insert(moon_rise_lc,string.lower(t))
	end
--moon set
s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
	if t~=nil then
	table.insert(moon_set,t)
	table.insert(moon_set_lc,string.lower(t))
	end
--match uv index
s,f,tuv=string.find(allweather,"UV Index:</strong> (%d%s*%(%a*%)) <br />",start)
	if tuv~=nil then
	a,b,t=string.find(tuv,"(%d*)%s*%(%a*%)")
	table.insert(uv_index_num,t)
	a,b,t=string.find(tuv,"%d*%s*%((%a*)%)")
	table.insert(uv_index_txt,t)
	table.insert(uv_index_txt_caps,string.upper(t))
	table.insert(uv_index_txt_lc,string.lower(t))
	end
--match humidity
s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
s,f,t=string.find(allweather,"Snow Probability:</strong>             (%d*)<br />",start)
table.insert(snow,t)
--match cloud coveage
s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
	if t~= nil then
	table.insert(moon_phase,t)
	table.insert(moon_phase_caps,string.upper(t))
	table.insert(moon_phase_lc,string.lower(t))
	--set moon phase font
	mp=string.gsub(t," ","")
	table.insert(moon_font,moonfontt[mp])
	end
--match wind speeds
s,f,t=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
table.insert(wind_mph,t)
s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*)        </div>",start)
	if twd~=nil then
	a,b,t=string.find(twd,"(%d*)&deg;")
	table.insert(wind_deg,t)
	--match wind font and nesw   
	a,b,t=string.find(twd,"%((%a*)%)")
	table.insert(wind_font,windfontt[t])
	table.insert(wind_nesw,t)
	end
if f==nil then break end
start=f
end--while
--#########################################################################################################################################
--end--of timed section
--format now weather
--extract current data
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
s,f,tnow=string.find(nowweather,"<div style=\"float:right;color:#666;\">  As of ([%d%p%a%s]*) %(Local Time%)")
s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
now["time"]=t
now["time_lc"]=string.lower(t)
s,f,t=string.find(tnow,"on (%a*)%s%d*")
now["day"]=t
now["day_caps"]=string.upper(t)
now["day_lc"]=string.lower(t)
ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
ml=monthlong[t]
now["month"]=ml
now["month_caps"]=string.upper(ml)
now["month_lc"]=string.lower(ml)
s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
s,f,t=string.find(nowweather,"40_white/(wx_%d*).png")
now["weather_icon"]=weathericons..wimage[t]..".png"
now["weather_font"]=wfont[t]
s,f,t=string.find(nowweather,"class=\"Icon\" /> (%a*(%s%a*))%s*</td>")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)&deg")
now["temp"]=t
s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)&deg;</a>")
now["feels_like"]=t
s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["wind_chill"]=t
s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
s,f,t=string.find(t,"(%d*)")
t=t.." mi"
end
now["ceiling"]=t
now["ceiling_caps"]=string.upper(t)
now["ceiling_lc"]=string.lower(t)
s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["heat_index"]=t
s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
s,f,t=string.find(t,"(%d*)")
t=t.." mi"
end
now["visibility"]=t
now["visibility_caps"]=string.upper(t)
s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)&deg;</td>")
now["dew_point"]=t
s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
now["wind_mph"]=t.." mph"
s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d&;%s%(%a%)]*)</td>%s*</tr>")
a,b,t=string.find(twd,"(%d*)&deg;")
now["wind_deg"]=t
a,b,t=string.find(twd,"%((%a*)%)")
now["wind_nesw"]=t
now["wind_font"]=windfontt[t]
s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
s,f,t=string.find(t,"(%d*)")
t=t.." mph"
end
now["wind_gusts"]=t
now["wind_gusts_caps"]=string.upper(t)
--###############end of data processing########################
--###########################
end--of timed section########
--###########################
--write lines here to show in conky
--these tables hold the top left coordinates for each repeat as set lower, do not edit
top_left_x_coordinate={}
top_left_y_coordinate={}
--write settings, c=color,a=alpha,f=font,fs=font size,x=x position, y=y position, txt=text or data to show
--eg out({c=0xffff00,a=1,f="Sans",fs=14,x=100,y=100,txt="hello world"})
--image settings, x=top left x position, y=top left y position, w=width of image(0=full size), h=height(0=full size),file=file location
--eg image({x=0,y=35,w=60,h=60,file=now[weather_icon]})
--########################################################
--######### write or paste setups below ##################
--########################################################
midx=160
midy=160
radouter=150
radinner=50
radforecast=90
radhilo=125
radfctxt=130
radcond=110
radsmall=25
fcangle1=0
fcangle2=45
fcangle3=90
fcangle4=135
fcangle5=180
wcr,wcg,wcb,wca=1,1,1,0.3
---------------------------------------------
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
--draw outer circle
cairo_arc (cr,midx,midy,radouter,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
--draw inner circle
cairo_arc (cr,midx,midy,radinner,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
--draw forecast line and text
astr=270
aend=350
cairo_arc (cr,midx,midy,radfctxt,(math.pi/180)*(astr-90),(math.pi/180)*(aend-90))
cairo_stroke (cr)
cwt={text="PREVISIONS",font="mono",fsize=16,radius=radfctxt+3,xpos=midx,ypos=midy,position=1,start=astr,finish=aend,justify=1,letterdeg=5,};cw(cwt)
--set start and end angle for conditions box
astr=205
aend=335
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
cairo_arc (cr,midx,midy,radcond,(math.pi/180)*(astr-90),(math.pi/180)*(aend-90))
cairo_stroke (cr)
cwt={text="CONDITIONS COURANTES ",font="mono",fsize=14,radius=radcond+3,xpos=midx,ypos=midy,position=1,start=astr,finish=aend,justify=1,letterdeg=5,};cw(cwt)
--print current temps
trad=radcond-16
cwt={text="TMP: "..now["temp"].."C / FL: "..now["feels_like"].."C ",font="mono",fsize=14,radius=trad,xpos=midx,ypos=midy,position=2,start=astr+5,finish=aend-5,justify=1,letterdeg=5.5,};cw(cwt)
--print current conditions wrap to length
--wrap settings
line_text=now["conditions_caps"]
max_string_len=16
indent=""
clines=to_lines(line_text,max_string_len,indent)
--set radius for conditions lines (shouldnt need more than 2)
crad1=trad-16
crad2=crad1-16
cwt={text=clines[1],font="mono",fsize=14,radius=crad1,xpos=midx,ypos=midy,position=2,start=astr+5,finish=aend-10,justify=1,letterdeg=7,};cw(cwt)
cwt={text=clines[2],font="mono",fsize=14,radius=crad2,xpos=midx,ypos=midy,position=1,start=astr+5,finish=aend-10,justify=1,letterdeg=8,};cw(cwt)
--connect lines to form curent box
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*astr
xs1=0+radcond*(math.sin(arc))
ys1=0-radcond*(math.cos(arc))
arc=(math.pi/180)*astr
xe1=0+radinner*(math.sin(arc))
ye1=0-radinner*(math.cos(arc))
cairo_move_to (cr,midx+xs1,midy+ys1)
cairo_line_to (cr,midx+xe1,midy+ye1)
cairo_stroke (cr)
arc=(math.pi/180)*aend
xs2=0+radcond*(math.sin(arc))
ys2=0-radcond*(math.cos(arc))
arc=(math.pi/180)*aend
xe2=0+radinner*(math.sin(arc))
ye2=0-radinner*(math.cos(arc))
cairo_move_to (cr,midx+xs2,midy+ys2)
cairo_line_to (cr,midx+xe2,midy+ye2)
cairo_stroke (cr)
--individual fc circles and forecast data
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle1
xfc1=0+radforecast*(math.sin(arc))
yfc1=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc1,midy+yfc1,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
radst=14
	arc=(math.pi/180)*fcangle1
	xfc1hl=0+(radsmall+radst)*(math.sin(arc))
	yfc1hl=0-(radsmall+radst)*(math.cos(arc))
	out({x=midx+xfc1hl+xfc1,y=midy+yfc1hl+yfc1,txt=forecast_day_short_caps[1]})
	out({x=midx+xfc1hl+xfc1,y=midy+yfc1hl+yfc1+12,txt=high_temp[1].."C|"..low_temp[1].."C"})
	cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle2
xfc2=0+radforecast*(math.sin(arc))
yfc2=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc2,midy+yfc2,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
	arc=(math.pi/180)*fcangle2
	xfc2hl=0+(radsmall+radst)*(math.sin(arc))
	yfc2hl=0-(radsmall+radst)*(math.cos(arc))
	out({x=midx+xfc2hl+xfc2,y=midy+yfc2hl+yfc2,txt=forecast_day_short_caps[2]})
	out({x=midx+xfc2hl+xfc2,y=midy+yfc2hl+yfc2+12,txt=high_temp[2].."C|"..low_temp[2].."C"})	
	cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle3
xfc3=0+radforecast*(math.sin(arc))
yfc3=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc3,midy+yfc3,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
	arc=(math.pi/180)*fcangle3
	xfc3hl=0+(radsmall+radst)*(math.sin(arc))
	yfc3hl=0-(radsmall+radst)*(math.cos(arc))
	out({x=midx+xfc3hl+xfc3,y=midy+yfc3hl+yfc3,txt=forecast_day_short_caps[3]})
	out({x=midx+xfc3hl+xfc3,y=midy+yfc3hl+yfc3+12,txt=high_temp[3].."C|"..low_temp[3].."C"})	
	cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle4
xfc4=0+radforecast*(math.sin(arc))
yfc4=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc4,midy+yfc4,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
	arc=(math.pi/180)*fcangle4
	xfc4hl=0+(radsmall+radst)*(math.sin(arc))
	yfc4hl=0-(radsmall+radst)*(math.cos(arc))
	out({x=midx+xfc4hl+xfc4,y=midy+yfc4hl+yfc4,txt=forecast_day_short_caps[4]})
	out({x=midx+xfc4hl+xfc4,y=midy+yfc4hl+yfc4+12,txt=high_temp[4].."C|"..low_temp[4].."C"})	
	cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle5
xfc5=0+radforecast*(math.sin(arc))
yfc5=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc5,midy+yfc5,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
	arc=(math.pi/180)*fcangle5
	xfc5hl=0+(radsmall+radst)*(math.sin(arc))
	yfc5hl=0-(radsmall+radst)*(math.cos(arc))
	out({x=midx+xfc5hl+xfc5,y=midy+yfc5hl+yfc5,txt=forecast_day_short_caps[5]})
	out({x=midx+xfc5hl+xfc5,y=midy+yfc5hl+yfc5+12,txt=high_temp[5].."C|"..low_temp[5].."C"})	
	cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
--show weather icons
imsizel=80
image({x=midx-imsizel,y=midy-imsizel,w=imsizel,h=imsizel,file=now["weather_icon"]})
imsizes=50
image({x=midx+xfc1-imsizes,y=midy+yfc1-imsizes,w=imsizes,h=imsizes,file=weather_icon[1]})
image({x=midx+xfc2-imsizes,y=midy+yfc2-imsizes,w=imsizes,h=imsizes,file=weather_icon[2]})
image({x=midx+xfc3-imsizes,y=midy+yfc3-imsizes,w=imsizes,h=imsizes,file=weather_icon[3]})
image({x=midx+xfc4-imsizes,y=midy+yfc4-imsizes,w=imsizes,h=imsizes,file=weather_icon[4]})
image({x=midx+xfc5-imsizes,y=midy+yfc5-imsizes,w=imsizes,h=imsizes,file=weather_icon[5]})
--#########################################################
--########## end of current conditions ####################
--######### forecast weather and repeat ###################
--#########################################################
--enter number of forecast days to show
number_of_days=8
--enter coordinates of top left corner for each day
top_left_x_coordinate[1],top_left_y_coordinate[1]=270,15
top_left_x_coordinate[2],top_left_y_coordinate[2]=540,15
top_left_x_coordinate[3],top_left_y_coordinate[3]=0,190
top_left_x_coordinate[4],top_left_y_coordinate[4]=270,190
top_left_x_coordinate[5],top_left_y_coordinate[5]=540,190
top_left_x_coordinate[6],top_left_y_coordinate[6]=0,370
top_left_x_coordinate[7],top_left_y_coordinate[7]=270,370
top_left_x_coordinate[8],top_left_y_coordinate[8]=540,370
------------------------
for i=1,number_of_days do--start of day repeat, do not edit
tlx=top_left_x_coordinate[i]--sets top left position for each repeat
tly=top_left_y_coordinate[i]--sets top left position for each repeat
--write day format below, write x and y relative to top left coordinates as in the example
--write i to call day as this will be replaced with the day number for each repeat

end--of day repeat, do not edit
--##############################################################
--############## end of weather display setup ##################
--##############################################################

end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function out(tx)
color=nil
color=tx.c
if color==nil then color=default_color end
alpha=nil
alpha=tx.a
if alpha==nil then alpha=default_alpha end
font=nil
font=tx.f
if font==nil then font=default_font end
fsize=nil
fsize=tx.fs
if fsize==nil then fsize=default_font_size end
xpos=nil
xpos=tx.x
if xpos==nil then xpos=0 end
ypos=nil
ypos=tx.y
if ypos==nil then ypos=0 end
text=nil
text=tx.txt
if text==nil then text="hello world" end
local function col(c)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,alpha
end--local function
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,col(color))
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--function out

function image(im)
x=nil
x=im.x
if x==nil then x=0 end
y=nil
y=im.y
if y==nil then y=0 end
w=nil
w=im.w
if w==nil then w=default_image_width end
h=nil
h=im.h
if h==nil then h=default_image_height end
file=nil
file=tostring(im.file)
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then 
width=imlib_image_get_width() 
else
width=tonumber(w)
end
if tonumber(h)==0 then 
height=imlib_image_get_height() 
else
height=tonumber(h)
end
local iacross=x+(width/2)
local idown=y+(height/2)
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(iacross, idown)
imlib_free_image()
show=nil
end--function image

function cw(t)
--set variables and defualts
if t.text==nil then text="" else text=t.text end
if t.font==nil then font="mono" else font=t.font end
if t.fsize==nil then fsize=12 else fsize=t.fsize end
if t.radius==nil then radius=50 else radius=t.radius end
if t.xpos==nil then xpos=100 else xpos=t.xpos end
if t.ypos==nil then ypos=100 else ypos=t.ypos end
if t.position==nil then position=1 else position=t.position end
if t.start==nil then start=270 else start=t.start end
if t.finish==nil then finish=90 else finish=t.finish end
if t.justify==nil then justify=1 else justify=t.justify end
if t.letterdeg==nil then letterdeg=5 else letterdeg=t.letterdeg end
--end variables
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,1,1,1,1);
if finish<start then finish=finish+360 end
local inum=string.len(text)
---------------------------
if position==1 then
deg=(finish-start)/(inum-1)
elseif position==2 then
deg=letterdeg
	if justify==1 then
	start=start	
	elseif justify==2 then
	start=start-((letterdeg*inum)/2)
	elseif justify==3 then 
	start=start-(letterdeg*inum)
	end
end
----------------------------
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radius*(math.sin(interval))
tys=0-radius*(math.cos(interval))
cairo_move_to (cr, txs+xpos, tys+ypos);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--circlewriting
function cwd(t)
--set variables and defualts
if t.text==nil then text="" else text=t.text end
if t.font==nil then font="mono" else font=t.font end
if t.fsize==nil then fsize=12 else fsize=t.fsize end
if t.radius==nil then radius=50 else radius=t.radius end
if t.xpos==nil then xpos=100 else xpos=t.xpos end
if t.ypos==nil then ypos=100 else ypos=t.ypos end
if t.position==nil then position=1 else position=t.position end
if t.start==nil then start=270 else start=t.start end
if t.finish==nil then finish=90 else finish=t.finish end
if t.justify==nil then justify=1 else justify=t.justify end
if t.letterdeg==nil then letterdeg=5 else letterdeg=t.letterdeg end
--end variables
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,1,1,1,1);
if start<finish then start=start+360 end
local inum=string.len(text)
---------------------------
if position==1 then
deg=(start-finish)/(inum-1)
elseif position==2 then
deg=letterdeg
	if justify==1 then
	start=start	
	elseif justify==2 then
	start=start+((letterdeg*inum)/2)
	elseif justify==3 then 
	start=start+(letterdeg*inum)
	end
end
----------------------------
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1<>")
texttable=string.split(textcut, "<>")
for i=1,inum do
interval=(degrads*(start-(deg*(i-1))))
txs=0+radius*(math.sin(interval))
tys=0-radius*(math.cos(interval))
cairo_move_to (cr, txs+xpos, tys+ypos);
cairo_rotate (cr, interval+(math.pi))
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -1*(interval+(math.pi)))
end
end--cwd 

function to_lines(line_text,max_string_len,indent)
---------------------------------------------
--set defaults for function
local default_max_length=50
local default indent=""
---------------------------------------------
if indent==nil then indent=default_indent end
if max_string_len==nil then max_string_len=default_max_length end
local i=1
text_table={line_text}
while text_table[i]~=nil do
if max_string==nil then max_string=max_string_len end
local v=text_table[i]
	if string.len(v)>max_string_len and string.find(v," ")~=nil and string.find(string.sub(v,1,max_string)," ")~=nil then
	long=string.len(v)
	splitcha=string.sub(v,max_string,max_string)	
		if splitcha~=" " then		
			while splitcha~=" " do
				if max_string>1 then
				max_string=max_string-1
				splitcha=string.sub(v,max_string,max_string)
				else
				splitcha=" "
				end
			end
		end
		local insertit=tostring(indent..string.sub(v,max_string+1,long))
		table.insert(text_table,i+1,insertit)
		text_table[i]=tostring(string.sub(v,1,max_string-1))	
	elseif string.len(v)>max_string_len and string.find(v," ")~=nil and string.find(string.sub(v,1,max_string)," ")==nil then
	long=string.len(v)
	splitcha=string.sub(v,max_string,max_string)		
		while splitcha~=" " do
			if max_string<long then
			max_string=max_string+1
			splitcha=string.sub(v,max_string,max_string)
			else
			splitcha=" "
			end
		end
		local insertit=tostring(indent..string.sub(v,max_string+1,long))
		table.insert(text_table,i+1,insertit)
		text_table[i]=tostring(string.sub(v,1,max_string-1))	
	end
i=i+1
max_string=max_string_len
end
return text_table
end--function  

conkyweathercircle:

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
#own_window_type override #override
#own_window_transparent yes
own_window_hints below,sticky,skip_taskbar,skip_pager
own_window_argb_visual no
#own_window_colour black
own_window_class Forecast Conky
own_window_title Forecast quadrants

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

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

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

minimum_size 550 700   ## width, height
maximum_width 550      ## width, usually a good idea to equal minimum width

gap_x 10        ### left &right
gap_y 10        ### up & down

alignment tl
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
# xftfont Anonymous Pro:bold:size=9
# xftfont Unispace:size=8
# xftfont Onuava:size=8
 #xftfont Inconsolata:bold:size=10
# xftfont Andale Mono:bold:size=9
xftfont caviar dreams:size=9


# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 0
# Force UTF8? requires XFT ###
override_utf8_locale yes

draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
default_shade_color grey
default_outline_color black

default_color DCDCDC #Gainsboro
color0 DAA520 #Goldenrod  FFFFF0 #Ivory
color1 778899 #LightSlateGrey
color2 FF8C00 #Darkorange
color3 7FFF00 #Chartreuse
color4 FFA07A #LightSalmon
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 00FFFF #Cyan 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 10
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################

# Boolean value, if true, Conky will be forked to background when started.
background no

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
lua_load ~/.conky/conky6/loadAll.lua
lua_draw_hook_pre main #starts the lua weather data gathering function, call once at top of conkyrc

#lua_load ~/.conky/conky6/thermometer3.lua
#lua_draw_hook_post quadrants
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
top_name_width 7


TEXT
#${lua conky_weather}

http://pix.toile-libre.org/upload/img/1366060943.png
Help apreciate thanx wink

Move all "require" parts from included script to the main script.
It might or might not make the problems - didn't tested it, but include 'cairo' library twice might pose a problem for interpreter.

Secondly, you run both script with Conky start, and then you run one of them below TEXT. ???

3rd, you need to make sure, that no global variables/table overlap in every included scripts, because they overwrite each other.
If you'd include scripts as modules, then you don't need to worry about variables, because each included module run in separate sandbox with private functions (it changes it's names dynamically) and every variables are local to it's module.


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

Offline

#5137 2013-04-19 13:02:04

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: The New Monster Conky Thread

lionhead wrote:

hello
the script works but it shows the error-message only three times (maybe after function gets the necessary datas?).

that was an important detail smile
if you simply not want to see the errors do this

local inum=(((width-lw)/100)*(conum or 0))

if conum is nil then the or command uses 0 in the calculation instead

Last edited by mrpeachy (2013-04-19 13:02:34)

Offline

#5138 2013-04-19 13:39:20

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

Re: The New Monster Conky Thread

thanks, it works. the terminal output looks much better  now wink

@mrpeachy

is there a chance to see new eye-candy in near future?

Offline

#5139 2013-04-19 22:11:54

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: The New Monster Conky Thread

lionhead wrote:

@mrpeachy

is there a chance to see new eye-candy in near future?

no, maybe distant future but not near

Offline

#5140 2013-04-20 13:05:50

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

Re: The New Monster Conky Thread

a glimmer of hope smile

Offline

#5141 2013-04-22 11:33:31

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

@dk75
Hello and thanks for help.
I'm a begginner in lua and not so good in English... I probably not good understanding by :

dk75 wrote:

Move all "require" parts from included script to the main script.
It might or might not make the problems - didn't tested it, but include 'cairo' library twice might pose a problem for interpreter.
Secondly, you run both script with Conky start, and then you run one of them below TEXT. ???

Then in the loadAll.lua I did it and commented  --require 'cairo' in the others:

package.path = "/home/climatix/.conky/conky6/?.lua"
require 'weathercircle' --for scriptA.lua ".lua" is not required here
require 'thermometer3'
require 'cairo'
require 'imlib2'

function conky_main()
     conky_weather()
     conky_quadrants()
end

It doesn't work
I don't run below text it's commented, it was just for made tests

Last edited by ragamatrix (2013-04-22 11:45:00)

Offline

#5142 2013-04-22 15:48:56

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

Re: The New Monster Conky Thread

i have a little problem with my script: http://ompldr.org/vaTZucg
in some cases an extra space appears between the number and the letters (see photo).

-- #####################################################################
-- ## parse conky-variables ############################################
-- #####################################################################

function parse(value)
	local ms=nil
	---- short_units no ------------------------------------------------
	if ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		ms=(value:gsub("B",""))..' byte'	
	elseif string.find(value, 'KiB') ~= nil then
		ms=(value:gsub("KiB",""))..' kb'
	elseif string.find(value, 'MiB') ~= nil then
		ms=(value:gsub("MiB","")).." mb"
	elseif string.find(value, 'GiB') ~= nil then
		ms=(value:gsub("GiB","")).." gb"
	elseif string.find(value, "TiB") ~= nil then
		ms=(value:gsub("TiB","")).." tb"	
	---- short_units yes -----------------------------------------------
	elseif ((string.find(value, "iB") == nil) and (string.find(value, "B") ~= nil)) then
		ms=(value:gsub("B",""))..' byte'
	elseif string.find(value, "K") ~= nil then
		ms=(value:gsub("K",""))..' kb'
	elseif string.find(value, "M") ~= nil then
		ms=(value:gsub("M",""))..' mb'
	elseif string.find(value, "G") ~= nil then
		ms=(value:gsub("G",""))..' gb'
	elseif string.find(value, "T") ~= nil then
		ms=(value:gsub("T",""))..' tb'
	else
		ms=value:gsub(" ","")
	end
	--------------------------------------------------------------------
	return ms
end -- of function


function system(cd) ----------------------------------------------------

local conky_order=nil
local variable=nil
local device=nil
local del=nil
local cs = nil
local ms = nil
local tf = nil

variable=cd.variable
device=(cd.device or '')
del=(cd.del or '.')
tf=(cd.tf or '24')

conky_order=conky_parse("${"..variable..' '..device.."}")
adv=parse(conky_order)

	if string.find(variable,"cpu") ~= nil then -------------------------
		ms=conky_order.." %"
	elseif string.find(variable,"uptime") ~= nil or string.find(variable,"user_number") ~= nil then
		ms=conky_order
	elseif ((string.find(variable, "perc") ~= nil) or (string.find(variable, "percent") ~= nil)) then
		ms=conky_order.." %"
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") == nil)) then
		ms=adv.." mhz"
	elseif ((string.find(variable,"freq") ~= nil) and (string.find(variable,"_g") ~= nil)) then
		ms=adv.." ghz"
	--------------------------------------------------------------------
	elseif string.find(variable,"addr") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_bitrate") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_essid") ~= nil or string.find(variable,"wireless_mode") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..conky_order.."${else}offline${endif}")
	elseif string.find(variable,"wireless_link_qual") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.." %".."${else}offline${endif}")
	elseif string.find(variable,"upspeedf") ~= nil or string.find(variable,"downspeedf") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.." kb/s".."${else}offline${endif}")
	--------------------------------------------------------------------
	elseif string.find(variable,"battery") ~= nil then
		ms=conky_order
	elseif string.find(variable,"up") == nil and string.find(variable,"time") ~= nil then
		if tf == "24" then ---------------------------------------------
		ms=adv..' uhr'
		elseif tf == "12" then
		ms=convert12(conky_order,tf) end -------------------------------
	elseif string.find(variable,"nodename") ~= nil or string.find(variable,"running_processes") ~= nil then
		ms=adv
	elseif string.find(variable,"processes") ~= nil or string.find(variable,"fs_type") ~= nil then
		ms=adv
	elseif string.find(variable,"conky_version") ~= nil or string.find(variable,"machine") ~= nil then
		ms=adv
	else
	--------------------------------------------------------------------
		if string.find(device,"wlan") ~= nil or string.find(device,"eth") ~= nil then
		ms=conky_parse("${if_up "..device.."}"..adv.."${else}offline${endif}")
		elseif string.find(device,"media") ~= nil then
		ms=conky_parse("${if_mounted "..device.."}"..add_decimal(adv,del).."${else}not plugged in${endif}")
		else ms=adv end 
	--------------------------------------------------------------------
	end

	cs=string.gsub(tostring(ms),"%.",del) -- replace delimiter
	return cs
end -- of function

-- #####################################################################
-- ## add decimal place ####################################################
-- #####################################################################

function add_decimal(input,sign)

if string.find(input,"%a")==nil then
        if string.find(input,"%p")==nil then        
        input=input..sign..'0'
        end
end

return input
end

do u see some wrong code? i do not have an idea why this happens?! please help me.

edit: it seems that this error only occurs when the number is an integer.

Last edited by lionhead (2013-04-22 15:54:10)

Offline

#5143 2013-04-22 20:40:27

rabidfox
#! CrunchBanger
Registered: 2010-09-22
Posts: 116

Re: The New Monster Conky Thread

Hello all, especially old friends MrPeachy and Sector11!

I have a new conky idea.  You may have noticed a Final Fantasy VII theme in my conkies (no. 1, no. 2, no. 3) and this funny firefox setup.

I have my shiny new laptop and want to write a conky that will have this background, like in my first conky, but have the functionality you might expect:

final_Conky.jpg

I have been happily using ADeskBar to make materia function to launch programs on Final Conky II like this:
http://i998.photobucket.com/albums/af105/rabidredfox/Crunchbang/summons.png

But now I'd like to make it so that "New Game" and "Continue" function like buttons, and you can continue a previous session (configuration of programs you had open last time) or start a new session, which I guess would just change the background (probably using feh).  Now, how do you think I could do that?  Especially making the finger toggle, and even make that sound it makes!


Moderator Edit - Image Resize
----------------------------------------------------------------------------------------------------------------------------
Please use thumbnails (please try to avoid the large thumbnail imgur.com code) linking to the larger image to help those of us with slow connections. An example of the code needed is below. Most image hosting sites will automatically generate this for you as well. Users have been using postimage.org lately which does a nice job.

[url=http://link.to.your.fullsized.image][img]http://link.to.your.thumbnail.image[/img][/url]

...But I'm ever so squeezable!

Offline

#5144 2013-04-22 23:53:52

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 12,022
Website

Re: The New Monster Conky Thread

@ rabidfox

Hi rabidfox - long time no see.

You might find and answer to the button problem in the » interactive conky LUA thread.

And with nitrogen looking after your backgrounds you don't need feh to change them, a bash script with:

nitrogen --set-auto /path/to/wallpaper.png

see the bash file by stinkeye - it's for gnome but I modified it for nitrogen with the line above.

Still using a FF theme I see ... love it...


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy | IcyBlack | LinuxBBQ

Offline

#5145 2013-04-23 08:24:16

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

@dk75
Hello,
Do you think it's possible to call weather icons in the quadrant script ?
I didn't find the way to do it.

Offline

#5146 2013-04-23 13:10:44

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

Just few things able to modify on this really beautifull script from Mr Peachy.thermo
bigger

Last edited by ragamatrix (2013-04-23 13:13:11)

Offline

#5147 2013-04-23 13:25:26

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 12,022
Website

Re: The New Monster Conky Thread

ragamatrix wrote:

Just few things able to modify on this really beautifull script from Mr Peachy.http://s17.postimg.org/ttlawxktn/quadrants_thermo.jpg
bigger

WELL DONE!  Most impressive.


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy | IcyBlack | LinuxBBQ

Offline

#5148 2013-04-23 13:53:30

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

@Sector11
Thanks; do you think it's possible to add the forecast of the next 3 hours; but it doesn't work with v9000 ?

Offline

#5149 2013-04-23 14:05:41

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 12,022
Website

Re: The New Monster Conky Thread

ragamatrix wrote:

@Sector11
Thanks; do you think it's possible to add the forecast of the next 3 hours; but it doesn't work with v9000 ?

You are asking the wrong person.  I only use LUA scripts and tweak them a little.  Sorry.


To #! or not to #!?  That is the question! | #! Forum Moderator
#! Conky = 16 Threads & the Conky Archives | Conky PitStop | OTHCG'er
StartPage -  protect your privacy | IcyBlack | LinuxBBQ

Offline

Be excellent to each other!

#5150 2013-04-23 14:13:09

ragamatrix
#! CrunchBanger
From: Horgen Switzerland
Registered: 2012-12-05
Posts: 235

Re: The New Monster Conky Thread

Sector11 wrote:
ragamatrix wrote:

@Sector11
Thanks; do you think it's possible to add the forecast of the next 3 hours; but it doesn't work with v9000 ?

You are asking the wrong person.  I only use LUA scripts and tweak them a little.  Sorry.

Well like me so big_smile I'm frozen

Offline

Board footer

Powered by FluxBB

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

Debian Logo