SEARCH

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

You are not logged in.

#776 2012-11-04 20:12:08

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Last edited by Sector11 (2012-11-04 20:25:26)

Offline

Be excellent to each other!

#777 2012-11-05 00:32:31

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Offline

#778 2012-11-05 02:43:16

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

Re: weather in conky (LUA scripts) updated 12/26/13!

--image({x=25,y=imgy,file=weather_icon[2]})
image({x=25,y=imgy,file=moon_icon[1]})

Last edited by Sector11 (2012-11-05 03:11:31)

Offline

#779 2012-11-05 02:49:46

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Last edited by mrpeachy (2012-11-05 02:50:01)

Offline

#780 2012-11-05 03:09:02

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Offline

#781 2012-11-05 03:30:30

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

Re: weather in conky (LUA scripts) updated 12/26/13!

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

Offline

#782 2012-11-05 03:47:11

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Starting that conky in a terminal produces no errors, do I started it in debug mode.

Any of this make sense:

 05 Nov 12 | 00:42:37 ~
         $ conky -c /media/5/Conky/S11_v9_R.conky &
[1] 24145

 05 Nov 12 | 00:43:10 ~
         $ Conky: desktop window (260) is root window
Conky: window type - normal
Conky: drawing to created window (0x1a00001)
Conky: drawing to double buffer
gathering data with curl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 70928  100 70928    0     0  68896      0  0:00:01  0:00:01 --:--:--   98k
not checking for alerts
processing complete
Conky: received SIGINT or SIGTERM to terminate. bye!

[1]+  Done                    conky -c /media/5/Conky/S11_v9_R.conky

 05 Nov 12 | 00:43:32 ~
         $ conky -c /media/5/Conky/S11_v9_R.conky -D &
[1] 24166

 05 Nov 12 | 00:43:44 ~
         $ DEBUG(0) [../../src/conky.c:5338]: reading contents from config file '/media/5/Conky/S11_v9_R.conky'
Conky: desktop window (260) is root window
Conky: window type - normal
Conky: drawing to created window (0x1a00001)
Conky: drawing to double buffer
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '0 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '3 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '3 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '1 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '2 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '9 < 10'
gathering data with curl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 70928  100 70928    0     0  77718      0 --:--:-- --:--:-- --:--:-- 97161
not checking for alerts
processing complete
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '0 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '7 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '7 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '4 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '6 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '9 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '48 < 100'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 10'
DEBUG(0) [../../src/conky.c:1300]: parsed arg into '32 < 100'
{keeps on repeating}

Offline

#783 2012-11-05 04:03:44

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

Re: weather in conky (LUA scripts) updated 12/26/13!

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

Offline

#784 2012-11-05 04:49:14

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

Re: weather in conky (LUA scripts) updated 12/26/13!

--image({x=25,y=imgy,file=weather_icon[2]})
--image({x=25,y=imgy,file=moon_icon[1]})
image ({x=25,y=imgy,file="/home/sector11/v9000/additional_files/weathericons/moon_waning_gibbous.png"})

Last edited by Sector11 (2012-11-05 04:49:49)

Offline

#785 2012-11-05 17:13:51

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

Re: weather in conky (LUA scripts) updated 12/26/13!

local weathericons="/media/5/Conky/images/weathericons/"

Offline

#786 2012-11-05 18:14:49

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

Re: weather in conky (LUA scripts) updated 12/26/13!

*kicks sector11 in his royal behind*

Offline

#787 2012-11-05 19:09:13

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Offline

#788 2012-11-07 19:57:39

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

Re: weather in conky (LUA scripts) updated 12/26/13!

function out(tx)--##############################################################
--#############################
--additional face settings
face=nil
face=(tx.face or default_face)  -- old is: face=(tx.face or "normal")
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################################################################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)
f=nil
f=(tx.f or default_font)
fs=nil
fs=(tx.fs or default_font_size)
x=nil
x=(tx.x or 0)
y=nil
y=(tx.y or 0)
txt=nil
txt=(tx.txt or "set txt")
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_set_font_size (cr, fs)
cairo_set_source_rgba (cr,col(c,a))
cairo_move_to (cr,x,y)
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--function out ##############################################################

Last edited by Sector11 (2012-11-07 19:58:05)

Offline

#789 2012-11-07 20:12:48

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

Re: weather in conky (LUA scripts) updated 12/26/13!

oops... another oversight on my part im afraid

you need to move the lines that set f above the lines that set face

it is like this

--#############################
--additional face settings
face=nil
face=(tx.face or default_face)
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)
f=nil
f=(tx.f or default_font)

should be like this

--font needs to be set first #########
f=nil
f=(tx.f or default_font)
--#############################
--additional face settings
face=nil
face=(tx.face or default_face)
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)

Offline

#790 2012-11-07 20:34:18

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Last edited by Sector11 (2012-11-08 00:13:19)

Offline

#791 2012-11-07 21:46:13

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

Re: weather in conky (LUA scripts) updated 12/26/13!

this is one thing that you have to watch out for when writing lua for conky
the way that variables "hang around"

i have often been working on a script as it is running in conky, everything seems to be working fine, then on conky restart nil errors!

Offline

#792 2012-11-08 00:47:48

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

Re: weather in conky (LUA scripts) updated 12/26/13!

# killall conky && conky -c /media/5/Conky/S11_Chronograph.conky &

Offline

#793 2012-11-16 23:39:47

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

@MrPeachy, (or anyone... smile )

I am working on a V9000 for a freind who wants to see weather for two cities (not at the same time) and was wondering if you might help me with this. Here is the template I want to use:

click_start=1
weatherbutton=0
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_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="DroidSans"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=5--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--start clickfunction and resturn coordinates
localx,localy=clickfunction()
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
--####################################
--MAIN WEATHER BUTTON ################
--####################################
--weatherbutton button
local weatherbuttonx=10.5
local weatherbuttony=5.5
local weatherbuttonw=45
local weatherbuttonh=45
--calculate if click was inside box
if localx>=weatherbuttonx and localx<=weatherbuttonx+weatherbuttonw and localy>=weatherbuttony and localy<=weatherbuttony+weatherbuttonh and weatherbutton~=1 then 
weatherbutton=1 
elseif localx>=weatherbuttonx and localx<=weatherbuttonx+weatherbuttonw and localy>=weatherbuttony and localy<=weatherbuttony+weatherbuttonh and weatherbutton==1 then 
weatherbutton=0
end
if weatherbutton==0 then
alsx=15
alsy=75
out ({c=0x71A1DF,f="DroidSans",fs=11,x=weatherbuttonx+45,y=weatherbuttony+8,txt=now["conditions"]})
out ({c=0x2C3949,f="DroidSans:bold",fs=24,x=weatherbuttonx+44,y=weatherbuttony+32,txt=now["temp"].."°"})
out ({c=0x6f99b4,f="DroidSans:bold",fs=24,x=weatherbuttonx+43,y=weatherbuttony+31,txt=now["temp"].."°"})
out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+45,y=weatherbuttony+43,txt="Feels Like: "})
  out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+92,y=weatherbuttony+43,txt=now["temp"].."°"})
image({x=weatherbuttonx,y=weatherbuttony+2,h=40,w=40,file=now["weather_icon"]})
out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=weatherbuttonx,y=weatherbuttony+60,txt=weather_location})
end
--###########################################################
--THIS SECTION TURNED ON BY MAIN WEATHER BUTTON #############
--###########################################################
if weatherbutton==1 then
out ({c=0xFFFFFF,f="DroidSans",fs=11,x=weatherbuttonx+45,y=weatherbuttony+8,txt=now["conditions"]})
out ({c=0xFAFAEC,f="DroidSans:bold",fs=24,x=weatherbuttonx+44,y=weatherbuttony+32,txt=now["temp"].."°"})
out ({c=0x48D1CC,f="DroidSans:bold",fs=24,x=weatherbuttonx+43,y=weatherbuttony+31,txt=now["temp"].."°"})
out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+45,y=weatherbuttony+43,txt="Feels Like: "})
  out ({c=0xFFFFFF,f="DroidSans",fs=10,x=weatherbuttonx+92,y=weatherbuttony+43,txt=now["temp"].."°"})
image({x=weatherbuttonx,y=weatherbuttony+2,h=40,w=40,file=now["weather_icon"]})
out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=weatherbuttonx,y=weatherbuttony+60,txt=weather_location})

--Display Weather Information
x1=15--Start of column 1 (Data Label)
x2=85--Start of column 2 (Data)
x3=140--Start of column 3 (Data Label)
x4=200--Start of column 4 (Data)
ypos=85
yypos=12
gap=15

--image({x=x1-7,y=ypos-12,h=210,w=260,file="~/.conky/NightDrive/images/1_pixel/bk_20.png"})
--data titles
  --output of data options
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos,txt="Wind Chill:"})
  out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=x2,y=ypos,txt=now["wind_chill"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos,txt="Heat Index:"})
  out({c=0xFF8C00,a=1,f="DroidSans",fs=11,x=x4,y=ypos,txt=now["heat_index"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*1),txt="Today's Hi:"})
  out({c=0xFF8C00,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*1),txt=high_temp[1].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*1),txt="Today's Lo:"})
  out({c=0x00BFFF,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*1),txt=low_temp[1].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*2),txt="Dew Point:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*2),txt=now["dew_point"].."°"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*2),txt="Humidity:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*2),txt=now["humidity"].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*3),txt="Pressure:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*3),txt=round((now["pressure_mb"]*0.0295301), 2).."\""})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*4),txt="Wind:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*4),txt=now["wind_nesw"].." @ "..now["wind_mph"]..", ".."gusting to: "..now["wind_gusts"]})
ypos=ypos+2
yypos=12
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*5),txt="Visibility:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*5),txt=now["visibility"]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*5),txt="Ceiling:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*5),txt=now["ceiling"]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*6),txt="Cloud Cover:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*6),txt=cloud_cover[1].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*6),txt="UV Index:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*6),txt=uv_index_num[1].." ".."("..uv_index_txt[1]..")"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*7),txt="Chance of Precipitation:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*7),txt=precipitation[1].."%"})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*8),txt="Snow Probability:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*8),txt=snow[1].."%"})
ypos=ypos+2
yypos=12
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*9),txt="Sun Rise:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*9),txt=sun_rise_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*9),txt="Sun Set:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*9),txt=sun_set_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*10),txt="Moon Rise:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*10),txt=moon_rise_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x3,y=ypos+(yypos*10),txt="Moon Set:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x4,y=ypos+(yypos*10),txt=moon_set_lc[1]})
out({c=0xFAFAEC,a=1,f="DroidSans",fs=11,x=x1,y=ypos+(yypos*11),txt="Moon Phase:"})
  out({c=0x48D1CC,a=1,f="DroidSans",fs=11,x=x2,y=ypos+(yypos*11),txt=moon_phase[1]})
  image({x=x4,y=ypos+(yypos*10),h=20,w=20,file=moon_icon[1]})

--next 3 hour forecast button
--next3button button
local next3buttonx=10.5
local next3buttony=230
local next3buttonw=70
local next3buttonh=15
local next3buttononc={1,0,0,1}
local next3buttonoffc={1,1,1,1}
if localx>=next3buttonx and localx<=next3buttonx+next3buttonw and localy>=next3buttony and localy<=next3buttony+next3buttonh and next3button~=1 then next3button=1 elseif localx>=next3buttonx and localx<=next3buttonx+next3buttonw and localy>=next3buttony and localy<=next3buttony+next3buttonh and next3button==1 then next3button=0 end
if next3button==1 then cairo_set_source_rgba (cr,next3buttononc[1],next3buttononc[2],next3buttononc[3],next3buttononc[4]) else cairo_set_source_rgba (cr,next3buttonoffc[1],next3buttonoffc[2],next3buttonoffc[3],next3buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,next3buttonx,next3buttony,next3buttonw,next3buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=next3buttonx+5,y=next3buttony+next3buttonh-4,txt="Next 3 Hours"})font="DroidSans"
--THIS SECTION CONTROLLED BY NEXT3 BUTTON
--set adjustments for forecast buttons when next 3 on or off
if next3button==1 then
fcb=355
alsy=355
fcb1x=10.5
fcb1y=330
n3x=20
nxy=next3buttony+45

--image({x=x1-7,y=ypos-12,h=210,w=260,file="~/.conky/NightDrive/images/1_pixel/bk_20.png"})
--Hour 1
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour1_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour1_time"].." "..now["fc_hour1_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour1_temp"].."°".." / "..now["fc_hour1_cond_short"]})
--Hour 2
n3x=112
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour2_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour2_time"].." "..now["fc_hour2_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour2_temp"].."°".." / "..now["fc_hour2_cond_short"]})
--Hour 3
n3x=200
image({w=30,h=30,x=n3x+15,y=nxy-5,file=now["fc_hour3_wicon"]})--good
out({c=0xFF8C00,x=n3x+18,y=nxy-13,txt=now["fc_hour3_time"].." "..now["fc_hour3_ampm_lc"]})
out({c=0x48D1CC,x=n3x,y=nxy+40,txt=now["fc_hour3_temp"].."°".." / "..now["fc_hour3_cond_short"]})

else
fcb=255
alsy=255
fcb1x=100.5
fcb1y=230
end--next3button

--forecast button
--forecastbutton button
local forecastbuttonx=fcb1x
local forecastbuttony=fcb1y
local forecastbuttonw=100
local forecastbuttonh=15
local forecastbuttononc={1,0,0,1}
local forecastbuttonoffc={1,1,1,1}
if localx>=forecastbuttonx and localx<=forecastbuttonx+forecastbuttonw and localy>=forecastbuttony and localy<=forecastbuttony+forecastbuttonh and forecastbutton~=1 then forecastbutton=1 elseif localx>=forecastbuttonx and localx<=forecastbuttonx+forecastbuttonw and localy>=forecastbuttony and localy<=forecastbuttony+forecastbuttonh and forecastbutton==1 then forecastbutton=0 end
if forecastbutton==1 then cairo_set_source_rgba (cr,forecastbuttononc[1],forecastbuttononc[2],forecastbuttononc[3],forecastbuttononc[4]) else cairo_set_source_rgba (cr,forecastbuttonoffc[1],forecastbuttonoffc[2],forecastbuttonoffc[3],forecastbuttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,forecastbuttonx,forecastbuttony,forecastbuttonw,forecastbuttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=forecastbuttonx+5,y=forecastbuttony+forecastbuttonh-4,txt="Extended Forecast"})font="DroidSans"

if forecastbutton==1 then
alsy=255
--fc2button button
local fc2buttonx=10.5
local fc2buttony=fcb
local fc2buttonw=30
local fc2buttonh=15
local fc2buttononc={1,0,0,1}
local fc2buttonoffc={1,1,1,1}
if localx>=fc2buttonx and localx<=fc2buttonx+fc2buttonw and localy>=fc2buttony and localy<=fc2buttony+fc2buttonh and fc2button~=1 then fc8button=0;fc6button=0;fc4button=0;fc2button=1 elseif localx>=fc2buttonx and localx<=fc2buttonx+fc2buttonw and localy>=fc2buttony and localy<=fc2buttony+fc2buttonh and fc2button==1 then fc2button=0 end
if fc2button==1 then cairo_set_source_rgba (cr,fc2buttononc[1],fc2buttononc[2],fc2buttononc[3],fc2buttononc[4]) else cairo_set_source_rgba (cr,fc2buttonoffc[1],fc2buttonoffc[2],fc2buttonoffc[3],fc2buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc2buttonx,fc2buttony,fc2buttonw,fc2buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc2buttonx+3,y=fc2buttony+fc2buttonh-5,txt="2 Day"})

--fc4button button
local fc4buttonx=10.5+35
local fc4buttony=fcb
local fc4buttonw=30
local fc4buttonh=15
local fc4buttononc={1,0,0,1}
local fc4buttonoffc={1,1,1,1}
if localx>=fc4buttonx and localx<=fc4buttonx+fc4buttonw and localy>=fc4buttony and localy<=fc4buttony+fc4buttonh and fc4button~=1 then fc8button=0;fc6button=0;fc4button=1;fc2button=0 elseif localx>=fc4buttonx and localx<=fc4buttonx+fc4buttonw and localy>=fc4buttony and localy<=fc4buttony+fc4buttonh and fc4button==1 then fc4button=0 end
if fc4button==1 then cairo_set_source_rgba (cr,fc4buttononc[1],fc4buttononc[2],fc4buttononc[3],fc4buttononc[4]) else cairo_set_source_rgba (cr,fc4buttonoffc[1],fc4buttonoffc[2],fc4buttonoffc[3],fc4buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc4buttonx,fc4buttony,fc4buttonw,fc4buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc4buttonx+3,y=fc4buttony+fc4buttonh-5,txt="4 Day"})font="DroidSans"

--fc6button button
local fc6buttonx=10.5+70
local fc6buttony=fcb
local fc6buttonw=30
local fc6buttonh=15
local fc6buttononc={1,0,0,1}
local fc6buttonoffc={1,1,1,1}
if localx>=fc6buttonx and localx<=fc6buttonx+fc6buttonw and localy>=fc6buttony and localy<=fc6buttony+fc6buttonh and fc6button~=1 then fc8button=0;fc6button=1;fc4button=0;fc2button=0 elseif localx>=fc6buttonx and localx<=fc6buttonx+fc6buttonw and localy>=fc6buttony and localy<=fc6buttony+fc6buttonh and fc6button==1 then fc6button=0 end
if fc6button==1 then cairo_set_source_rgba (cr,fc6buttononc[1],fc6buttononc[2],fc6buttononc[3],fc6buttononc[4]) else cairo_set_source_rgba (cr,fc6buttonoffc[1],fc6buttonoffc[2],fc6buttonoffc[3],fc6buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc6buttonx,fc6buttony,fc6buttonw,fc6buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc6buttonx+3,y=fc6buttony+fc6buttonh-5,txt="6 Day"})font="DroidSans"

--fc8button button
local fc8buttonx=10.5+105
local fc8buttony=fcb
local fc8buttonw=30
local fc8buttonh=15
local fc8buttononc={1,0,0,1}
local fc8buttonoffc={1,1,1,1}
if localx>=fc8buttonx and localx<=fc8buttonx+fc8buttonw and localy>=fc8buttony and localy<=fc8buttony+fc8buttonh and fc8button~=1 then fc8button=1;fc6button=0;fc4button=0;fc2button=0 elseif localx>=fc8buttonx and localx<=fc8buttonx+fc8buttonw and localy>=fc8buttony and localy<=fc8buttony+fc8buttonh and fc8button==1 then fc8button=0 end
if fc8button==1 then cairo_set_source_rgba (cr,fc8buttononc[1],fc8buttononc[2],fc8buttononc[3],fc8buttononc[4]) else cairo_set_source_rgba (cr,fc8buttonoffc[1],fc8buttonoffc[2],fc8buttonoffc[3],fc8buttonoffc[4]) end;cairo_set_line_width (cr,1);cairo_rectangle (cr,fc8buttonx,fc8buttony,fc8buttonw,fc8buttonh);cairo_stroke (cr)
out ({f="DroidSans",fs=10,x=fc8buttonx+3,y=fc8buttony+fc8buttonh-4,txt="8 Day"})font="DroidSans"


if fc8button==1 then 
number_of_days=8
alsy=860
elseif fc6button==1 then 
number_of_days=6
alsy=740
elseif fc4button==1 then 
number_of_days=4
alsy=620
elseif fc2button==1 then 
number_of_days=2
alsy=500
else
number_of_days=0
alsy=380
end

else
number_of_days=0
end--if forecast buttonelse


--###########################################################
--start or weather forecast repeat section
--set start forecast day
if number_of_days>0 then--so that section is only active if you want to see it!
start_day=1
--set total forecast days you want to display
topy=fcb+40
ygap=120
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]=20,topy
top_left_x_coordinate[2],top_left_y_coordinate[2]=140,topy
ady=topy+ygap
top_left_x_coordinate[3],top_left_y_coordinate[3]=20,ady
top_left_x_coordinate[4],top_left_y_coordinate[4]=140,ady
ady=topy+ygap+ygap
top_left_x_coordinate[5],top_left_y_coordinate[5]=20,ady
top_left_x_coordinate[6],top_left_y_coordinate[6]=140,ady
ady=topy+ygap+ygap+ygap
top_left_x_coordinate[7],top_left_y_coordinate[7]=20,ady
top_left_x_coordinate[8],top_left_y_coordinate[8]=140,ady
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do--start of day repeat, do not edit ########
local tlx=top_left_x_coordinate[i]--sets top left x position for each repeat ###################
local tly=top_left_y_coordinate[i]--sets top left y position for each repeat ###################
--########################################################################################
out({c=0xFAFAEC,x=tlx,y=tly,txt=forecast_day[i].." \- "..forecast_month_short[i].."\, "..forecast_date[i]})
image({x=tlx,y=tly+5,h=30,w=30,file=weather_icon[i]})
out({c=0xFF8C00,x=tlx+35,y=tly+33,txt=high_temp[i].."°"})
out({c=0xFAFAEC,x=tlx+52,y=tly+33,txt="/"})
out({c=0x00BFFF,x=tlx+60,y=tly+33,txt=low_temp[i].."°"})
out({c=0x48D1CC,x=tlx+35,y=tly+18,txt=conditions_short[i]})
out({c=0xFAFAEC,x=tlx-1,y=tly+50,txt="Chance Precip:"})
  out({c=0x48D1CC,x=tlx+78,y=tly+50,txt=precipitation[i].."%"})
out({c=0xFAFAEC,x=tlx,y=tly+62,txt="Wind:"})
  out({c=0x48D1CC,x=tlx+30,y=tly+62,txt=wind_nesw[i].." @ "..wind_mph[i].." mph"})
out({c=0xFAFAEC,x=tlx,y=tly+74,txt="Sunrise:"})
  out({c=0x48D1CC,x=tlx+55,y=tly+74,txt=sun_rise[i]})
out({c=0xFAFAEC,x=tlx,y=tly+86,txt="Sunset:"})
  out({c=0x48D1CC,x=tlx+55,y=tly+86,txt=sun_set[i]})
