You are not logged in.
jed wrote:OK, so I finally did it!!! This is my version of the VSIDO default horizontal Conky. I've added some stuff, got rid of some more stuff, added some weather, and conkyEmail. The weather is courtesy of Teo's hard work and fantastic weather scripts!!! Thanks also to Sector11 for the original idea...
Compare the RAM usage between the two scrots! Over 20 hours of uptime, Iceweasel open in the top one then closed in the bottom one. Amazing!!!
Thank my small monitor otherwise the two/three line adaptation of the VSIDO default conky would never have been created.
My memory usage is similar ... the top is running nothing other than 8 conkys and the bottom I've added claws-mail and iceweasel to the list. I'm happy with the results. My uptime is less though .... still the differences are there.
http://t.imgbox.com/abiZJjED.jpg ---> 262MB vs 463MB - I'm happy.
your wallpaper shows the gate from the movie 'stargate universe'. very nice! do u use v9000? could u please post your code?
Offline
your wallpaper shows the gate from the movie 'stargate universe'. very nice! do u use v9000? could u please post your code?
No, they are not V9000, these conkys, both Jed's and mine are showing TeoBugusGeekus weather scripts in action.
I have the V9000 script in other conkys.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
i'm looking for horizontal forecast (written in lua, v9000).
Offline
@Jed and Sector11,
Very nice horizontal setup! Will either of you do a htop or Taskmanager and let me know how much memory that conky uses?
I am thinking of using it to replace a plugin I use on Iceweasel that does the same thing
I appreiciate it
Offline
i'm looking for horizontal forecast (written in lua, v9000).
I have a horizontal weather script written in Lua. It's not v9000 though.
Offline
does anyone of you have the sourcecode of this:
http://i.imgur.com/4aDwI.png
i'm also looking for a horizontal setup of v9000.
@arclance
do u have the code of the animated radar and satellite maps that you are using?
Offline
does anyone of you have the sourcecode of this:
@arclancedo u have the code of the animated radar and satellite maps that you are using?
Yes that's the weather script I wrote so I have the code.
You can download it here.
I can separate out the radar and satellite code from the rest of it after work if you can't find it in there.
Offline
does anyone of you have the sourcecode of this:
http://i.imgur.com/4aDwI.png
That was made quite some time ago, in fact now that I think about it, it was pre v9000. I was using conkyforecast for the weather part
I have been asked about this setup a few times but for some reason or other I don't have/cant find the code.
Maybe I should re-make it some time
looking at the pic, may 2011... maybe it was v9000 after all
Last edited by mrpeachy (2013-01-08 15:03:57)
Offline
i want to buy a telescope (for astrophotography) and would like to make photos for example of the iss. i have enough time to learn how to shoot a photo of the space station (until 2020 because the iss crashes then).
because of this i would like to display the times (coordinates) of it's seeing! this sounds like a new eye-candy by mrpeachy
is it possible to grab information out of an email? www.calsky.com offers an email-alert-manager.
@arclance
if u offer it that u separate the code then do it then i can so something else.
Offline
@Jed and Sector11,
Very nice horizontal setup! Will either of you do a htop or Taskmanager and let me know how much memory that conky uses?
I am thinking of using it to replace a plugin I use on Iceweasel that does the same thing
I appreiciate it
Sure thing VastOne, here you go!
Proud user of VSDIO: Jedi! You can download it from here... I'm on the web at NixNut.com!
Offline
your wallpaper shows the gate from the movie 'stargate universe'. very nice! do u use v9000? could u please post your code?
Here you go lionhead! As requested. You'll need to change path's to your machine's info etc.
# killall conky && conky -c /media/5/Conky/S11_VSIDO.conkyrc &
# Original by: VastOne on VSIDO
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer right
# Use Xft?
use_xft yes
xftfont Monofur:bold:size=12
xftalpha 1.0
# text_buffer_size 256
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
own_window yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
# own_window_argb_visual yes
own_window_class Conky
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
# border width
border_width 0
# Default colors and also border colors
default_color 00BFFF # 0 191 255 DeepSkyBlue
color0 FFDEAD #255 222 173 NavajoWhite
color1 7FFF00 #127 255 0 Chartreuse
color2 778899 #119 136 153 LightSlateGray
color3 FF8C00 #255 140 0 DarkOrange
color4 F0FFFF #240 255 255 Azure
color5 FFDEAD #255 222 173 NavajoWhite
color6 7B68EE #123 104 238 MediumSlateBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 FF0000 #255 0 0 Red
#default_shade_color black
#default_outline_color grey
own_window_colour 000000
# Text alignment, other possible values are commented
#alignment top_middle
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 10
gap_y 0
minimum_size 1310 0 ## width, height
#maximum_width 1000 ## width
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off (no).
short_units yes
lua_load /home/jed/conky/draw-bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x2B4287 0.2
#
TEXT
${lua conky_draw_bg 10 0 20 0 80 0x558FEE 0.3}\
${image /home/jed/images/VSIDO_red.png -p 0,20 -s 70x70}\
${color} Distro ${color4}${execi 2600 cat /etc/issue.net} ${color}Kernel ${color4}${kernel}\
${color} MEM${color4}${if_match ${memperc}<10} ${memperc}\
${else}${if_match ${memperc}<100} ${memperc}\
${else}${memperc}${endif}${endif}% \
${color}(${mem}/${memmax})\
${color}CPU: 1${color4}${if_match ${cpu cpu1}<10} ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}${cpu cpu2}${endif}${endif}%\
${color}2${color4}${if_match ${cpu cpu2}<10} ${cpu cpu0}\
${else}${if_match ${cpu cpu2}<100} ${cpu cpu2}\
${else}${cpu cpu0}${endif}${endif}%\
${color}3${color4}${if_match ${cpu cpu3}<10} ${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100} ${cpu cpu3}\
${else}${cpu cpu3}${endif}${endif}%\
${color}4${color4}${if_match ${cpu cpu4}<10} ${cpu cpu4}\
${else}${if_match ${cpu cpu4}<100} ${cpu cpu4}\
${else}${cpu cpu4}${endif}${endif}%\
${color} NET${color4} Dn: ${color2}${downspeedgraph wlan0 12,100 00ff00 ff0000 -t -l} ${color}Up: ${color2}${upspeedgraph wlan0 12,100 ff0000 00ff00 -t -l} ${color}Uptime ${color1}${uptime_short}\
${color} Wireless Signal${color1}: ${wireless_link_qual_perc wlan0}% ${color}Sys Temp: ${color1}${hwmon temp 1}ºC\
${color}${texeci 500 bash $HOME/Conky/accuweather_conky/Accuweather_Conky_USA_Images/acc_usa_images}${voffset -70}${goto 565}${image $HOME/Accuweather_Conky_USA_Images/cc.png -p 595,10 -s 135x81}Right Now
${goto 570}${font Arial:size=10}${color4}${execpi 600 sed -n '3p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
${goto 580}${font}${color 00BFFF}TEMP:${color4}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F (${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F)
${voffset -80}${font Arial:size=9}${goto 750}${color 00BFFF}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 905}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 1070}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${color}${font}${image $HOME/Accuweather_Conky_USA_Images/7.png -p 780,20 -s 90x54}
${voffset -5}${font Arial:size=8}${goto 765}H: ${color4}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${color}${goto 920}H: ${color4}${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${color}${goto 1085}H: ${color4}${execpi 600 sed -n '19p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F
${color}${goto 765}L: ${color4}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${color}${goto 920}L: ${color4}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${color}${goto 1085}L: ${color4}${execpi 600 sed -n '20p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F
${color1}${image $HOME/Accuweather_Conky_USA_Images/12.png -p 955,20 -s 90x54}${image $HOME/Accuweather_Conky_USA_Images/17.png -p 1105,20 -s 90x54}${goto 750}${execpi 600 sed -n '1p' $HOME/Accuweather_Conky_USA_Images/messages}${goto 905}${execpi 600 sed -n '3p' $HOME/Accuweather_Conky_USA_Images/messages}${goto 1070}${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/messages}
${color}${voffset -50}${goto 1225}gmail: ${color4}${execi 90 conkyEmail --servertype=POP --servername=pop.googlemail.com --ssl --username=yourusername --password=yourpassword --mailinfo=0}
${color}${voffset 0}${goto 1225}account2: ${color4}${execi 90 conkyEmail --servertype=POP --servername=mail.any.com --ssl --username=yourusername --password=yourpassword --mailinfo=0}
${color}${voffset 0}${goto 1225}account3: ${color4}${execi 90 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=yourusername --password=yourpassword --mailinfo=0}
${color}${voffset 0}${goto 1225}account4: ${color4}${execi 90 conkyEmail --servertype=POP --servername=pop3.live.com --ssl --username=yourusername --password=yourpassword --mailinfo=0}
Proud user of VSDIO: Jedi! You can download it from here... I'm on the web at NixNut.com!
Offline
if u want to display the orbit of the iss then you can display this image:
http://www.heavens-above.com/orbitdispl … atid=25544
this is a candidate to create a mask.
Last edited by lionhead (2013-01-08 18:04:20)
Offline
i want to buy a telescope (for astrophotography) and would like to make photos for example of the iss. i have enough time to learn how to shoot a photo of the space station (until 2020 because the iss crashes then).
because of this i would like to display the times (coordinates) of it's seeing! this sounds like a new eye-candy by mrpeachy
is it possible to grab information out of an email? www.calsky.com offers an email-alert-manager.
@arclance
if u offer it that u separate the code then do it
then i can so something else.
There is an API from ISS Tracker available - http://www.isstracker.com/extra
Need to be mailed to author about it though.
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
Offline
@arclance
if u offer it that u separate the code then do it
then i can so something else.
I can do that.
Do you just want the code for displaying the animated image to use with your own image or do you want the code to download the image radar images I use as well?
Offline
Offline
Offline
lionhead wrote:@arclance
if u offer it that u separate the code then do it
then i can so something else.
I can do that.
Do you just want the code for displaying the animated image to use with your own image or do you want the code to download the image radar images I use as well?
yea, i need the code to download the image as well as the code for displaying the animated image.
Offline
lionhead wrote:does anyone of you have the sourcecode of this:
http://i.imgur.com/4aDwI.pngThat was made quite some time ago, in fact now that I think about it, it was pre v9000. I was using conkyforecast for the weather part
![]()
I have been asked about this setup a few times but for some reason or other I don't have/cant find the code.Maybe I should re-make it some time
looking at the pic, may 2011... maybe it was v9000 after all
HI ! Happy New Year !
I've found the conky weathercircle wich works with v9000, but i've got errors in terminal.
#line 600:
out({x=midx+xfc5hl+xfc5,y=midy+yfc5hl+yfc5+12,txt=high_temp[5].."C|"..low_temp[5].."C"})
error:
Conky: llua_do_call: function conky_weather execution failed: /home/climatix/v9000/weathercircle.lua:600: attempt to concatenate field '?' (a nil value)
weathercirle.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 ' | 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 ' | 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 ' | 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="Mon",Tuesday="Tue",Wednesday="Wed",Thursday="Thu",Friday="Fri",Saturday="Sat",Sunday="Sun",x=""}
monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",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*)°",start)
table.insert(high_temp,t)
--match low temp
s,f,t=string.find(allweather,"\"Lo\">(%d*)°",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*)°")
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]*)°")
now["temp"]=t
s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)°</a>")
now["feels_like"]=t
s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)°</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]*)°</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]*)°</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*)°")
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="FORECAST ",font="caviar dreams",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="CURRENT CONDITIONS ",font="caviar dreams",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="caviar dreams",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="caviar dreams",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="caviar dreams",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="caviar dreams" 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="caviar dreams" 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
you may be better in lua than me.I hope you'll fix it.
Offline
Little tweak to the ConkyFlynn script I posted about a few pages back. Now he grimaces if the CPU load spikes by more than 5 points between updates. If I get a chance, I'll try to post a video of it in action (static image doesn't do it a whole lot of justice).
Still trying to decide on a suitable event to trigger the smile sprites and the 'god mode' sprite.
Pies! We made pies!
Offline
arclance wrote:lionhead wrote:@arclance
if u offer it that u separate the code then do it
then i can so something else.
I can do that.
Do you just want the code for displaying the animated image to use with your own image or do you want the code to download the image radar images I use as well?yea, i need the code to download the image as well as the code for displaying the animated image.
This is the Lua for displaying the images.
installDirectory = ""
print("installDirectory = "..installDirectory)
logDirectory = installDirectory.."/log"
--######################
if tonumber(conky_parse('${updates}')) < 2 then --# don't reset these global variables if reloading the lua script
--#### Setup Buttons ####
buttons = {}--this table initially holds the values from the buttons
buttons["small_Close/Wide"] = {state=0,width=136,height=272,bl_x=923,bl_y=273}
buttons["large_Close/Wide"] = {state=0}
conkyWindowTitle = "weatherConky" --# the title of the conky window (own_window_title) to make it easier to configure
tempFileName = "xdo" --# the name of the temporary file to store mouse click locations in (makes configuring for use in more than one conky easier)
--###### Non-User Configurable Button Settings ######
xdotool_window_number = nil
xdotool_window_number2 = nil
abstlx = nil
abstly = nil
--###### End Setup Buttons ######
updateCheck = 0
end --# if tonumber(conky_parse('${updates}')) < 2 then
--######################
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
local localx,localy,localnowx,localnowy = clickfunction()--this line activates the clickfunction and sets the click coordinates
--######################################################
drawRad_Sat_Small(cr, 0, 0, localx, localy)
if updateCheck < 14 then
updateCheck = updateCheck + 1
else
updateCheck = 0
end --# if updateCheck < 14 then
--######################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr = nil
cs = nil
end --# function conky_main()
function drawRad_Sat_Small(cr, blx, bly, localx, localy)
local button_name = "small_Close/Wide"
if (localx >= buttons[button_name]["bl_x"]) and (localx <= (buttons[button_name]["bl_x"] + buttons[button_name]["width"])) and (localy <= buttons[button_name]["bl_y"]) and (localy >= (buttons[button_name]["bl_y"] - buttons[button_name]["height"])) then
if buttons[button_name]["state"] == 0 then
buttons[button_name]["state"] = 1
elseif buttons[button_name]["state"] == 1 then
buttons[button_name]["state"] = 0
end --# if buttons[button_name]["state"] == 0 then
elseif buttons[button_name]["state"] == nil then
buttons[button_name]["state"] = 0
end --# if (localx >= buttons[button_name]["bl_x"]) and (localx <= (buttons[button_name]["bl_x"] + buttons[button_name]["width"])) and (localy <= buttons[button_name]["bl_y"]) and (localy >= (buttons[button_name]["bl_y"] - buttons[button_name]["height"])) then
--####
local radarImage_Path = nil
local satteliteImage_Path = nil
if buttons[button_name]["state"] == 0 then
radarImage_Path = logDirectory.."/Images/radarImage_temp.gif."..string.format("%03i",updateCheck)
satteliteImage_Path = logDirectory.."/Images/satelliteImage_temp.gif."..string.format("%03i",updateCheck)
else
radarImage_Path = logDirectory.."/Images/radarImage_Wide_temp.gif."..string.format("%03i",updateCheck)
satteliteImage_Path = logDirectory.."/Images/satelliteImage_Wide_temp.gif."..string.format("%03i",updateCheck)
end --# if buttons[button_name]["state"] == 0 then
image({x=(923),y=(1),w=136,h=136,file=radarImage_Path})
image({x=(923),y=(137),w=136,h=136,file=satteliteImage_Path})
--cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
--cairo_set_font_size (cr, fSize)
cr = draw_shaded_text(cr, (updateCheck + 1), 925, 12, {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
cr = draw_shaded_text(cr, (updateCheck + 1), 925, 149, {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
return cr,blx,bly
end --# function drawRad_Sat_Small(cr, blx, bly)
function drawRad_Sat_Large(cr, blx, bly, imSize, localx, localy)
local button_name = "large_Close/Wide"
if buttons[button_name]["bl_x"] == nil then
buttons[button_name]["bl_x"] = blx
buttons[button_name]["bl_y"] = (bly + 1) + imSize
buttons[button_name]["width"] = (blx + (imSize * 2) + 3) - blx
buttons[button_name]["height"] = imSize
end --# if buttons[button_name]["bl_x"] = nil then
if (localx >= buttons[button_name]["bl_x"]) and (localx <= (buttons[button_name]["bl_x"] + buttons[button_name]["width"])) and (localy <= buttons[button_name]["bl_y"]) and (localy >= (buttons[button_name]["bl_y"] - buttons[button_name]["height"])) then
if buttons[button_name]["state"] == 0 then
buttons[button_name]["state"] = 1
elseif buttons[button_name]["state"] == 1 then
buttons[button_name]["state"] = 0
end --# if buttons[button_name]["state"] == 0 then
elseif buttons[button_name]["state"] == nil then
buttons[button_name]["state"] = 0
end --# if (localx >= buttons[button_name]["bl_x"]) and (localx <= (buttons[button_name]["bl_x"] + buttons[button_name]["width"])) and (localy <= buttons[button_name]["bl_y"]) and (localy >= (buttons[button_name]["bl_y"] - buttons[button_name]["height"])) then
--####
local radarImage_Path = nil
local satteliteImage_Path = nil
if buttons[button_name]["state"] == 0 then
radarImage_Path = logDirectory.."/Images/radarImage_temp.gif."..string.format("%03i",updateCheck)
satteliteImage_Path = logDirectory.."/Images/satelliteImage_temp.gif."..string.format("%03i",updateCheck)
else
radarImage_Path = logDirectory.."/Images/radarImage_Wide_temp.gif."..string.format("%03i",updateCheck)
satteliteImage_Path = logDirectory.."/Images/satelliteImage_Wide_temp.gif."..string.format("%03i",updateCheck)
end --# if buttons[button_name]["state"] == 0 then
image({x=(blx),y=(bly + 1),w=imSize,h=imSize,file=radarImage_Path})
cr = draw_horizontal_divider(cr, (blx + imSize + 1), (bly - 1), (blx + imSize + 1), (bly + imSize + 1), 1, {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
image({x=(blx + imSize + 2),y=(bly + 1),w=imSize,h=imSize,file=satteliteImage_Path})
if use_NOAA == true then
cr = draw_horizontal_divider(cr, (blx + (imSize * 2) + 3), (bly - 1), (blx + (imSize * 2) + 3), (bly + imSize + 1), 1, {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
image_cropped({x=(blx + (imSize * 2) + 4),y=(bly + 1),w=(imSize * (591/381)),h=imSize,file=(logDirectory.."/Images/riverLevelImage.png")},{2,59,591,381})
end --# if use_NOAA == true then
--cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
--cairo_set_font_size (cr, fSize)
cr = draw_shaded_text(cr, (updateCheck + 1), (blx + 1), (bly + 12), {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
cr = draw_shaded_text(cr, (updateCheck + 1), (blx + imSize + 3), (bly + 12), {color1_R,color1_G,color1_B,color1_A}, {color3_R,color3_G,color3_B,color3_A})
return cr
end --# function drawRad_Sat_Large(cr, blx, bly, imSize)
function draw_shaded_text(CR, text, xpos, ypos, COLOR, shade_color)
cairo_set_source_rgba (CR,shade_color[1],shade_color[2],shade_color[3],shade_color[4]) --# set shade color
cairo_move_to (CR,(xpos + 1),(ypos + 1))
cairo_show_text (CR,text)
cairo_stroke (CR)
cairo_set_source_rgba (CR,COLOR[1],COLOR[2],COLOR[3],COLOR[4]) --# set font color
cairo_move_to (CR,xpos,ypos)
cairo_show_text (CR,text)
cairo_stroke (CR)
return CR
end --# function cr = cr = draw_shaded_text(cr, cr, )
function draw_horizontal_divider(CR, xpos, ypos, xend, yend, lineWidth, COLOR, shade_color)
--cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE) --# don't antialias outline it is too thin and gets blurred
cairo_set_line_width (CR,lineWidth)
--# draw shade
cairo_set_source_rgba (CR,shade_color[1],shade_color[2],shade_color[3],shade_color[4]) --# set shade color
cairo_move_to (CR, (xpos + 1), (ypos + 1))
cairo_line_to (CR,(xend + 1), (yend + 1))
cairo_stroke (CR)
--# draw line
cairo_set_source_rgba (CR,COLOR[1],COLOR[2],COLOR[3],COLOR[4]) --# set color
cairo_move_to (CR, xpos, ypos)
cairo_line_to (CR, xend, yend)
cairo_stroke (CR)
--cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT)
return CR
end --# function cr = cr = draw_horizontal_divider(cr,cr, )
function image(im)
local x = nil
x = (im.x or 0)
local y = nil
y = (im.y or 0)
local w = nil
w = (im.w or default_image_width)
local h = nil
h = (im.h or default_image_height)
local file = nil
file = tostring(im.file)
if file == nil then
print("set image file")
end --# if file == nil then
local show = imlib_load_image(file)
if show == nil then
return
end --# if show == nil then
imlib_context_set_image(show)
local WIDTH = nil
if tonumber(w) == 0 then
WIDTH = imlib_image_get_width()
else
WIDTH = tonumber(w)
end --# if tonumber(w) == 0 then
local HEIGHT = nil
if tonumber(h) == 0 then
HEIGHT = imlib_image_get_height()
else
HEIGHT = tonumber(h)
end --# if tonumber(h) == 0 then
local scaled = imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), WIDTH, HEIGHT)
imlib_free_image_and_decache()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image_and_decache()
show = nil
WIDTH = nil
HEIGHT = nil
x = nil
y = nil
w = nil
h = nil
file = nil
scaled = nil
end --# function image(im)
--# cropSettings = {xStart,yStart,cropWidth,cropHeight}
function image_cropped(im, cropSettings)
local x = nil
x = (im.x or 0)
local y = nil
y = (im.y or 0)
local w = nil
w = (im.w or default_image_width)
local h = nil
h = (im.h or default_image_height)
local file = nil
file = tostring(im.file)
if file == nil then
print("set image file")
end --# if file == nil then
local show = imlib_load_image(file)
if show == nil then
return
end --# if show == nil then
imlib_context_set_image(show)
local WIDTH = nil
if tonumber(w) == 0 then
WIDTH = imlib_image_get_width()
else
WIDTH = tonumber(w)
end --# if tonumber(w) == 0 then
local HEIGHT = nil
if tonumber(h) == 0 then
HEIGHT = imlib_image_get_height()
else
HEIGHT = tonumber(h)
end --# if tonumber(h) == 0 then
local scaled = imlib_create_cropped_scaled_image(cropSettings[1], cropSettings[2], cropSettings[3], cropSettings[4], WIDTH, HEIGHT)
imlib_free_image_and_decache()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image_and_decache()
show = nil
WIDTH = nil
HEIGHT = nil
x = nil
y = nil
w = nil
h = nil
file = nil
scaled = nil
end --# function image_cropped(im, cropSettings)
--#### Button code based on interactive conky by mrpeachy ####
--#### http://crunchbanglinux.org/forums/topic/18419/interactive-conky/ ####
function clickfunction()
--################################################################################################
if tonumber(conky_parse('${updates}')) < 2 then
local s = nil
local f = io.popen("xwininfo -all -int -tree -name '"..conkyWindowTitle.."'")
local winData = f:read("*a")
f:close()
f = nil
s,f,xdotool_window_number2 = string.find(winData,"xwininfo.%s.indow%sid.%s(%d+)%s") --# some window mangers use this (Cinnamon, Compiz (Unity))
s,f,xdotool_window_number = string.find(winData,"Parent%swindow%sid.%s(%d+)%s") --# some window managers use this (Fluxbox, Openbox)
s,f,abstlx = string.find(winData,"Absolute%supper.left%sX%p%s*(%p*%d*)")
s,f,abstly = string.find(winData,"Absolute%supper.left%sY%p%s*(%p*%d*)")
print("abstlx: "..tostring(abstlx).." abstly: "..tostring(abstly).." winNum_Parent: "..tostring(xdotool_window_number).." winNum_2: "..tostring(xdotool_window_number2))
end --# if tonumber(conky_parse('${updates}')) < 2 then
--#################################################################################################
--######### start click logging and calculations ##################################################
local s = nil
--######### Get Current Mouse Location ###################
local f = io.popen("xdotool getmouselocation 2> /dev/null")
local mousenow = f:read("*a")
f:close()
f = nil
local mousenowx = nil
local mousenowy = nil
local mousex = nil
local mousey = nil
if ((mousenow == nil) or (mousenow == "")) then --# check for failure of xdotool getmouselocation command (crashes script but usually only lasts one or two updates)
print("error: could not get mouse location")
mousenowx = "0"
mousenowy = "0"
mousex = "0"
mousey = "0"
elseif ((string.find(mousenow, xdotool_window_number) ~= nil) or (string.find(mousenow, xdotool_window_number2) ~= nil)) then --# check if mouse is in this conky window
--print("debug: mouse is in this window")
s,f,mousenowx = string.find(mousenow,"x%p(%d*)%s")
s,f,mousenowy = string.find(mousenow,"y%p(%d*)%s")
--#### Get Click Location
f = io.popen("tail --lines=1 /tmp/"..tempFileName)
local click = f:read("*a")
f:close()
f = nil
if ((click == nil) or (click == "")) then --# xdotool log file does not exist or is empty (prevents crash before first click or if you specify the wrong file)
print("error: could not read xdotool logfile")
mousex = "0"
mousey = "0"
elseif (click:gsub("\n","") == "Command failed.") then --# this is does not crash xdotool (probably a communication error between xdotool and some part of the system)
print("error: xdotool error")
mousex = "0"
mousey = "0"
else --# no problems reading the xdotool log file
if ((string.find(click, xdotool_window_number) ~= nil) or (string.find(click, xdotool_window_number2) ~= nil)) then --# last click was in this window
print("debug: click was in this window")
s,f,mousex = string.find(click,"x%p(%d*)")
s,f,mousey = string.find(click,"y%p(%d*)")
--### Reset xdotool log file
f = io.open("/tmp/"..tempFileName,"w")
f:write("x:0 y:0 screen:0 window:0\n")
f:close()
f = nil
else --# last click was not in this window
--print("debug: click not in this window")
mousex = "0"
mousey = "0"
end --# if string.find(click, xdotool_window_number) ~= nil then
end --# if ((click == nil) or (click == "")) then
else --# mouse not in this window
mousenowx = "0"
mousenowy = "0"
mousex = "0"
mousey = "0"
end --# if string.find(mousenow, xdotool_window_number) then
local localx = tonumber(mousex) - abstlx
local localy = tonumber(mousey) - abstly
local localnowx = tonumber(mousenowx) - abstlx
local localnowy = tonumber(mousenowy) - abstly
--END CLICK CALCULATIONS #################################
return localx,localy,localnowx,localnowy
end --# function clickfunction()
function conky_start_xdotool()
os.execute("pkill -f \"xdotool search --sync --classname conky behave %@ mouse-click getmouselocation\"")
os.execute("xdotool search --sync --classname 'conky' behave %@ mouse-click getmouselocation 2> /dev/null >> /tmp/"..tempFileName.." &")
end --# function conky_start_xdotool()
function conky_stop_xdotool()
local stdout = io.popen("ps --no-headers -C conky -O cmd")
local conkyCount = 0
local rconkyData = stdout:read("*l")
while rconkyData ~= nil do
if ((string.find(rconkyData,"conkyrc_conkyWeather_arclance") ~= nil)) then --# is one of the conkys to check for (could use something generic like "button" here)
print("found")
conkyCount = conkyCount + 1
end --# if string.find("conkyrc_systemConky") ~= nil then
rconkyData = stdout:read("*l")
end --# while rconkyData ~= nil do
stdout:close()
if conkyCount == 1 then
print("killing xdotool")
os.execute("pkill -f \"xdotool search --sync --classname conky behave %@ mouse-click getmouselocation\"")
end --# if conkyCount == 1 then
end --# function conky_stop_xdotool()
It has all the code you should need to integrate it into something else.
This is the relevant bits of the python script I use to download the images and other weather data.
try:
import cPickle as pickle
print "using cPickle"
except ImportError:
import pickle
print "using pickle"
#endtry
import urllib2
import httplib
import socket
import time
import datetime
from dateutil import parser
from calendar import timegm
from subprocess import Popen, PIPE
### need gifsicle for animated radar ###
def tryconnect(turl, timer=4, retries=3):
for tried in xrange(retries):
try:
return urllib2.urlopen(turl, None, timer)
except (urllib2.URLError, socket.timeout, httplib.BadStatusLine, socket.error), e:
print "tryconnect Error: " + str(e)
else:
break
#endtry
#endfor
return None
#enddef
def openURL(request_url, timer=30, retries=3):
urlopener = tryconnect(request_url, timer, retries)
if urlopener:
try:
return urlopener
except (httplib.IncompleteRead, httplib.BadStatusLine, socket.timeout, socket.error), e:
print "openURL Error: " + str(e)
return None
#endtry
else:
return None
#endif
#enddef
def conkyWeather():
global logDirectory, pullAtempted
##################################
print("conkyWeather_arclance_v6.2")
##### user defined variables #####
#### System Variables ####
installLocation = ""
print("installLocation = " + installLocation)
pollInterval = float(900) # time between data pulls from the API (in seconds) as a float
logDirectory = installLocation + "/log" # directory to put working and log files in
#### System Variables ####
#### Wunderground API Variables ####
APIKEY = "" # the user specific API access key
location = ""
forecastSource = 0 # 1 = Weather Underground BestForecast | 0 = other source (National Weather Service in United States)
usePersonalStations = 1 # use personal weather stations for condtions | 1 = true | 0 = false
#### End Wunderground API Variables ####
#### Wunderground API Radar ####
radarWU_API_FEATURE = "animatedradar"
radarWU_API_FORMAT = "gif"
radarWU_API_LAT = 0.0
radarWU_API_LON = 0.0
try:
radtest = float(radarWU_API_LAT)
except Exception, e:
raise latlon_ValueError("Latitude is not a number: " + str(radarWU_API_LAT))
#endtry
try:
radtest = float(radarWU_API_LON)
except Exception, e:
raise latlon_ValueError("Longitude is not a number: " + str(radarWU_API_LON))
#endtry
radarWU_API_RADIUS = 150
radarWU_API_SIZE = 500
radarWU_API_NUMFRAMES = 15
radarWU_API_TIMEPOSY = radarWU_API_SIZE - 5
radarWU_API_PARAMS = "centerlat=" + str(radarWU_API_LAT) + "¢erlon=" + str(radarWU_API_LON) + "&radunits=km&radius=" + str(radarWU_API_RADIUS) + "&width=" + str(radarWU_API_SIZE) + "&height=" + str(radarWU_API_SIZE) + "&newmaps=1&rainsnow=1&reproj.automerc=1&num=" + str(radarWU_API_NUMFRAMES) + "&delay=75&timelabel=1&timelabel.x=0&timelabel.y=" + str(radarWU_API_TIMEPOSY)
radarWU_API_URL = "https://api.wunderground.com/api/" + APIKEY + "/" + radarWU_API_FEATURE + "/image." + radarWU_API_FORMAT + "?" + radarWU_API_PARAMS
#print radarWU_API_URL
radarWU_API_RADIUS_WIDE = 300
radarWU_API_PARAMS = "centerlat=" + str(radarWU_API_LAT) + "¢erlon=" + str(radarWU_API_LON) + "&radunits=km&radius=" + str(radarWU_API_RADIUS_WIDE) + "&width=" + str(radarWU_API_SIZE) + "&height=" + str(radarWU_API_SIZE) + "&newmaps=1&rainsnow=1&reproj.automerc=1&num=" + str(radarWU_API_NUMFRAMES) + "&delay=75&timelabel=1&timelabel.x=0&timelabel.y=" + str(radarWU_API_TIMEPOSY)
radarWU_API_URL_WIDE = "https://api.wunderground.com/api/" + APIKEY + "/" + radarWU_API_FEATURE + "/image." + radarWU_API_FORMAT + "?" + radarWU_API_PARAMS
##### End Wunderground API Radar ####
#### Wunderground Website Satellite ####
satelliteWU_Animated_LAT = 39.420833
satelliteWU_Animated_LON = -81.450556
satelliteWU_Animated_RADIUS = 150
satelliteWU_Animated_SIZE = 500
satelliteWU_Animated_NUMFRAMES = 15
satelliteWU_Animated_TIMEPOSY = satelliteWU_Animated_SIZE - 5
satelliteWU_Animated_TYPE = "sat_ir4_thumb" # type of satellite image to request
satelliteWU_Animated_GTT = 107 # ground temperature threshhold. Level to cutoff and leave transparent. 107 is a reasonable value to show clouds but hide land.
satelliteWU_Animaged_TIMEZONE = "America/New_York"
satelliteWUAnimated_URL = "http://wublast.wunderground.com/cgi-bin/WUBLAST?lat=" + str(satelliteWU_Animated_LAT) + "&lon=" + str(satelliteWU_Animated_LON) + "&radunits=km&radius=" + str(satelliteWU_Animated_RADIUS) + "&width=" + str(satelliteWU_Animated_SIZE) + "&height=" + str(satelliteWU_Animated_SIZE) + "&key=" + satelliteWU_Animated_TYPE + ">t=" + str(satelliteWU_Animated_GTT) + "&extension=gif&proj=me&num=" + str(satelliteWU_Animated_NUMFRAMES) + "&delay=75&timelabel=1&timelabel.x=0&timelabel.y=" + str(satelliteWU_Animated_TIMEPOSY) + "&tzname=" + satelliteWU_Animaged_TIMEZONE + "&basemap=1&borders=1&theme=WUNIDS"
#print(satelliteWUAnimated_URL)
satelliteWU_Animated_RADIUS_WIDE = 300
satelliteWUAnimated_URL_WIDE = "http://wublast.wunderground.com/cgi-bin/WUBLAST?lat=" + str(satelliteWU_Animated_LAT) + "&lon=" + str(satelliteWU_Animated_LON) + "&radunits=km&radius=" + str(satelliteWU_Animated_RADIUS_WIDE) + "&width=" + str(satelliteWU_Animated_SIZE) + "&height=" + str(satelliteWU_Animated_SIZE) + "&key=" + satelliteWU_Animated_TYPE + ">t=" + str(satelliteWU_Animated_GTT) + "&extension=gif&proj=me&num=" + str(satelliteWU_Animated_NUMFRAMES) + "&delay=75&timelabel=1&timelabel.x=0&timelabel.y=" + str(satelliteWU_Animated_TIMEPOSY) + "&tzname=" + satelliteWU_Animaged_TIMEZONE + "&basemap=1&borders=1&theme=WUNIDS"
#print(satelliteWUAnimated_URL_WIDE)
#### End Wunderground Website Satellite ####
##### end user defined variables #####
##### Radar/Satellite Data #####
print "Pulling -- WU Radar"
##### Radar Image From WU API #####
radar_Data = openURL(radarWU_API_URL, 100, 1)
if radar_Data:
try:
radarImage = radar_Data.read()
radarFile = open((logDirectory + "/Images/radarImageA.gif"), 'wb')
radarFile.write(radarImage)
radarFile.close()
(stdout, stderr) = Popen(["gifsicle", "--unoptimize", "--explode", (logDirectory + "/Images/radarImageA.gif"), "--output", (logDirectory + "/Images/radarImage_temp.gif")], stdout=PIPE, stderr=PIPE, close_fds=True).communicate()
#print str(stdout)
radar_Data.close()
#print "stdout = " + str(stdout)
print "stderr = " + str(stderr).strip()
if ((stderr != "") and ("trailing garbage after GIF ignored" not in stderr)):
print "gifscile error"
errorCount = errorCount + 1
errorCountLog = open((logDirectory + "/wuRadarPullErrorCountLog.txt"), 'w')
pickle.dump(errorCount, errorCountLog)
errorCountLog.close()
radarErrorOutput = ("Error Number - " + str(errorCount) + "\nError Time - " + time.strftime('%Y-%m-%d | %I:%M:%S %p %Z' ,time.localtime(float(time.time()))) +"\nError Document\n" + str(radarImage) + "\n")
radarErrorFile = open((logDirectory + "/wuRadarPullErrorLog.txt"), 'a')
radarErrorFile.write(radarErrorOutput)
radarErrorFile.close()
pullfailure3 = True
backupUsed = True
else:
pullfailure3 = False
#endif
#pullfailure3 = False
except (httplib.IncompleteRead, socket.timeout, socket.error), e:
print "radarImage Read Error"
print str(e)
pullfailure3 = True
backupUsed = True
#endtry
else:
pullfailure3 = True
backupUsed = True
#endif
##### Radar Image From WU API WIDE #####
print "Pulling -- WU Radar - Wide"
radar_Data = openURL(radarWU_API_URL_WIDE, 100, 1)
if radar_Data:
try:
radarImage = radar_Data.read()
radarFile = open((logDirectory + "/Images/radarImageA_Wide.gif"), 'wb')
radarFile.write(radarImage)
radarFile.close()
(stdout, stderr) = Popen(["gifsicle", "--unoptimize", "--explode", (logDirectory + "/Images/radarImageA_Wide.gif"), "--output", (logDirectory + "/Images/radarImage_Wide_temp.gif")], stdout=PIPE, stderr=PIPE, close_fds=True).communicate()
#print str(stdout)
radar_Data.close()
#print "stdout = " + str(stdout)
print "stderr = " + str(stderr).strip()
if ((stderr != "") and ("trailing garbage after GIF ignored" not in stderr)):
print "gifscile error"
errorCount = errorCount + 1
errorCountLog = open((logDirectory + "/wuRadarPullErrorCountLog.txt"), 'w')
pickle.dump(errorCount, errorCountLog)
errorCountLog.close()
radarErrorOutput = ("Error Number - " + str(errorCount) + "\nError Time - " + time.strftime('%Y-%m-%d | %I:%M:%S %p %Z' ,time.localtime(float(time.time()))) +"\nError Document\n" + str(radarImage) + "\n")
radarErrorFile = open((logDirectory + "/wuRadarPullErrorLog.txt"), 'a')
radarErrorFile.write(radarErrorOutput)
radarErrorFile.close()
pullfailure3_2 = True
backupUsed = True
else:
pullfailure3_2 = False
#endif
#pullfailure3 = False
except (httplib.IncompleteRead, socket.timeout, socket.error), e:
print "radarImage Read Error"
print str(e)
pullfailure3_2 = True
backupUsed = True
#endtry
else:
pullfailure3_2 = True
backupUsed = True
#endif
##### Satellite Image From WU #####
print "Pulling -- WU Satellite"
satellite_Data = openURL(satelliteWUAnimated_URL, 100, 1)
if satellite_Data:
try:
satelliteImage = satellite_Data.read()
satelliteFile = open((logDirectory + "/Images/satelliteImageA.gif"), 'wb')
satelliteFile.write(satelliteImage)
satelliteFile.close()
satellite_Data.close()
(stdout, stderr) = Popen(["gifsicle", "--unoptimize", "--explode", (logDirectory + "/Images/satelliteImageA.gif"), "--output", (logDirectory + "/Images/satelliteImage_temp.gif")], stdout=PIPE, stderr=PIPE, close_fds=True).communicate()
#print "stdout = " + str(stdout)
print "stderr = " + str(stderr).strip()
if stderr != "":
print "gifscile error"
pullfailureSAT = True
backupUsed = True
else:
pullfailureSAT = False
#endif
except (httplib.IncompleteRead, socket.timeout, socket.error), e:
print "satelliteImage Read Error"
print str(e)
pullfailureSAT = True
backupUsed = True
#endtry
else:
pullfailureSAT = True
backupUsed = True
#endif
##### Satellite Image From WU Wide #####
print "Pulling -- WU Satellite - Wide"
satellite_Data = openURL(satelliteWUAnimated_URL_WIDE, 100, 1)
if satellite_Data:
try:
satelliteImage = satellite_Data.read()
satelliteFile = open((logDirectory + "/Images/satelliteImageA_Wide.gif"), 'wb')
satelliteFile.write(satelliteImage)
satelliteFile.close()
satellite_Data.close()
(stdout, stderr) = Popen(["gifsicle", "--unoptimize", "--explode", (logDirectory + "/Images/satelliteImageA_Wide.gif"), "--output", (logDirectory + "/Images/satelliteImage_Wide_temp.gif")], stdout=PIPE, stderr=PIPE, close_fds=True).communicate()
#print "stdout = " + str(stdout)
print "stderr = " + str(stderr).strip()
if stderr != "":
print "gifscile error"
pullfailureSAT_2 = True
backupUsed = True
else:
pullfailureSAT_2 = False
#endif
except (httplib.IncompleteRead, socket.timeout, socket.error), e:
print "satelliteImage Read Error"
print str(e)
pullfailureSAT_2 = True
backupUsed = True
#endtry
else:
pullfailureSAT_2 = True
backupUsed = True
#endif
##### END Radar/Satellite Data #####
#enddef
That probably won't run as is since I don't have time to figure out how to make sure it is untangled from the rest of the code.
I do the download from a separate script so it does not lock up the conky while downloading things.
The full python script also enforces a strict download interval so you don't get banned from the Wunderground API.
I could do it all from a Lua script if I could get one of the Lua multi-threading libraries to work the way I need but I have not had much luck figuring out how to use them.
Offline
My latest attempt at something on the minimal side ... no idea how long it will last:
The conky: S11_VSIDO_v9.conkyrc
# killall conky && conky -c /media/5/Conky/S11_VSIDO_v9.conkyrc &
# Original by: VastOne on VSIDO
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer none #right
# Use Xft?
use_xft yes
xftfont Monofur:bold:size=12
xftalpha 1.0
# text_buffer_size 256
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
own_window yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_transparent yes
# own_window_argb_visual yes
own_window_class Conky
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 3
# border width
border_width 0
# Default colors and also border colors
default_color 00BFFF # 0 191 255 DeepSkyBlue
color0 FFDEAD #255 222 173 NavajoWhite
color1 7FFF00 #127 255 0 Chartreuse
color2 778899 #119 136 153 LightSlateGray
color3 FF8C00 #255 140 0 DarkOrange
color4 F0FFFF #240 255 255 Azure
color5 FFDEAD #255 222 173 NavajoWhite
color6 7B68EE #123 104 238 MediumSlateBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 FF0000 #255 0 0 Red
#default_shade_color black
#default_outline_color grey
own_window_colour 000000
# Text alignment, other possible values are commented
#alignment top_middle
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 5 # left-right
gap_y 5 # up-down
minimum_size 1265 0 ## width, height
#maximum_width 1250 ## width
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off (no).
short_units yes
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
#${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
lua_load /media/5/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.4
# lua_draw_hook_post draw-bg 125 0 0 0 0 0x000000 0.01
#
# TEXT
#
############### V9000 ########################################################
#starts the lua weather data gathering function, call once at top of conkyrc
lua_load ~/v9000/v9000.lua
lua_draw_hook_post weather
lua_load /media/5/Conky/templates/VSIDO-v9-template.lua
####################################################### End LUA Settings ###
#
TEXT
${execi 600 bash /media/5/Conky/accuweather_conky/accuw_script}\
${color}Kernel ${color4}${kernel}\
${color}MEM${color4}${if_match ${memperc}<10} ${memperc}\
${else}${if_match ${memperc}<100} ${memperc}\
${else}${memperc}${endif}${endif}%\
${color}(${mem})\
${color}CPU${color4}${if_match ${platform f71882fg.2560 temp 1}<100} ${platform f71882fg.2560 temp 1}\
${else}${platform f71882fg.2560 temp 1}${endif}°\
${color}MB${color4}${if_match ${platform f71882fg.2560 temp 2}<100} ${platform f71882fg.2560 temp 2}\
${else}${platform f71882fg.2560 temp 2}${endif}°\
${color}HD${color4}${if_match ${execi 5 hddtemp -n /dev/sda}<100} ${execi 5 hddtemp -n /dev/sda}\
${else}${execi 5 hddtemp -n /dev/sda}${endif}°
${color}NET${color4} Dn: ${color2}${downspeedgraph eth0 12,150 00ff00 ff0000 -t -l} ${color}Up: ${color2}${upspeedgraph eth0 12,150 ff0000 00ff00 -t -l} ${color}Uptime ${color1}${uptime_short}
${color}CPU: 1${color4}${if_match ${cpu cpu1}<10} ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}${cpu cpu0}${endif}${endif}%\
${color}2${color4}${if_match ${cpu cpu0}<10} ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
${color}3${color4}${if_match ${cpu cpu0}<10} ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
${color}4${color4}${if_match ${cpu cpu0}<10} ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}%\
${color}Fan ${color4}${platform f71882fg.2560 fan 1} rpm\
${color}VRX·${color7}03 ${color4}04·${color1}${exec conkyDaysDiff 20130304} ${color4}11·${color7}${exec conkyDaysDiff 20130311} ${color4}16·${color3}${exec conkyDaysDiff 20130316}${color4}
VSIDO-v9-template.lua mrpeachy's v9000 is required.
--[[
The latest script is a lua only weather script. aka: v9000
http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/
the file:
http://dl.dropbox.com/u/19008369/current%20v9000/v9000.tar.gz
mrppeachys LUA Tutorial
http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
-- default_font="CorporateMonoExtraBold"--font must be in quotes
-- default_font_size=10
default_font="monofur"--font must be in quotes
default_font_size=12
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=20
default_image_height=20
-- ## New Options ###
default_face="bold"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
datax=670
dataxx=55
dataxx1=dataxx+30
datay1=13
datay2=25
datay3=40
datay4=55
datayy=13 --datay+(datayy*1)
imgx=687
imgx1=55 -- (imgx1*1)
imgyh=165
imgyf=190
imgyy=39 -- imgy+(imgyy*1)
-- out({c=0x00FFFF,,a=1,x=6,y=50,txt="cpu:"..conky_parse("${cpu}")})
-- VSIDO ICON ORB
image({w=55,h=55,x=5,y=5,file="/home/sector11/images/vsido/orbwallpaper3.png"})
-- today
out({c=0x00FFFF,a=1,x=datax,y=datay1,txt=forecast_day_short[1]})
out({c=0x00FFFF,a=1,x=datax+30,y=datay1,txt=forecast_date[1]})
image({x=imgx,y=17,h=25,w=25,file=weather_icon[1]})
--image({x=imgx,y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax,y=datay2,txt=high_temp[1]})
out({c=0xF0FFFF,a=1,x=datax,y=datay3,txt=low_temp[1]})
out({c=0x00FFFF,a=1,x=datax+dataxx,y=datay1,txt="Current"})
out({c=0xF0FFFF,a=1,x=datax+dataxx,y=datay2,txt=now["temp"]})
out({c=0xFFDEAD,a=1,x=datax+dataxx,y=datay3,txt=now["feels_like"]})
image({x=imgx+(imgx1*1),y=17,h=25,w=25,file=now["weather_icon"]})
--image({x=imgx+(imgx1*1),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0x00FFFF,a=1,x=datax+(dataxx*2),y=datay1,txt=forecast_day_short[2]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*2+30),y=datay1,txt=forecast_date[2]})
image({x=imgx+(imgx1*2),y=17,h=25,w=25,file=weather_icon[2]})
--image({x=imgx+(imgx1*2),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*2),y=datay2,txt=high_temp[2]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*2),y=datay3,txt=low_temp[2]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*3),y=datay1,txt=forecast_day_short[3]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*3+30),y=datay1,txt=forecast_date[3]})
image({x=imgx+(imgx1*3),y=17,h=25,w=25,file=weather_icon[3]})
--image({x=imgx+(imgx1*3),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*3),y=datay2,txt=high_temp[3]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*3),y=datay3,txt=low_temp[3]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*4),y=datay1,txt=forecast_day_short[4]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*4+30),y=datay1,txt=forecast_date[4]})
image({x=imgx+(imgx1*4),y=17,h=25,w=25,file=weather_icon[4]})
--image({x=imgx+(imgx1*4),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*4),y=datay2,txt=high_temp[4]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*4),y=datay3,txt=low_temp[4]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*5),y=datay1,txt=forecast_day_short[5]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*5+30),y=datay1,txt=forecast_date[5]})
image({x=imgx+(imgx1*5),y=17,h=25,w=25,file=weather_icon[5]})
--image({x=imgx+(imgx1*5),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*5),y=datay2,txt=high_temp[5]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*5),y=datay3,txt=low_temp[5]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*6),y=datay1,txt=forecast_day_short[6]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*6+30),y=datay1,txt=forecast_date[6]})
image({x=imgx+(imgx1*6),y=17,h=25,w=25,file=weather_icon[6]})
--image({x=imgx+(imgx1*6),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*6),y=datay2,txt=high_temp[6]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*6),y=datay3,txt=low_temp[6]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*7),y=datay1,txt=forecast_day_short[7]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*7+30),y=datay1,txt=forecast_date[7]})
image({x=imgx+(imgx1*7),y=17,h=25,w=25,file=weather_icon[7]})
--image({x=imgx+(imgx1*7),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*7),y=datay2,txt=high_temp[7]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*7),y=datay3,txt=low_temp[7]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*8),y=datay1,txt=forecast_day_short[8]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*8+30),y=datay1,txt=forecast_date[8]})
image({x=imgx+(imgx1*8),y=17,h=25,w=25,file=weather_icon[8]})
--image({x=imgx+(imgx1*8),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*8),y=datay2,txt=high_temp[8]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*8),y=datay3,txt=low_temp[8]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*9),y=datay1,txt=forecast_day_short[9]})
out({c=0x00FFFF,a=1,x=datax+(dataxx*9+30),y=datay1,txt=forecast_date[9]})
image({x=imgx+(imgx1*9),y=17,h=25,w=25,file=weather_icon[9]})
--image({x=imgx+(imgx1*9),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*9),y=datay2,txt=high_temp[9]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*9),y=datay3,txt=low_temp[9]})
out({c=0x00FFFF,a=10,x=datax+(dataxx*10),y=datay1,txt=forecast_day_short[10]})
out({c=0x00FFFF,a=10,x=datax+(dataxx*10+30),y=datay1,txt=forecast_date[10]})
image({x=imgx+(imgx1*10),y=17,h=25,w=25,file=weather_icon[10]})
--image({x=imgx+(imgx1*10),y=17,h=25,w=25,file="/media/5/Conky/images/red+x.png"})
out({c=0xFF8C00,a=1,x=datax+(dataxx*10),y=datay2,txt=high_temp[10]})
out({c=0xF0FFFF,a=1,x=datax+(dataxx*10),y=datay3,txt=low_temp[10]})
-- BOTTOM LINE
out({c=0xF0FFFF,a=1,x=datax,y=datay4,txt="Today's Weather:"})
out({c=0x00FFFF,a=1,x=datax+115,y=datay4,txt="Pressure"})
out({c=0xF0FFFF,a=1,x=datax+175,y=datay4,txt=now["pressure_mb"].." mb"})
out({c=0x00FFFF,a=1,x=datax+245,y=datay4,txt="Humidity"})
out({c=0xF0FFFF,a=1,x=datax+305,y=datay4,txt=now["humidity"].."%"})
out({c=0x00FFFF,a=1,x=datax+338,y=datay4,txt="Dew Point"})
out({c=0xF0FFFF,a=1,x=datax+405,y=datay4,txt=now["dew_point"].."°"})
out({c=0x00FFFF,a=1,x=datax+435,y=datay4,txt="UV Index"})
out({c=0xF0FFFF,a=1,x=datax+495,y=datay4,txt=uv_index_num[1]})
out({c=0xF0FFFF,a=1,x=datax+515,y=datay4,txt=uv_index_txt[1]})
-- yellow line
--image({w=45,h=1,x=5,y=550,file="/media/5/Conky/images/yellow_1.png"})
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
Last edited by Sector11 (2013-01-10 02:30:40)
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
^Love it Sector! Great job as always!
Heres my new one
conky_info
background yes
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
double_buffer yes
no_buffers yes
text_buffer_size 2048
gap_x 10
gap_y 0
minimum_size 285 800
#maximum_width 190
own_window yes
own_window_type conky
own_window_transparent yes
#own_window_argb_visual
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
alignment ml
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
temperature_unit fahrenheit
override_utf8_locale yes
use_xft yes
xftfont 6x10:size=8
xftalpha 0.5
uppercase no
default_color FFFFFF
color1 660000
color2 AAAAAA
color3 DDDDDD
color4 CC3333
## Lua ##
lua_load /home/luke/Conky/allcombined_2.lua
## lua funcions
## background ##################################################################
#${lua draw_bg {corner_radius,x_position,y_position,width,height,color,alpha,draw_type,line_width,outline_color,outline_alpha}}
#note for background: set width=0 - width will be conky window width, set height=0 - height will be conky window height
# draw_type: 1=fill, 2=outline(must specify line_width), 3=outline and fill (must specify line_width, outline_color and outline_alpha)
## gradient bars ###############################################################
#${lua gradbar {x_position,y_position,"conky_object",object_max_value,number_of_divisions,division_width,division_height,division_gap,bg_color,bg_alpha,start_color,start_alpha,mid_color,mid_alpha,end_color,end_alpha}}
## calendar ###############################################################
#${lua luacal {x_position,y_position,"title_font",title_fontsize,title_color,title_alpha,"dates_font",dates_fontsize,dates_color,dates_alpha,"highlight_font",highlight_fontsize,highlight_color,highlight_alpha,"spacer",colum_gap,title_gap,row_gap,start_day}
#note for calendar: start day... 0=sunday, 1=monday ... "spacer" can help align calendar with non fix width fonts
## textured background ###############################################################
#${lua tex_bg {corner_radius,x_position,y_position,width,height,"/path/to/texture.png"}}
## lua draw images ###############################################################
#${lua luaimage {x_position,y_position,width,height,"/path/to/image"}}
#note for images: set width=0 - width will be image width, set height=0 - height will be image height
## lua draw text ###############################################################
#${lua luatext {x_position,y_position,color,alpha,"font",fontsize,"justify"}}
#note for text: justify can be "r" = right, "c" = center, "l" = left
#${lua draw_bg {10,0,0,0,0,0x000000,0.3}}
TEXT
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}Motherboard ${goto 240}${hwmon temp 1}F
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}${execi 1000 cat /sys/class/dmi/id/board_vendor} ${execi 1000 cat /sys/class/dmi/id/board_name}
${lua gradbar {5,55,"${hwmon temp 1}",210,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 5}
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}CPU${goto 240}${platform coretemp.0 temp 2}F
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}${execi 1000 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //' | sort -u | cut -c1-60}
${lua gradbar {5,136,"${platform coretemp.0 temp 2}",220,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 5}
${goto 13}${color}${font Pseudo APL:size=11,weight:normal}CPU1 ${cpu cpu1}% CPU2 ${cpu cpu2}% CPU3 ${cpu cpu3} CPU4 ${cpu cpu4}%
${lua gradbar {5,190,"${cpu cpu1}",100,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 5}
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}Memory
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}Total:${execi 1000 free -tm | grep -i mem |gawk '{ print $2}'}MB - Used: $mem - Free: $memfree
${lua gradbar {5,271,"${memperc}",100,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 3}
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}Total:${execi 1000 free -tm | grep -i swap |gawk '{ print $2}'}MB - Used: $swap - Free: $swapfree
${lua gradbar {5,325,"${swapperc}",100,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 5}
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}Graphic Card${goto 240} ${hwmon 2 temp 1}F
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}ATI XT Mobility Radeon HD 5870 1GB GDDR5
${lua gradbar {5,400,"${hwmon 2 temp 1}",200,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 0}
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}Network
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}Intel Centrino Advanced-N + WiMAX 6250
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}SSID: ${wireless_essid wlan0} ${goto 240}Speed: ${wireless_bitrate wlan0}
${goto 5}Mode: ${wireless_mode wlan0} ${goto 240}Quality: ${wireless_link_qual_perc wlan0}%
${goto 5}Down: ${downspeed wlan0} ${goto 240}Up: ${upspeed wlan0}
${goto 5}Total Down: ${totaldown wlan0}${goto 240}Total Up: ${totalup wlan0}
$${voffset -5}
${goto 5}${downspeedgraph wlan0 25,160 FFFFFF 990000}${goto 240}${upspeedgraph wlan0 25,160 FFFFFF 990000}
${goto 0}${color1}${font Pseudo APL:size=14,weight:bold}Storage${goto 240}${hddtemp /dev/sda}F
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}500GB Seagate Momentus XT Hybrid @ 7200rpm
${goto 5}${color}${font Pseudo APL:size=11,weight:normal}/root${goto 240}${fs_size /}
${lua gradbar {5,656,"${fs_used_perc /}",100,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 8}${goto 5}${font Pseudo APL:size=11,weight:normal}${color}Used${goto 150}${fs_used /}
${goto 5}${font Pseudo APL:size=11,weight:normal}${color}Free${goto 150}${fs_free /}
${voffset 5}${goto 5}${color}${font Pseudo APL:size=11,weight:normal}/home${goto 240}${fs_size /home}
${lua gradbar {5,740,"${fs_used_perc /home}",100,150,1,17,1,0xFFFFFF,.1,0xFFFFFF,.5,0xFF3333,.85,0x990000,1}}
${voffset 8}${goto 5}${font Pseudo APL:size=11,weight:normal}${color}Used${goto 150}${fs_used /home}
${goto 5}${font Pseudo APL:size=11,weight:normal}${color}Free${goto 150}${fs_free /home}
conky_clock
# -- Conky settings -- #
#background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
# -- Window specifications -- #
own_window_class Conky
own_window yes
own_window_type desktop
own_window_argb_visual yes
own_window_argb_value 180
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
border_inner_margin 0
border_outer_margin 0
minimum_size 350 300
maximum_width 350
alignment tr
gap_x 10
gap_y 10
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# -- Text settings -- #
use_xft yes
xftfont Ubuntu:size=9
xftalpha 1
uppercase no
default_color FFFFFF
# -- Lua Load -- #
lua_load ~/Conky/rings.lua
lua_draw_hook_pre clock_rings
lua_load ~/Conky/marks.lua
lua_draw_hook_post main
TEXT
${image ~/images/orb_red.png -s 150x150 -p 130,80}
${font Pseudo APL:size=13}${texeci 500 bash $HOME/Accuweather_Conky_USA_Images/acc_usa_images}${image $HOME/Accuweather_Conky_USA_Images/cc.png -p -15,290 -s 210x128}
${font Pseudo APL:size=13}${goto 165}TEMP${alignr 3}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F (${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F)
${goto 165}WIND${alignr 3}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/curr_cond} ${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 165}HUM${alignr 3}${execpi 600 sed -n '7p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 200}PRESS${alignr 3}${execpi 600 sed -n '8p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 200}CLOUD COVER${alignr 3}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 200}UV INDEX${alignr 10}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 165}DEW POINT${alignr 3}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 200}CEILING${alignr 3}${execpi 600 sed -n '12p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${goto 200}VISIB.${alignr 3}${execpi 600 sed -n '13p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
${goto 165}SUNRISE${alignr 3}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
${goto 165}SUNSET${alignr 3}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
#${font WhiteRabbit:size=15}Current Weather ${alignr 3}${execpi 600 sed -n '3p' $HOME/Accuweather_Conky_USA_Images/curr_cond}
${font Pseudo APL:size=13}${goto 20}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 140}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 255}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/tod_ton}
${voffset -12}${font Pseudo APL:size=10}${goto 100}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 210}${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '19p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F
${font Pseudo APL:size=10}${goto 100}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 210}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '20p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${image $HOME/Accuweather_Conky_USA_Images/7.png -p 10,430 -s 95x57}${image $HOME/Accuweather_Conky_USA_Images/12.png -p 125,430 -s 95x57}${image $HOME/Accuweather_Conky_USA_Images/17.png -p 250,430 -s 95x57}
marks.lua
--==============================================================================
-- multi_rings.lua
--
-- author : SLK
-- version : v2011011601
-- license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
-- clock DATA
-- HOURS
clock_h = {
{
name='time', arg='%H', max_value=12,
x=200, y=150,
graph_radius=140,
graph_thickness=3,
graph_unit_angle=30, graph_unit_thickness=5,
graph_bg_colour=0xffffff, graph_bg_alpha=0.0,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.0,
txt_radius=100,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0,
graduation_radius=120,
graduation_thickness=10, graduation_mark_thickness=1,
graduation_unit_angle=30,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1,
},
}
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
-- background ring
cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = (value % max_value)
local i = 1
while i <= val do
cairo_arc(display, x, y, graph_radius,( ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360) )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = (graph_unit_angle * i) - graph_unit_thickness
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = 360 / graduation_unit_angle
local i = 1
while i <= nb_graduation do
cairo_set_line_width(display, graduation_thickness)
cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
cairo_set_font_size (display, txt_size);
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
cairo_show_text (display, value);
cairo_stroke (display);
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
local function load_clock_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_clock_ring(display, data, value)
end
for i in pairs(clock_h) do
load_clock_rings(display, clock_h[i])
end
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
end
-------------------------------------------------------------------------------
-- MAIN
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_clock_rings(display)
go_gauge_rings(display)
end
end
rings.lua
--[[
Clock Rings by londonali1010 (2009)
This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/clock_rings-v1.1.1.lua
lua_draw_hook_pre clock_rings
Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]
settings_table = {
{
-- Edit this table to customise your rings.
-- You can create more rings simply by adding more elements to settings_table.
-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
name='time',
-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
arg='%I.%M',
-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
max=12,
-- "bg_colour" is the colour of the base ring.
bg_colour=0xFFFFFF,
-- "bg_alpha" is the alpha value of the base ring.
bg_alpha=0,
-- "fg_colour" is the colour of the indicator part of the ring.
fg_colour=0xFFFFFF,
-- "fg_alpha" is the alpha value of the indicator part of the ring.
fg_alpha=0,
-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
x=175, y=175,
-- "radius" is the radius of the ring.
radius=50,
-- "thickness" is the thickness of the ring, centred around the radius.
thickness=5,
-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
start_angle=0,
-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
end_angle=360
},
{
name='time',
arg='%M.%S',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0,
fg_colour=0xFFFFFF,
fg_alpha=0,
x=175, y=175,
radius=56,
thickness=5,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0,
fg_colour=0xFFFFFF,
fg_alpha=0,
x=175, y=175,
radius=62,
thickness=5,
start_angle=0,
end_angle=360
},
}
-- Use these settings to define the origin and extent of your clock.
clock_r=125
-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.
clock_x=200
clock_y=150
-- Colour & alpha of the clock hands
clock_colour=0xFFFFFF
clock_alpha=1
-- Do you want to show the seconds hand?
show_seconds=true
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
-- Draw background ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function draw_clock_hands(cr,xc,yc)
local secs,mins,hours,secs_arc,mins_arc,hours_arc
local xh,yh,xm,ym,xs,ys
secs=os.date("%S")
mins=os.date("%M")
hours=os.date("%I")
secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins+secs_arc/60
hours_arc=(2*math.pi/12)*hours+mins_arc/12
-- Draw hour hand
xh=xc+0.7*clock_r*math.sin(hours_arc)
yh=yc-0.7*clock_r*math.cos(hours_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xh,yh)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(cr,5)
cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
cairo_stroke(cr)
-- Draw minute hand
xm=xc+clock_r*math.sin(mins_arc)
ym=yc-clock_r*math.cos(mins_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xm,ym)
cairo_set_line_width(cr,3)
cairo_stroke(cr)
-- Draw seconds hand
if show_seconds then
xs=xc+clock_r*math.sin(secs_arc)
ys=yc-clock_r*math.cos(secs_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)
cairo_set_line_width(cr,1)
cairo_stroke(cr)
end
end
function conky_clock_rings()
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
-- Check that Conky has been running for at least 5s
if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
local cr=cairo_create(cs)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end
draw_clock_hands(cr,clock_x,clock_y)
end
allcombined_2.lua
--[[ by mrpeachy -
combines background bar and calendar functions
]]
require 'cairo'
require 'imlib2'
function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end
function conky_gradbar(bartab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--convert to table
local bartab=loadstring("return" .. bartab)()
local bar_startx=bartab[1]
local bar_starty=bartab[2]
local number=bartab[3]
local number=conky_parse(number)
local number_max=bartab[4]
local divisions=bartab[5]
local div_width=bartab[6]
local div_height=bartab[7]
local div_gap=bartab[8]
local bg_col=bartab[9]
local bg_alpha=bartab[10]
local st_col=bartab[11]
local st_alpha=bartab[12]
local mid_col=bartab[13]
local mid_alpha=bartab[14]
local end_col=bartab[15]
local end_alpha=bartab[16]
--color conversion
local br,bg,bb,ba=rgb_to_r_g_b({bg_col,bg_alpha})
local sr,sg,sb,sa=rgb_to_r_g_b({st_col,st_alpha})
local mr,mg,mb,ma=rgb_to_r_g_b({mid_col,mid_alpha})
local er,eg,eb,ea=rgb_to_r_g_b({end_col,end_alpha})
if number==nil then number=0 end
local number_divs=(number/number_max)*divisions
cairo_set_line_width (cr,div_width)
--gradient calculations
for i=1,divisions do
if i<(divisions/2) and i<=number_divs then
colr=((mr-sr)*(i/(divisions/2)))+sr
colg=((mg-sg)*(i/(divisions/2)))+sg
colb=((mb-sb)*(i/(divisions/2)))+sb
cola=((ma-sa)*(i/(divisions/2)))+sa
elseif i>=(divisions/2) and i<=number_divs then
colr=((er-mr)*((i-(divisions/2))/(divisions/2)))+mr
colg=((eg-mg)*((i-(divisions/2))/(divisions/2)))+mg
colb=((eb-mb)*((i-(divisions/2))/(divisions/2)))+mb
cola=((ea-ma)*((i-(divisions/2))/(divisions/2)))+ma
else
colr=br
colg=bg
colb=bb
cola=ba
end
cairo_set_source_rgba (cr,colr,colg,colb,cola)
cairo_move_to (cr,bar_startx+((div_width+div_gap)*i-1),bar_starty)
cairo_rel_line_to (cr,0,div_height)
cairo_stroke (cr)
end
--#########################################################################################################
end-- if updates>5
bartab=nil
colr=nil
colg=nil
colb=nil
cola=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function
function conky_draw_bg(bgtab)
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)
--#########################################################################################################
--convert to table
local bgtab=loadstring("return" .. bgtab)()
local r=bgtab[1]
local x=bgtab[2]
local y=bgtab[3]
local w=bgtab[4]
local h=bgtab[5]
local color=bgtab[6]
local alpha=bgtab[7]
if w==0 then
w=tonumber(conky_window.width)
end
if h==0 then
h=tonumber(conky_window.height)
end
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))
--the drawing part---------------------------
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)
--#########################################################################################################
bgtab=nil
w=nil
h=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function
function conky_luacal(caltab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--####################################################################################################
local caltab=loadstring("return" .. caltab)()
local cal_x=caltab[1]
local cal_y=caltab[2]
local tfont=caltab[3]
local tfontsize=caltab[4]
local tc=caltab[5]
local ta=caltab[6]
local bfont=caltab[7]
local bfontsize=caltab[8]
local bc=caltab[9]
local ba=caltab[10]
local hfont=caltab[11]
local hfontsize=caltab[12]
local hc=caltab[13]
local ha=caltab[14]
local spacer=caltab[15]
local gaph=caltab[16]
local gapt=caltab[17]
local gapl=caltab[18]
local sday=caltab[19]
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b({tc,ta})
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b({bc,ba})
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b({hc,ha})
--###################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( { year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( { year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
if i<=start_day then
dnum[i]=" "
else
dn=i-start_day
if dn=="nil" then dn=0 end
if dn<=9 then dn=(spacer .. dn) end
if i>x then dn="" end
dnum[i]=dn
dnumh[i]=dn
if dn==(spacer .. today) or dn==today then
dnum[i]=""
end
if dn==(spacer .. today) or dn==today then
dnumh[i]=dn
place=i
else dnumh[i]=" "
end
end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
if tonumber(sday)==0 then
dys={"SU","MO","TU","WE","TH","FR","SA"}
else
dys={"MO","TU","WE","TH","FR","SA","SU"}
end
--draw calendar titles
for i=1,7 do
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
for i=fn,fn+6 do
cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnum[i])
cairo_stroke (cr)
end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
for i=fn,fn+6 do
cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnumh[i])
cairo_stroke (cr)
end
end
--#########################################################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function
function conky_luaimage(imtab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--#########################################################################################################
local imtab=loadstring("return" .. imtab)()
local im_x=imtab[1]
local im_y=imtab[2]
local im_w=imtab[3]
local im_h=imtab[4]
local file=imtab[5]
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(im_w)==0 then
width=imlib_image_get_width()
else
width=tonumber(im_w)
end
if tonumber(im_h)==0 then
height=imlib_image_get_height()
else
height=tonumber(im_h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(im_x, im_y)
imlib_free_image()
show=nil
--#########################################################################################################
imtab=nil
height=nil
width=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function
function conky_tex_bg(textab)
local textab=loadstring("return" .. textab)()
local tex_file=textab[6]
local surface = cairo_image_surface_create_from_png(tostring(tex_file))
local cw,ch = conky_window.width, conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw,ch)
local cr=cairo_create(cs)
--#########################################################################################################
--convert to table
local r=textab[1]
local x=textab[2]
local y=textab[3]
local w=textab[4]
local h=textab[5]
if w=="0" then
w=cw
end
if h=="0" then
h=ch
end
--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))
--the drawing part---------------------------
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_clip (cr)
cairo_new_path (cr);
--image part
cairo_set_source_surface (cr, surface, 0, 0)
cairo_paint (cr)
--#########################################################################################################
textab=nil
w=nil
h=nil
cairo_destroy(cr)
cairo_surface_destroy (cs)
cairo_surface_destroy (surface)
cr=nil
return ""
end-- end main function
function conky_luatext(txttab)--x,y,c,a,f,fs,txt,j ##################################################
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)
--#########################################################################################################
--convert to table
local txttab=loadstring("return" .. txttab)()
local x=txttab[1]
local y=txttab[2]
local c=txttab[3]
local a=txttab[4]
local f=txttab[5]
local fs=txttab[6]
local j=txttab[7]
local txt=txttab[8]
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,txt,extents)
local wx=extents.x_advance
cairo_set_source_rgba (cr,rgb_to_r_g_b({c,a}))
if j=="l" then
cairo_move_to (cr,x,y)
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
end
cairo_show_text (cr,txt)
cairo_stroke (cr)
--#########################################################################################################
txttab=nil
cairo_destroy(cr)
cairo_surface_destroy (cs)
cr=nil
return ""
end-- end main function
Credit goes to:
mrpeachy for his allcombined.lua
TeoBigusGeekus for his weather scipts
Falldown for theVSIDO orb
And finally the wallpaper can be found here
Conky | SMXI HowTo | Super Grub | VastOnes GMB HowTo | VSIDO
Offline
^Love it Sector! Great job as always!
Thank you, yours is mighty fine as well.
And you reminded my I forgot the code, thanks for that.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat