You are not logged in.
with some modification to my weather script, you can now call data directly from the conkyrc
conkyrc
lua_load ~/lua/forecast.lua
lua_draw_hook_pre weatherdata#starts the lua weather data gathering function, call once at top of conkyrc
TEXT
Current
Conditions: ${lua weather now.con}
Humidity: ${lua weather now.hum} %
${lua weather day1.day}
Conditions: ${lua weather day1.con}
High: ${lua weather day1.hih} F
Low: ${lua weather day1.low} F
${lua weather day2.day}
Conditions: ${lua weather day2.con}
High: ${lua weather day2.hih}
Low: ${lua weather day2.low}
${lua weather day3.day}
Conditions: ${lua weather day3.con}
High: ${lua weather day3.hih}
Low: ${lua weather day3.low}
${lua weather day4.day}
Conditions: ${lua weather day4.con}
High: ${lua weather day4.hih}
Low: ${lua weather day4.low}
${lua weather day5.day}
Conditions: ${lua weather day5.con}
High: ${lua weather day5.hih}
Low: ${lua weather day5.low}
${lua weather day10.day}
Conditions: ${lua weather day10.con}
High: ${lua weather day10.hih}
Low: ${lua weather day10.low}
CPU: ${cpu}it gives you current info with these options
--current info.. use now.option
--options
con=conditions summary
tmp=temperature
flk=Feels Like
wch=wind chill
cel=ceiling
hid=heat index
vis=visibility
dpt=dew point
wsp=wind speed (in mph)
wdg=wind direction in degrees
wdi=wind direction NSEW
wgs=wind gusts
hum=humidity
prs=pressure
and forecast info 10 days with these options
--options used dayX.option, where X is 1 to 10 , 1 is todays forcast
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
the lua script can be found here
http://crunchbanglinux.org/pastebin/1303
you have to killall conky and restart when you make changes in the conkyrc
no weather images or weather font output as yet
Last edited by mrpeachy (2011-11-15 18:11:01)
Offline
does anyone know what weather conditions = what character in the weather font?
Offline
Conky one line status bar with room for systray on 1200 netbook screen.
background yes
use_xft yes
xftfont Ubuntu:size=11
xftalpha 1.0
update_interval 1
total_run_times 0
### Window
own_window yes
own_window_colour 272c30
# own_window_type normal
own_window_type desktop
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_hints undecorated,sticky,skip_taskbar,skip_pager
###
double_buffer yes
minimum_size 1200 2
maximum_width 1200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
border_width 1
border_inner_margin 0
border_outer_margin 0
# colors
color1 eee8d5
color2 dd1155
color3 960c3a
color4 4b6983
#alignment top_left
alignment top_middle
gap_x 0
gap_y 0
max_specials 1024
max_user_text 2048
text_buffer_size 2048
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer right
short_units yes
pad_percents 1
imlib_cache_size 0
TEXT
${color2}${time %l:%M %p} ${color3} ${time %A, %B %e, %Y} ${color4} $desktop_name/$desktop_number ${color1} up: $uptime_short | cpu: $cpu% | ram: $memperc% | swap: $swapperc% | vol: $mixer% ${color4}$machine | $sysname | $kernelEDIT: changed the text a bit.
Last edited by dmhdlr (2011-11-16 00:26:59)
Offline
forecast.lua (requires editing of settings at the top)
http://ompldr.org/vYmFzag
you shouldnt have to kill and restart every time you make a change and save the conkyrc
the bits of conkyrc that give me the above output
lua_load ~/lua/forecast.lua
lua_draw_hook_pre weatherdata#starts the lua weather data gathering function, call once at top of conkyrc
TEXT
Current Conditions
Conditions: ${lua weather now.con}
Humidity: ${lua weather now.hum} %
${lua_parse weather image.now 80 0 50 50}
${lua weather day1.day}
Conditions: ${lua weather day1.con}
High: ${lua weather day1.hih} F
Low: ${lua weather day1.low} F
${lua_parse weather image.day1 80 130 50 50}
${lua weather day2.day}
Conditions: ${lua weather day2.con}
High: ${lua weather day2.hih}
Low: ${lua weather day2.low}
${lua_parse weather image.day2 80 210 50 50}
${lua weather day3.day}
Conditions: ${lua weather day3.con}
High: ${lua weather day3.hih}
Low: ${lua weather day3.low}
${lua_parse weather image.day3 80 290 50 50}
${lua weather day4.day}
Conditions: ${lua weather day4.con}
High: ${lua weather day4.hih}
Low: ${lua weather day4.low}
${lua_parse weather image.day4 80 370 50 50}
${lua weather day5.day}
Conditions: ${lua weather day5.con}
High: ${lua weather day5.hih}
Low: ${lua weather day5.low}
${lua_parse weather image.day5 80 450 50 50}
CPU: ${cpu}let me know when it breaks! 
Last edited by mrpeachy (2011-11-16 03:03:01)
Offline
weather with images
let me know when it breaks!
Line 380
I am still working on the icons. Before Weather.com charged, intellicast.com was the fee-based TWC feed and they set robots.txt to block parsing images/
I wonder if this is related... let me copy some icons in weathericons and try again.
Congratulations, you've figured out the sound of one hand clapping...
Offline
mrpeachy wrote:weather with images
let me know when it breaks!Line 380
I am still working on the icons. Before Weather.com charged, intellicast.com was the fee-based TWC feed and they set robots.txt to block parsing images/
I wonder if this is related... let me copy some icons in weathericons and try again.
2 problems with line 380
i put in a variable called daynight which seemed like a good idea at the time, but now i realise it wont work without further modifications so delete "..daynight" from line 380
here
(string.gsub(now.con,"[ %.%/]","")..daynight))())becomes
(string.gsub(now.con,"[ %.%/]","")))())you can delete the corresponding brackets too, but that isnt necessary
the other problem is that intellicast uses a lot of varied terms in its conditions summaries
many more than were found in the conkyforecast.py script
so im on the hunt for rogue conditions
Overcast needs to be added to the table wimage, starting on line 311
i put it under Cloudy and gave it the same icon (line 343)
Cloudy=26,
Overcast=26,
MostlyCloudyn=27, -- nightEDIT
i modified the wimage table so that each type of weather has a day version and a night version
and reimplemented a better version of the daynight icon switcher
updated lua script here
http://crunchbanglinux.org/pastebin/1305
if you want to maintain your own table if you come across a new weather type, then enter it twice
like so
(no spaces or periods and i believe you need to be case sensitive
also the script shortens Thunderstorm to T.Storm which would be TStorm in the table)
type=XX,
typen=XX,and let me know what types and which icons you assigned them if you do 
Last edited by mrpeachy (2011-11-16 07:17:24)
Offline
mrpeachy, I prefer to continue here on The Dark Side if you will.
The omploder tool is more handy and not as many distractions from questions.
I did PM you my iconset and zip file for all the intellicast icons I could wget.
Congratulations, you've figured out the sound of one hand clapping...
Offline
ive started a thread re my weather script for conky
if anyone tries the scripts and runs into problems or can help me identify intellicast weather types 
i think im going to stick with translating weather types to icons
http://crunchbanglinux.org/forums/topic … -in-conky/
Last edited by mrpeachy (2011-11-16 18:02:03)
Offline
I continue to be in absolute amazment mrpeachy at what you are able to cook up. I'm still quite a way (ok, a long way) from getting some of these more elaborate conkys. This is the finished product of what I have been doing with my laptop. (ok, let's be honest....Configuring is NEVER finished
)The info conky I pretty much wrote from scratch. It's a basic set up, nothing you have not seen on a bunch of different conkys. The weather is from Teo's accuweather script as well as another script from the Arch Linux board that shows the current condition and temp. The date on the bottom right of course I got from Sector11. All I have pretty much done with the weather conky is mess with the fonts and colors to make everything match plus added additional code to the conkyrc to give me the 5th day of weather. The Arch Linux Logo in the center is actually a conky calling to one letter from the OpenLogos font. Tint2 changed up also with the red border to match everything else. Starting to get involved in the OpenBox menu.xml. I have read that it is highly configurable. Need to figure out how to make it Red and White as well. I started a thread in the WM/DE talk forum about how others have configured their menus but it has yet to take off. OpenBox menu thread
All the best everyone and enjoy your weekend!!
Ian
Offline
Sector 11 has this in his latest conky
# killall conky && conky -c ~/Conky/Forecast_v5.conky &
# To use #! in a conky use: ${exec echo '#!'}
I have #! Statler on the G60 and need to know how this is used with #!
Congratulations, you've figured out the sound of one hand clapping...
Offline
Sector 11 has this in his latest conky
# killall conky && conky -c ~/Conky/Forecast_v5.conky &
# To use #! in a conky use: ${exec echo '#!'}I have #! Statler on the G60 and need to know how this is used with #!
Use what?
killall works the same..
the second line is how to use the characters #! in a conky
VSIDO
If you build it, they will come...
Words That Build Or Destroy
Offline
the second line is how to use the characters #! in a conky
Thanks VastOne
Congratulations, you've figured out the sound of one hand clapping...
Offline
Offline
source please... the rc and any supporting files I mean..
great work!
VSIDO
If you build it, they will come...
Words That Build Or Destroy
Offline
##LUA LOAD##
lua_load ~/lua/background.lua
lua_draw_hook_pre main
##LUA LOAD##
lua_load ~/lua/wlourf.lua
lua_draw_hook_pre main_rings
#${lua conky_draw_bg Curvatura spigoli DX Su/Giù Atl Largh colore Trasparenza}
## conky -c .conkyrc_wlourf
TEXT
${font Ambitsek:size=9}${voffset -4}${alignc}${time %a, %e, %b %Y}
${execpi 1800 conkyForecast --location=ITXX0082 --template=/home/deegan/lua/varese.template}
${voffset 58}${lua conky_draw_bg 20 0 0 200 200 0x000000 0.3}
${voffset -11} ${execi 3600 conkyForecast -d HT -u -x}°C
${font Ambitsek:size=6} Besozzo
${font ZeKton:size=7:style=bold}${voffset 3}${alignc}${execi 1800 conkyForecast --datatype=CT}--[[ RINGS with SECTORS widget
v1.1 by wlourf (07 Jan. 2011)
this widget draws a ring with differents effects
http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html
To call the script in a conky, use, before TEXT
lua_load /path/to/the/script/rings.lua
lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT
Parameters are :
3 parameters are mandatory
name - the name of the conky variable to display,
for example for {$cpu cpu0}, just write name="cpu"
arg - the argument of the above variable,
for example for {$cpu cpu0}, just write arg="cpu0"
arg can be a numerical value if name=""
max - the maximum value the above variable can reach,
for example for {$cpu cpu0}, just write max=100
Optional parameters:
xc,yc - coordinates of the center of the ring,
default = middle of the conky window
radius - external radius of the ring, in pixels,
default = quarter of the width of the conky window
thickness - thickness of the ring, in pixels, default = 10 pixels
start_angle - starting angle of the ring, in degrees, value can be negative,
default = 0 degree
end_angle - ending angle of the ring, in degrees,
value must be greater than start_angle, default = 360 degrees
sectors - number of sectors in the ring, default = 10
gap_sectors - gap between two sectors, in pixels, default = 1 pixel
cap - the way to close a sector, available values are
"p" for parallel , default value
"r" for radial (follow the radius)
inverse_arc - if set to true, arc will be anticlockwise, default=false
border_size - size of the border, in pixels, default = 0 pixel i.e. no border
fill_sector - if set to true, each sector will be completely filled,
default=false, this parameter is inoperate if sectors=1
background - if set to false, background will not be drawn, default=true
foreground - if set to false, foreground will not be drawn, default=true
Colours tables below are defined into braces :
{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
example for a single colour table :
{{0,0xFFAA00,1}} position parameter doesn't matter
example for a two-colours table :
{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
example for a three-colours table :
{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}
bg_colour1 - colour table for background,
default = {{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
fg_colour1 - colour table for foreground,
default = {{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
bd_colour1 - colour table for border,
default = {{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
Seconds tables for radials gradients :
bg_colour2 - second colour table for background, default = no second colour
fg_colour2 - second colour table for foreground, default = no second colour
bd_colour2 - second colour table for border, default = no second colour
draw_me - if set to false, text is not drawn (default = true or 1)
it can be used with a conky string, if the string returns 1, the text is drawn :
example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
v1.0 (08 Aug. 2010) original release
v1.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
text is parsed inside the function, not in the array of settings
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation version 3 (GPLv3)
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301, USA.
]]
require 'cairo'
function conky_main_rings()
-- START PARAMETERS HERE
local rings_settings={
---- CERCHIO PICCOLO
{
name="cpu",
arg="",
max=60,
xc=113,
yc=100,
thickness=10,
radius=50,
sectors=10,
start_angle=120,
end_angle=405,
bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
fg_colour1={{0,0xFFFF00,0.1},{0.5,0xFFFF00,1.0}},
fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0}},
},
---- CERCHIO GRANDE
{
name="exec conkyBanshee --datatype=PP",
arg="",
max=60,
xc=113,
yc=100,
thickness=10,
radius=70,
sectors=10,
start_angle=120,
end_angle=405,
bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
fg_colour1={{0,0xFFFF00,0.1},{0.5,0xFFFF00,1.0}},
fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0}},
},
---- PETTINE
{
name="downspeedf",
arg="wlan0",
max=60,
xc=113,
yc=100,
thickness=16,
radius=80,
sectors=60,
gap_sectors=3,
start_angle=120,
end_angle=405,
bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
fg_colour1={{0,0xFFFF00,1.0},{1,0xFFFF00,0.1}},
fg_colour2={{0,0xFF0000,1.0},{1,0xFF0000,0.1}},
},
---- SPICCHIO
{
name="memperc",
arg="",
max=60,
xc=113,
yc=100,
thickness=19,
radius=65,
sectors=9,
start_angle=120,
end_angle=405,
fg_colour1={{0.49,0xFFFFFF,0.1},{0.5,0xFFFFFF,.4},{0.51,0x00FFFF,0.1}},
fg_colour2={{0,0xFF0000,0},{0.5,0xff0000,1},{1,0xFF0000,0}},
bg_colour1={{0.49,0xffFFFF,0},{0.5,0xffffff,1},{0.51,0xffFFFF,0}},
bg_colour2={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},
},
-------------------------------------------
}
--END OF PARAMETERS HERE
--main function
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)
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(rings_settings) do
draw_ring(cr,rings_settings[i])
end
end
cairo_destroy(cr)
end
function draw_ring(cr, t)
local function rgba_to_r_g_b_a(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255.,
((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
local function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1
for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors
end
end
return tcol1
end
--check values
local function setup(t)
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name'" +
" with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
print ("for name=" .. t.name)
print ("with arg=" .. t.arg)
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end
if t.xc==nil then t.xc=conky_window.width/2 end
if t.yc==nil then t.yc=conky_window.height/2 end
if t.thickness ==nil then t.thickness = 10 end
if t.radius ==nil then t.radius =conky_window.width/4 end
if t.start_angle==nil then t.start_angle =0 end
if t.end_angle==nil then t.end_angle=360 end
if t.bg_colour1==nil then
t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
end
if t.fg_colour1==nil then
t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
end
if t.bd_colour1==nil then
t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
end
if t.sectors==nil then t.sectors=10 end
if t.gap_sectors==nil then t.gap_sectors=1 end
if t.fill_sector==nil then t.fill_sector=false end
if t.sectors==1 then t.fill_sector=false end
if t.border_size==nil then t.border_size=0 end
if t.cap==nil then t.cap="p" end
--some checks
if t.thickness>t.radius then t.thickness=t.radius*0.1 end
t.int_radius = t.radius-t.thickness
--check colors tables
for i=1, #t.bg_colour1 do
if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
end
for i=1, #t.fg_colour1 do
if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
end
for i=1, #t.bd_colour1 do
if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
end
if t.bg_colour2~=nil then
for i=1, #t.bg_colour2 do
if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
end
end
if t.fg_colour2~=nil then
for i=1, #t.fg_colour2 do
if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
end
end
if t.bd_colour2~=nil then
for i=1, #t.bd_colour2 do
if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
end
end
if t.start_angle>=t.end_angle then
local tmp_angle=t.end_angle
t.end_angle= t.start_angle
t.start_angle = tmp_angle
-- print ("inversed angles")
if t.end_angle-t.start_angle>360 and t.start_angle>0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end
if t.int_radius<0 then t.int_radius =0 end
if t.int_radius>t.radius then
local tmp_radius=t.radius
t.radius=t.int_radius
t.int_radius=tmp_radius
print ("inversed radius")
end
if t.int_radius==t.radius then
t.int_radius=0
print ("int radius set to 0")
end
end
t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
end
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
--initialize table
setup(t)
--initialize cairo context
cairo_save(cr)
cairo_translate(cr,t.xc,t.yc)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
--get value
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
--initialize sectors
--angle of a sector :
local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
--value of a sector :
local valueA = t.max/t.sectors
--first angle of a sector :
local lastAngle = t.start_angle*math.pi/180
local function draw_sector(type_arc,angle0,angle,valpc, idx)
--this function draws a portion of arc
--type of arc, angle0 = strating angle, angle= angle of sector,
--valpc = percentage inside the sector, idx = sctor number #
local tcolor
if type_arc=="bg" then --background
if valpc==1 then return end
tcolor=t.bg_colour1
elseif type_arc=="fg" then --foreground
if valpc==0 then return end
tcolor=t.fg_colour1
elseif type_arc=="bd" then --border
tcolor=t.bd_colour1
end
--angles equivalents to gap_sector
local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))
--angles of arcs
local ext_angle=(angle-ext_delta*2)*valpc
local int_angle=(angle-int_delta*2)*valpc
--define colours to use for this sector
if #tcolor==1 then
--plain color
local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
vG+tcolor[1].dG*idx,
vB+tcolor[1].dB*idx,
vA+tcolor[1].dA*idx )
else
--radient color
local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
for i=1, #tcolor do
local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
cairo_pattern_add_color_stop_rgba (pat,
vP+tcolor[i].dP*idx,
vR+tcolor[i].dR*idx,
vG+tcolor[i].dG*idx,
vB+tcolor[i].dB*idx,
vA+tcolor[i].dA*idx )
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
--start drawing
cairo_save(cr)
--x axis is parrallel to start of sector
cairo_rotate(cr,angle0-math.pi/2)
local ri,re = t.int_radius ,t.radius
--point A
local angle_a
if t.cap == "p" then
angle_a = int_delta
if t.inverse_arc and type_arc ~="bg" then
angle_a = angle-int_angle-int_delta
end
if not(t.inverse_arc) and type_arc =="bg" then
angle_a = int_delta+int_angle
end
else --t.cap=="r"
angle_a = ext_delta
if t.inverse_arc and type_arc~="bg" then
angle_a = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_a = ext_delta+ext_angle
end
end
local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)
--point B
local angle_b = ext_delta
if t.cap == "p" then
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
else
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
end
local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)
-- EXTERNAL ARC B --> C
local b0,b1
if t.inverse_arc then
if type_arc=="bg" then
b0,b1= ext_delta, angle-ext_delta-ext_angle
else
b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
end
else
if type_arc=="bg" then
b0,b1= ext_delta+ext_angle, angle-ext_delta
else
b0,b1= ext_delta, ext_angle+ext_delta
end
end
---POINT D
local angle_c, angle_d
if t.cap == "p" then
angle_d = angle-int_delta
if t.inverse_arc and type_arc=="bg" then
angle_d = angle-int_delta-int_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d=int_delta+int_angle
end
else
angle_d = angle-ext_delta
if t.inverse_arc and type_arc=="bg" then
angle_d =angle-ext_delta-ext_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d = ext_angle+ext_delta
end
end
local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
-- INTERNAL ARC D --> A
local d0,d1
if t.cap=="p" then
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-int_delta-int_angle,int_delta
else
d0,d1= angle-int_delta, angle- int_angle-int_delta
end
else
if type_arc=="bg" then
d0,d1= angle-int_delta, int_delta+int_angle
else
d0,d1= int_delta+int_angle, int_delta
end
end
else
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-ext_delta-ext_angle,ext_delta
else
d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
end
else
if type_arc=="bg" then
d0,d1= angle-ext_delta,ext_delta+ext_angle
else
d0,d1= ext_angle+ext_delta, ext_delta
end
end
end
--draw sector
cairo_move_to(cr,ax,ay)
cairo_line_to(cr,bx,by)
cairo_arc(cr,0,0,re,b0,b1)
cairo_line_to(cr,dx,dy)
cairo_arc_negative(cr,0,0,ri,d0,d1)
cairo_close_path (cr);
--stroke or fill sector
if type_arc=="bd" then
cairo_set_line_width(cr,t.border_size)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end
--draw sectors
local n0,n1,n2 = 1,t.sectors,1
if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
local index = 0
for i = n0,n1,n2 do
index = index +1
local valueZ=1
local cstA, cstB = (i-1),i
if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
if value>valueA *cstA and value<valueA*cstB then
if not t.fill_sector then
valueZ = (value-valueA*cstA)/valueA
end
else
if value<valueA*cstB then valueZ=0 end
end
local start_angle= lastAngle+(i-1)*angleA
if t.foreground ~= false then
draw_sector("fg",start_angle,angleA,valueZ, index)
end
if t.background ~= false then
draw_sector("bg",start_angle,angleA,valueZ, i)
end
if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
end
cairo_restore(cr)
end
--[[END OF RING-SECTORS WIDGET]]Offline
Offline
Beautiful, Deegan, welcome to Crunchbang old friend.
Bella, Deegan, Benvenuti al Crunchbang vecchio amico.
#! Etiquette | Conky PitStop | VSIDO | Interactive LUA
Weather v9000 | Teo x4 Sites | Arclance | Finnish
Offline
i claim this as the largest and most processor intensive conky/lua clock ever!
one whole day counted in 86400 individual seconds
require 'cairo'
function dotchart(conr,cong,conb,cona,cbgr,cbgr,cbgb,cbga,trx,try,size,gap,num)
cairo_set_line_width (cr,1)
for i=0,215 do
n=i
for i=1,400 do
if (n*400)+i<=num then
cairo_set_source_rgba (cr,conr,cong,conb,cona)
else
cairo_set_source_rgba (cr,cbgr,cbgr,cbgb,cbga)
end
cairo_move_to (cr,trx+((rad+(rad+gap))*i),try+((rad+(rad+gap))*n))--,rad,0,math.pi*2)
cairo_rel_line_to (cr,size,0)
cairo_stroke (cr)
end
end
end--function
function conky_draw_fig()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--settings
--indicator dot color
conr,cong,conb,cona=1,0,0,1
--background dot color
cbgr,cbgr,cbgb,cbga=1,1,1,1
--top right corner coordinates
trx=1
try=10
-------------------
size=1
--gap between dots
gap=0
--variable
num=((os.date("%S"))+(os.date("%M")*(60))+(os.date("%H")*(60*60)))
--call function
dotchart(conr,cong,conb,cona,cbgr,cbgr,cbgb,cbga,trx,try,size,gap,num)
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main functionconkyrc
lua_load ~/lua/dotclock.lua
lua_draw_hook_pre draw_fig
TEXT
${cpu}Offline
@ VastOne
Go on box look and go to the fluxbox section you'll see my setup, would post link but I'm on a mobile device.
"'If fighting is to result in victory, then you must fight'...Sun Tzu said that and id say he knows a little more about fighting then you do pal."
- TF2 Soldier
Offline
86400 is a magic number, I have some conkys that use that as it's
upate_intervalIn fact I was just working on one, my remind calendar. After all, a calendar only updates on a daily basis. It's in a window so I close it when I have see my reminders for the date
Gotta look at that code though, thanks for that.
#! Etiquette | Conky PitStop | VSIDO | Interactive LUA
Weather v9000 | Teo x4 Sites | Arclance | Finnish
Offline
My first screenshot for any type of Linux. I tried to make it techy. You're seeing moc, TRON Legacy, htop, conky and another terminal doing an update.

Offline
My first screenshot for any type of Linux. I tried to make it techy. You're seeing moc, TRON Legacy, htop, conky and another terminal doing an update.
Very nice - Welcome to #!
Looking good!
I like that, listening to music and reading the subtitles in Tron.
#! Etiquette | Conky PitStop | VSIDO | Interactive LUA
Weather v9000 | Teo x4 Sites | Arclance | Finnish
Offline
Is anyone else having problems with accuweather..I can't get anything but current conditions....
Give a man a truth and he will think for a day.
Teach a man to reason and he will think for a lifetime!
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.