--out({c=0xFAFAEC,x=tlx,y=tly+98,txt="Moon:"})
  --out({c=0x48D1CC,x=tlx+30,y=tly+98,txt=moon_phase[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
end--if number_of_days>0

end--OF WEATHER SECTION CONTROLLED BY MAIN WEATHER BUTTON

--ALERTS SECTION
--show alert icon
image({x=alsx,y=alsy,h=15,w=10,file=alert_icon})
--show number of alerts
out({x=alsx+15,y=alsy+15,fs=12,txt=alert_number})
--display alert information
display_alerts=2--set number of alerts to show,set 0 to show all
top_left_alert_x=28--set top left coordinates for entire alerts section
top_left_alert_y=15--^alerts will display in a single column
alert_gap=40--sets the gap between the TOP of one alert and the Top of the next alert
--#######################################################################################################################################
if alert_number==0 then noal=1 elseif alert_number~=0 and display_alerts>alert_number then noal=alert_number else noal=display_alerts end
for i=1,noal do--start of alerts display section. do not edit ###########################################################################
local tlx=alsx+top_left_alert_x--write output relative to tlx #################################
local tly=alsy+top_left_alert_y+((i-1)*alert_gap)--write output relative to tlx ###############
--########################################################################################
out({c=0xffffff,a=1,f="DroidSans",fs=8,x=tlx,y=tly,   txt=alert_type[i]})
out({c=0xffffff,a=1,f="DroidSans",fs=8,x=tlx,y=tly+15,txt=alert_issued[i]})
--########################################################################################
end--of alert display section ############################################################
--########################################################################################]]

--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

function clickfunction()
--start click logging and calculations ##########################################
if click_start==1 then
print (click_start)
click_start=nil
xdot=conky_parse("${if_running xdotool}1${else}0${endif}")
if tonumber(xdot)==1 then
os.execute("killall xdotool && echo 'xdo killed' &")
end
os.execute("xdotool search --name conky_weather behave %@ mouse-click getmouselocation >> /tmp/xdo &")
start=nil
local f = io.popen("xwininfo -name 'conky_weather' | grep 'Absolute'")
geometry = f:read("*a")
f:close()
geometry=string.gsub(geometry,"[\n]","")
s,f,abstlx=string.find(geometry,"X%p%s*(%d*)")
s,f,abstly=string.find(geometry,"Y%p%s*(%d*)")
end--if click_start=1 ######################################
--click calculations #################################
local f=io.open("/tmp/xdo")
click=f:read()
f:close()
if click~=nil then
local f = io.open("/tmp/xdo","w")
f:write("")
f:close() 
end--if click=nil
if click==nil then click="x:0 y:0 " end
s,f,mousex=string.find(click,"x%p(%d*)%s")
s,f,mousey=string.find(click,"y%p(%d*)%s")
mousex=tonumber(mousex)
mousey=tonumber(mousey)
localx=mousex-abstlx
localy=mousey-abstly
--END CLICK CALCULATIONS #################################
return localx,localy
end--function
--rounding function
function round(number, decimal)
	local multiplier = 10^(decimal or 0)
	return math.floor(number * multiplier + 0.5) / multiplier
end

My thoughts are to have  the two city names listed side by side (or...) and clickable. The template, when initially loaded would show the ibnfo for the "home" city. When clicked the template would load the template for the requested city (ie: Detroit & New Orleans) thus displaying the weather for only one city at a time.

Thanks for any help...

DrakarNoir

Offline

#794 2012-11-16 23:53:53

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

Re: weather in conky (LUA scripts) updated 12/26/13!

^this is not possible with v9000 as it currently exists
however, it would be possible to have 2 instances of v9000 running 2 different templates consecutively

you would have to duplicate the v9000 main script and rename it, for example v9001.lua
you would also have to edit some lines in v9001
lines 8 and 9 - you would need a second config file containing the second city location for 9001

package.path = '/home/'..username..'/.v9000_config.lua'
require '.v9000_config'

to

package.path = '/home/'..username..'/.v9001_config.lua'
require '.v9001_config'

so you would have to duplicate the config and rename the duplicate as above

also - line 985
from this:

if processall==0 or testing==1 then
_G.weather_script()
end

to something like this

if processall==0 or testing==1 then
_G.weather_script_9001()
end

then in the template that v9001 is running change line 2 to this

_G.weather_script_9001 = function()--#### DO NOT EDIT THIS LINE ##############

Offline

#795 2012-11-17 00:04:14

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

package.path = '/home/'..username..'/.v9000_config.lua'
require '.v9000_config'

Offline

#796 2012-11-17 00:49:46

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

Re: weather in conky (LUA scripts) updated 12/26/13!

hmm, so you want to be able to select one or the other city's information
and have the info in just one place

certainly possible but not particularly easy smile

if you have ine interactive weather, you could place a button in both templates occupying the same position, click turns one template off and the other on and vice versa

Offline

#797 2012-11-17 00:53:56

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

Last edited by DrakarNoir (2012-11-17 01:09:35)

Offline

#798 2012-11-17 02:11:53

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: weather in conky (LUA scripts) updated 12/26/13!

Offline

#799 2012-11-17 13:01:59

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Watching this with great interest, I am.

Offline

Be excellent to each other!

#800 2012-11-17 17:28:36

falldown
#! Samurai
Registered: 2011-09-01
Posts: 1,727

Re: weather in conky (LUA scripts) updated 12/26/13!

local web="http://www.intellicast.com/Local/Forecast.aspx?unit=F&location=USMO9688"

Needs to added within the button on-off code.. so that location can be changed when the button is activated.

Offline

Board footer

Powered by FluxBB

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

Debian Logo