You are not logged in.
@Teo,
this is verry good. Still, I don't quite understand what you mean (I'm already old) ]:D
Thanks a lot unklar. I wanted to say that I've got a new graphics card and a 3840x2160 (ie. 4K) monitor.
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Offline
@Indian @unklar Thank you for the clarification.
Those Sector11 posts are great, sometimes they are hard to find in the haystack. There are really nice lua-conkys, this weather conky was posted by Sector11 before:
http://postimg.org/image/uz4zqt3k9/
Offline
Thanks, I'll try every draw_bg.lua stuffs when I'll come back, I'm leaving for few days: no more linux tweaking
^come back healthy, you're still needed here!
Thanks a lot unklar. I wanted to say that I've got a new graphics card and a 3840x2160 (ie. 4K) monitor.
^OMG, this is a dream, 4K. I have to see if "my government" can't realize the coming Christmas celebration for Easter already.... ]:D
Those Sector11 posts are great, sometimes they are hard to find in the haystack. There are really nice lua-conkys, this weather conky was posted by Sector11 before:
http://postimg.org/image/uz4zqt3k9/
I have them all, I've studied them all, what the Conky master created.
Offline
^Yeah, those conkys are truly work of art.
Offline
Hello guys
here is a new radiotray conky who does 2 things
1- if there is an artist and a title he will display the name and the title of the song as well as the cover of the album
like this
- if the radio shows "playing"
it will not show anything and will display the radio logo
conkyrc
background yes
use_xft yes
xftfont Liberation Sans:size=7
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 180
maximum_width 200
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment tl
gap_x 10
gap_y 800
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#imlib_cache_flush_interval 60
imlib_cache_size 0
# Taille des pointillés
stippled_borders 5
# Couleurs
default_color ffffff#ffd579
default_shade_color 333333
default_outline_color black
lua_load ~/.conky/lua/image.lua
TEXT
${lua fDrawImage ~/.conky/radiotray/images/caset.png 00 00 150 150}
${voffset 120}${if_match "${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30}" == "Playing"}
${else}${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30 }${endif}
${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30 > ~/.conky/radiotray/artiste_titre.txt}
${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio > ~/.conky/radiotray/logo.txt}
${texeci 5 ~/.conky/radiotray/pochette.sh}${texeci 2 ~/.conky/radiotray/logo.sh}
${if_match "${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30}" == "Playing"}${lua fDrawImage ~/.conky/radiotray/logo.png 19 19 112 112}
${else}${lua fDrawImage ~/.conky/radiotray/pochette.png 19 19 112 112}${endif}
${voffset -1000}
logo.sh
#!bin/bash
# créé par loutch
titre=$(head -1 ~/.conky/radiotray/logo.txt)
lienMiniature=$(wget -U'Googlebot-Image/1.0' -qO - "www.google.fr/search?q=$titre\&tbm=isch" | perl -pe 's!.*?<img .*?src="([^"]*)".*!$1!')
wget -qO Googlelogo $lienMiniature
convert ~/Googlelogo ~/.conky/radiotray/logo.png
pochette.sh
#!bin/bash
#créé par loutch
titre=$(head -1 ~/.conky/radiotray/artiste_titre.txt)
lienMiniature=$(wget -U'Googlebot-Image/1.0' -qO - "www.google.fr/search?q=$titre\&tbm=isch" | perl -pe 's!.*?<img .*?src="([^"]*)".*!$1!')
wget -qO miniatureGoogleImage $lienMiniature
convert ~/miniatureGoogleImage ~/.conky/radiotray/pochette.png
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
I made some headway on my weather conky but now I am stuck. It updates but I have error message that I don't know about. Any help would be very appreciated. Thanks
al@al-X55CR:~$ conky -c ~/wea_conky/Vert-Weather &
[1] 32685
al@al-X55CR:~$ conky: desktop window (1200006) is subwindow of root window (108)
conky: window type - normal
conky: drawing to created window (0x4a00002)
conky: drawing to double buffer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 116k 0 0:00:01 --:--:-- 0:00:01 290k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 116k 0 0:00:01 --:--:-- 0:00:01 486k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 39885 0 0:00:03 0:00:03 --:--:-- 35537
conky: llua_do_call: function conky_weatherdata execution failed: /home/al/wea_conky/forecast_VW.lua:270: attempt to call a nil value
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 116k 0 0:00:01 --:--:-- 0:00:01 404k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 116k 0 0:00:01 --:--:-- 0:00:01 405k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 116k 100 116k 0 0 116k 0 0:00:01 0:00:01 --:--:-- 81788
conky: llua_do_call: function conky_weatherdata execution failed: /home/al/wea_conky/forecast_VW.lua:270: attempt to call a nil value
conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value
conky: llua_do_call: function conky_weather execution failed: [string "return image.now"]:1: attempt to index global 'image' (a nil value)
conky: llua_do_call: function conky_weather execution failed: [string "return image.day1"]:1: attempt to index global 'image' (a nil value)
conky: llua_do_call: function conky_weather execution failed: [string "return moonfont.day1"]:1: attempt to index global 'moonfont' (a nil value)
conky: llua_do_call: function conky_weather execution failed: [string "return image.day2"]:1: attempt to index global 'image' (a nil value)
forecast_VW.lua
--[[weather display by mrpeachy nov 2011
version 6
call data via conkyrc
ability to display weather images
]]
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=1800--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?location=USOH1015"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="F"
--set location where weather data txt will be saved
location="home/al/wea_conky/weather.txt"
--set location of weather images
weathericons="~/weathericons/"
--#########################################################################################################
require 'imlib2'
require 'cairo'
------------------------------------------------------------------------------
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
--------------------------------------------------------------------------------
--###################################
function conky_weatherdata()--#######
--###################################
--table to convert intellicast images to icons and fonts
wimage={
wx_65="32,a",
wx_66="30,c",
wx_67="26,f",
wx_68="32,a",
wx_69="28,d",
wx_70="20,0",
wx_71="32,a",
wx_72="21,9",
wx_73="36,5",
wx_74="14,p",
wx_75="28,d",
wx_76="18,w",
wx_77="14,p",
wx_78="23,6",
wx_79="05,x",
wx_80="15,8",
wx_81="15,8",
wx_82="11,h",
wx_83="16,q",
wx_84="00,m",
wx_85="32,a",
wx_86="25,-",
wx_87="09,h",
wx_88="05,x",
wx_89="18,w",
wx_90="18,w",
wx_91="39,g",
wx_92="39,g",
wx_93="39,g",
wx_94="39,g",
wx_95="37,k",
wx_96="37,k",
wx_97="31,A",
wx_98="29,C",
wx_99="27,D",
wx_100="47,K",
wx_101="47,K",
wx_102="33,B",
wx_103="26,f",
wx_104="20,0",
wx_105="45,G",
wx_106="45,G",
wx_107="11,h",--or 40 if heavy?
wx_108="46,O",
wx_109="46,O",
wx_110="06,x",
wx_111="18,w",
wx_112="06,x",
wx_113="46,O",
wx_114="46,O",
wx_115="31,A",
wx_116="47,K",
}--end table
--table to convert wind direction to font and images
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"}
windicont={S="1",SSW="2",SW="3",WSW="4",W="5",WNW="6",NW="7",NNW="8",N="9",NNE=":",NE=";",ENE="<",E="=",ESE=">",SE="?",SSE="@"}
--table to convert moonphase to font and image
moonfontt={New="=",Full="@",FirstQuarter="G",LastQuarter="T",WaningGibbous="R",WaningCrescent="V",WaxingCrescent="E",WaxingGibbous="I"}
moonicont={New="=",Full="@",FirstQuarter="G",LastQuarter="T",WaningGibbous="R",WaningCrescent="V",WaxingCrescent="E",WaxingGibbous="I"}
--##################################################
--######data gatering and initial processing########
--##################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %secs)+1
if timer==1 or updates==0 then
--gets current data
local f=io.popen("curl '"..web.."' | grep -A62 'As of ' | gawk -F'>' -v RS='</' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e '/^$/d' -e 's/°//g' -e 's/%//g' -e 's/ / /g' -e 's/Thunderstorms/T.Storms/g'")
data1=f:read("*a")
f:close()
local data2=string.split(data1,"\n")
data={}
for i,v in pairs(data2) do
if string.find(v,"[%a%d]")~=nil then
table.insert(data,data2[i])
end
end
--gets forecast data
local f=io.popen("curl '"..web.."' | grep -A554 'View the Calendar Forecast' | gawk -F'>' -v RS='<' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e 's/°//g' -e 's/ / /g' -e 's/%//g' -e 's/°//g' -e 's/Thunderstorms/T.Storms/g'")
local fdata1=f:read("*a")
f:close()
local fdata=string.split(fdata1,"\n")
fdata2={}
for i,v in pairs(fdata) do
if string.find(v,"[%a%d]")~=nil then
table.insert(fdata2,fdata[i])
end
end
--gets weather image codes
local f=io.popen("curl '"..web.."' | gawk -F'App_Images' -v RS='.png' 'RT{print $NF}'")
icondata1=f:read("*a")
f:close()
local icondata=string.split(icondata1,"\n")
icondata2={}
for i,v in pairs(icondata) do
if string.find(v,"32_white")==nil then
table.insert(icondata2,icondata[i])
end
end
--##################################################
--######data processing#############################
--##################################################
--current conditions
local cdn=string.split(data[2],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..string.gsub(cdn[2],"[\r\n]","")
end
local wdr=string.split(data[25]," ")
now={con=string.gsub(cdn[1],"[\r\n]",""),tmp=string.gsub(data[4],units,""),flk=string.gsub(data[5],"Feels Like: ",""),wch=data[7],cel=data[10],hid=data[12],vis=string.gsub(data[15],"[ %a]",""),dpt=data[17],wsp=string.gsub(data[20],"[ %a]",""),wdg=(wdr[1]),wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),wgs=string.gsub(data[30]," mph",""),hum=data[22],prs=string.gsub(data[27],"\"",""),cd2=cd2}
--forecast days
local cdn=string.split(fdata2[3],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[2],",")
local uvi=string.split(fdata2[20]," ")
local wsp=string.split(fdata2[32]," ")
local wdr=string.split(fdata2[34]," ")
day1={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[4],low=fdata2[5],sri=fdata2[8],sst=fdata2[10],mri=fdata2[12],mst=fdata2[14],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[22],ppt=fdata2[24],snw=fdata2[26],cld=fdata2[28],mph=fdata2[30],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day2
local cdn=string.split(fdata2[36],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[35],",")
local uvi=string.split(fdata2[53]," ")
local wsp=string.split(fdata2[65]," ")
local wdr=string.split(fdata2[67]," ")
day2={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[37],low=fdata2[38],sri=fdata2[41],sst=fdata2[43],mri=fdata2[45],mst=fdata2[47],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[55],ppt=fdata2[57],snw=fdata2[59],cld=fdata2[61],mph=fdata2[63],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day3
local start=68
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day3={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day4
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day4={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day5
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day5={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day6
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day6={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day7
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day7={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day8
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day8={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day9
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day9={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--day10
local start=start+29
local cdn=string.split(fdata2[start+1],"/")
if cdn[2]==nil then cd2=""
else
cd2="/"..cdn[2]
end
local dyt=string.split(fdata2[start],",")
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day10={day=dyt[1],dat=string.gsub(dyt[2],"^.",""),con=cdn[1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),cd2=cd2}
--##################################################
--######font and image processing###################
--##################################################
nowif=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[1],"/40_white/",""))()),",")
day1if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[2],"/40_white/",""))()),",")
day2if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[3],"/40_white/",""))()),",")
day3if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[4],"/40_white/",""))()),",")
day4if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[5],"/40_white/",""))()),",")
day5if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[6],"/40_white/",""))()),",")
day6if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[7],"/40_white/",""))()),",")
day7if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[8],"/40_white/",""))()),",")
day8if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[9],"/40_white/",""))()),",")
day9if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[10],"/40_white/",""))()),",")
day10if=string.split((loadstring("return ".."wimage."..string.gsub(icondata2[11],"/40_white/",""))()),",")
---------------------------------------------------
image={now=nowif[1],day1=day1if[1],day2=day2if[1],day3=day3if[1],day4=day4if[1],day5=day5if[1],day6=day6if[1],day7=day7if[1],day8=day8if[1],day9=day9if[1],day10=day10if[1]}
font={now=nowif[2],day1=day1if[2],day2=day2if[2],day3=day3if[2],day4=day4if[2],day5=day5if[2],day6=day6if[2],day7=day7if[2],day8=day8if[2],day9=day9if[2],day10=day10if[2]}
--wind font-----------------------------------------
print ((loadstring("return ".."windfontt."..day1.wdi)()))
windfont={
now=(loadstring("return ".."windfontt."..now.wdi)()),
day1=(loadstring("return ".."windfontt."..day1.wdi)()),
day2=(loadstring("return ".."windfontt."..day2.wdi)()),
day3=(loadstring("return ".."windfontt."..day3.wdi)()),
day4=(loadstring("return ".."windfontt."..day4.wdi)()),
day5=(loadstring("return ".."windfontt."..day5.wdi)()),
day6=(loadstring("return ".."windfontt."..day6.wdi)()),
day7=(loadstring("return ".."windfontt."..day7.wdi)()),
day8=(loadstring("return ".."windfontt."..day8.wdi)()),
day9=(loadstring("return ".."windfontt."..day9.wdi)()),
day10=(loadstring("return ".."windfontt."..day10.wdi)()),
}
--wind image----------------------------------------
windicon={
now=(loadstring("return ".."windicont."..now.wdi)()),
day1=(loadstring("return ".."windicont."..day1.wdi)()),
day2=(loadstring("return ".."windicont."..day2.wdi)()),
day3=(loadstring("return ".."windicont."..day3.wdi)()),
day4=(loadstring("return ".."windicont."..day4.wdi)()),
day5=(loadstring("return ".."windicont."..day5.wdi)()),
day6=(loadstring("return ".."windicont."..day6.wdi)()),
day7=(loadstring("return ".."windicont."..day7.wdi)()),
day8=(loadstring("return ".."windicont."..day8.wdi)()),
day9=(loadstring("return ".."windicont."..day9.wdi)()),
day10=(loadstring("return ".."windicont."..day10.wdi)()),
}
--moon font-----------------------------------------
--print (day1.mph,(loadstring("return ".."moonfontt."..string.gsub(day1.mph," ",""))()))
moonfont={
day1=(loadstring("return ".."moonfontt."..string.gsub(day1.mph," ",""))()),
day2=(loadstring("return ".."moonfontt."..string.gsub(day2.mph," ",""))()),
day3=(loadstring("return ".."moonfontt."..string.gsub(day3.mph," ",""))()),
day4=(loadstring("return ".."moonfontt."..string.gsub(day4.mph," ",""))()),
day5=(loadstring("return ".."moonfontt."..string.gsub(day5.mph," ",""))()),
day6=(loadstring("return ".."moonfontt."..string.gsub(day6.mph," ",""))()),
day7=(loadstring("return ".."moonfontt."..string.gsub(day7.mph," ",""))()),
day8=(loadstring("return ".."moonfontt."..string.gsub(day8.mph," ",""))()),
day9=(loadstring("return ".."moonfontt."..string.gsub(day9.mph," ",""))()),
day10=(loadstring("return ".."moonfontt."..string.gsub(day10.mph," ",""))()),
}
--moon icon-----------------------------------------
moonicon={
day1=(loadstring("return ".."moonicont."..string.gsub(day1.mph," ",""))()),
day2=(loadstring("return ".."moonicont."..string.gsub(day2.mph," ",""))()),
day3=(loadstring("return ".."moonicont."..string.gsub(day3.mph," ",""))()),
day4=(loadstring("return ".."moonicont."..string.gsub(day4.mph," ",""))()),
day5=(loadstring("return ".."moonicont."..string.gsub(day5.mph," ",""))()),
day6=(loadstring("return ".."moonicont."..string.gsub(day6.mph," ",""))()),
day7=(loadstring("return ".."moonicont."..string.gsub(day7.mph," ",""))()),
day8=(loadstring("return ".."moonicont."..string.gsub(day8.mph," ",""))()),
day9=(loadstring("return ".."moonicont."..string.gsub(day9.mph," ",""))()),
day10=(loadstring("return ".."moonicont."..string.gsub(day10.mph," ",""))()),
}
--##################################################
--##writing data to file for conkyrc restart########
--##################################################
local file = io.open(location, "w")
local datastringnow=now.con.."|"..now.tmp.."|"..now.flk.."|"..now.wch.."|"..now.cel.."|"..now.hid.."|"..now.vis.."|"..now.dpt.."|"..now.wsp.."|"..now.wdg.."|"..now.wdi.."|"..now.wgs.."|"..now.hum.."|"..now.prs.."|"..now.cd2
local datastringday1=day1.day.."|"..day1.dat.."|"..day1.con.."|"..day1.hih.."|"..day1.low.."|"..day1.sri.."|"..day1.sst.."|"..day1.mri.."|"..day1.mst.."|"..day1.uvn.."|"..day1.uvt.."|"..day1.hum.."|"..day1.ppt.."|"..day1.snw.."|"..day1.cld.."|"..day1.mph.."|"..day1.wmh.."|"..day1.wkm.."|"..day1.wkt.."|"..day1.wdg.."|"..day1.wdi.."|"..day1.cd2
local datastringday2=day2.day.."|"..day2.dat.."|"..day2.con.."|"..day2.hih.."|"..day2.low.."|"..day2.sri.."|"..day2.sst.."|"..day2.mri.."|"..day2.mst.."|"..day2.uvn.."|"..day2.uvt.."|"..day2.hum.."|"..day2.ppt.."|"..day2.snw.."|"..day2.cld.."|"..day2.mph.."|"..day2.wmh.."|"..day2.wkm.."|"..day2.wkt.."|"..day2.wdg.."|"..day2.wdi.."|"..day2.cd2
local datastringday3=day3.day.."|"..day3.dat.."|"..day3.con.."|"..day3.hih.."|"..day3.low.."|"..day3.sri.."|"..day3.sst.."|"..day3.mri.."|"..day3.mst.."|"..day3.uvn.."|"..day3.uvt.."|"..day3.hum.."|"..day3.ppt.."|"..day3.snw.."|"..day3.cld.."|"..day3.mph.."|"..day3.wmh.."|"..day3.wkm.."|"..day3.wkt.."|"..day3.wdg.."|"..day3.wdi.."|"..day3.cd2
local datastringday4=day4.day.."|"..day4.dat.."|"..day4.con.."|"..day4.hih.."|"..day4.low.."|"..day4.sri.."|"..day4.sst.."|"..day4.mri.."|"..day4.mst.."|"..day4.uvn.."|"..day4.uvt.."|"..day4.hum.."|"..day4.ppt.."|"..day4.snw.."|"..day4.cld.."|"..day4.mph.."|"..day4.wmh.."|"..day4.wkm.."|"..day4.wkt.."|"..day4.wdg.."|"..day4.wdi.."|"..day4.cd2
local datastringday5=day5.day.."|"..day5.dat.."|"..day5.con.."|"..day5.hih.."|"..day5.low.."|"..day5.sri.."|"..day5.sst.."|"..day5.mri.."|"..day5.mst.."|"..day5.uvn.."|"..day5.uvt.."|"..day5.hum.."|"..day5.ppt.."|"..day5.snw.."|"..day5.cld.."|"..day5.mph.."|"..day5.wmh.."|"..day5.wkm.."|"..day5.wkt.."|"..day5.wdg.."|"..day5.wdi.."|"..day5.cd2
local datastringday6=day6.day.."|"..day6.dat.."|"..day6.con.."|"..day6.hih.."|"..day6.low.."|"..day6.sri.."|"..day6.sst.."|"..day6.mri.."|"..day6.mst.."|"..day6.uvn.."|"..day6.uvt.."|"..day6.hum.."|"..day6.ppt.."|"..day6.snw.."|"..day6.cld.."|"..day6.mph.."|"..day6.wmh.."|"..day6.wkm.."|"..day6.wkt.."|"..day6.wdg.."|"..day6.wdi.."|"..day6.cd2
local datastringday7=day7.day.."|"..day7.dat.."|"..day7.con.."|"..day7.hih.."|"..day7.low.."|"..day7.sri.."|"..day7.sst.."|"..day7.mri.."|"..day7.mst.."|"..day7.uvn.."|"..day7.uvt.."|"..day7.hum.."|"..day7.ppt.."|"..day7.snw.."|"..day7.cld.."|"..day7.mph.."|"..day7.wmh.."|"..day7.wkm.."|"..day7.wkt.."|"..day7.wdg.."|"..day7.wdi.."|"..day7.cd2
local datastringday8=day8.day.."|"..day8.dat.."|"..day8.con.."|"..day8.hih.."|"..day8.low.."|"..day8.sri.."|"..day8.sst.."|"..day8.mri.."|"..day8.mst.."|"..day8.uvn.."|"..day8.uvt.."|"..day8.hum.."|"..day8.ppt.."|"..day8.snw.."|"..day8.cld.."|"..day8.mph.."|"..day8.wmh.."|"..day8.wkm.."|"..day8.wkt.."|"..day8.wdg.."|"..day8.wdi.."|"..day8.cd2
local datastringday9=day9.day.."|"..day9.dat.."|"..day9.con.."|"..day9.hih.."|"..day9.low.."|"..day9.sri.."|"..day9.sst.."|"..day9.mri.."|"..day9.mst.."|"..day9.uvn.."|"..day9.uvt.."|"..day9.hum.."|"..day9.ppt.."|"..day9.snw.."|"..day9.cld.."|"..day9.mph.."|"..day9.wmh.."|"..day9.wkm.."|"..day9.wkt.."|"..day9.wdg.."|"..day9.wdi.."|"..day9.cd2
local datastringday10=day10.day.."|"..day10.dat.."|"..day10.con.."|"..day10.hih.."|"..day10.low.."|"..day10.sri.."|"..day10.sst.."|"..day10.mri.."|"..day10.mst.."|"..day10.uvn.."|"..day10.uvt.."|"..day10.hum.."|"..day10.ppt.."|"..day10.snw.."|"..day10.cld.."|"..day10.mph.."|"..day10.wmh.."|"..day10.wkm.."|"..day10.wkt.."|"..day10.wdg.."|"..day10.wdi.."|"..day10.cd2
local datastringfont=font.now.."|"..font.day1.."|"..font.day2.."|"..font.day3.."|"..font.day4.."|"..font.day5.."|"..font.day6.."|"..font.day7.."|"..font.day8.."|"..font.day9.."|"..font.day10
local datastringimage=image.now.."|"..image.day1.."|"..image.day2.."|"..image.day3.."|"..image.day4.."|"..image.day5.."|"..image.day6.."|"..image.day7.."|"..image.day8.."|"..image.day9.."|"..image.day10
local datastringwindfont=windfont.now.."|"..windfont.day1.."|"..windfont.day2.."|"..windfont.day3.."|"..windfont.day4.."|"..windfont.day5.."|"..windfont.day6.."|"..windfont.day7.."|"..windfont.day8.."|"..windfont.day9.."|"..windfont.day10
local datastringwindicon=windicon.now.."|"..windicon.day1.."|"..windicon.day2.."|"..windicon.day3.."|"..windicon.day4.."|"..windicon.day5.."|"..windicon.day6.."|"..windicon.day7.."|"..windicon.day8.."|"..windicon.day9.."|"..windicon.day10
local datastringmoonfont=moonfont.day1.."|"..moonfont.day2.."|"..moonfont.day3.."|"..moonfont.day4.."|"..moonfont.day5.."|"..moonfont.day6.."|"..moonfont.day7.."|"..moonfont.day8.."|"..moonfont.day9.."|"..moonfont.day10
local datastringmoonicon=moonicon.day1.."|"..moonicon.day2.."|"..moonicon.day3.."|"..moonicon.day4.."|"..moonicon.day5.."|"..moonicon.day6.."|"..moonicon.day7.."|"..moonicon.day8.."|"..moonicon.day9.."|"..moonicon.day10
file:write(datastringnow.."<>"..datastringday1.."<>"..datastringday2.."<>"..datastringday3.."<>"..datastringday4.."<>:"..datastringday5.."<>"..datastringday6.."<>"..datastringday7.."<>"..datastringday8.."<>"..datastringday9.."<>"..datastringday10.."<>"..datastringfont.."<>"..datastringimage.."<>"..datastringwindfont.."<>"..datastringwindicon.."<>"..datastringmoonfont.."<>"..datastringmoonicon)
file:close()
end--timed section
--##################################################
--#read written data and process for conyrc restart#
--##################################################
if data1==nil then
local f=io.popen("cat '"..location.."'")
local alldata=f:read("*a")
f:close()
daydata=string.split(alldata,"<>")
now=string.split(daydata[1],"|")
day1=string.split(daydata[2],"|")
day2=string.split(daydata[3],"|")
day3=string.split(daydata[4],"|")
day4=string.split(daydata[5],"|")
day5=string.split(daydata[6],"|")
day6=string.split(daydata[7],"|")
day7=string.split(daydata[8],"|")
day8=string.split(daydata[9],"|")
day9=string.split(daydata[10],"|")
day10=string.split(daydata[11],"|")
font=string.split(daydata[12],"|")
image=string.split(daydata[13],"|")
windfont=string.split(daydata[14],"|")
windicon=string.split(daydata[15],"|")
moonfont=string.split(daydata[16],"|")
moonicon=string.split(daydata[17],"|")
--set individual data points
now={con=now[1],tmp=now[2],flk=now[3],wch=now[4],cel=now[5],hid=now[6],vis=now[7],dpt=now[8],wsp=now[9],wdg=now[10],wdi=now[11],wgs=now[12],hum=now[13],prs=now[14],cd2=now[15]}
day1={day=day1[1],dat=day1[2],con=day1[3],hih=day1[4],low=day1[5],sri=day1[6],sst=day1[7],mri=day1[8],mst=day1[9],uvn=day1[10],uvt=day1[11],hum=day1[12],ppt=day1[13],snw=day1[14],cld=day1[15],mph=day1[16],wmh=day1[17],wkm=day1[18],wkt=day1[19],wdg=day1[20],wdi=day1[21],cd2=day1[22]}
day2={day=day2[1],dat=day2[2],con=day2[3],hih=day2[4],low=day2[5],sri=day2[6],sst=day2[7],mri=day2[8],mst=day2[9],uvn=day2[10],uvt=day2[11],hum=day2[12],ppt=day2[13],snw=day2[14],cld=day2[15],mph=day2[16],wmh=day2[17],wkm=day2[18],wkt=day2[19],wdg=day2[20],wdi=day2[21],cd2=day2[22]}
day3={day=day3[1],dat=day3[2],con=day3[3],hih=day3[4],low=day3[5],sri=day3[6],sst=day3[7],mri=day3[8],mst=day3[9],uvn=day3[10],uvt=day3[11],hum=day3[12],ppt=day3[13],snw=day3[14],cld=day3[15],mph=day3[16],wmh=day3[17],wkm=day3[18],wkt=day3[19],wdg=day3[20],wdi=day3[21],cd2=day3[22]}
day4={day=day4[1],dat=day4[2],con=day4[3],hih=day4[4],low=day4[5],sri=day4[6],sst=day4[7],mri=day4[8],mst=day4[9],uvn=day4[10],uvt=day4[11],hum=day4[12],ppt=day4[13],snw=day4[14],cld=day4[15],mph=day4[16],wmh=day4[17],wkm=day4[18],wkt=day4[19],wdg=day4[20],wdi=day4[21],cd2=day4[22]}
day5={day=day5[1],dat=day5[2],con=day5[3],hih=day5[4],low=day5[5],sri=day5[6],sst=day5[7],mri=day5[8],mst=day5[9],uvn=day5[10],uvt=day5[11],hum=day5[12],ppt=day5[13],snw=day5[14],cld=day5[15],mph=day5[16],wmh=day5[17],wkm=day5[18],wkt=day5[19],wdg=day5[20],wdi=day5[21],cd2=day5[22]}
day6={day=day6[1],dat=day6[2],con=day6[3],hih=day6[4],low=day6[5],sri=day6[6],sst=day6[7],mri=day6[8],mst=day6[9],uvn=day6[10],uvt=day6[11],hum=day6[12],ppt=day6[13],snw=day6[14],cld=day6[15],mph=day6[16],wmh=day6[17],wkm=day6[18],wkt=day6[19],wdg=day6[20],wdi=day6[21],cd2=day6[22]}
day7={day=day7[1],dat=day7[2],con=day7[3],hih=day7[4],low=day7[5],sri=day7[6],sst=day7[7],mri=day7[8],mst=day7[9],uvn=day7[10],uvt=day7[11],hum=day7[12],ppt=day7[13],snw=day7[14],cld=day7[15],mph=day7[16],wmh=day7[17],wkm=day7[18],wkt=day7[19],wdg=day7[20],wdi=day7[21],cd2=day7[22]}
day8={day=day8[1],dat=day8[2],con=day8[3],hih=day8[4],low=day8[5],sri=day8[6],sst=day8[7],mri=day8[8],mst=day8[9],uvn=day8[10],uvt=day8[11],hum=day8[12],ppt=day8[13],snw=day8[14],cld=day8[15],mph=day8[16],wmh=day8[17],wkm=day8[18],wkt=day8[19],wdg=day8[20],wdi=day8[21],cd2=day8[22]}
day9={day=day9[1],dat=day9[2],con=day9[3],hih=day9[4],low=day9[5],sri=day9[6],sst=day9[7],mri=day9[8],mst=day9[9],uvn=day9[10],uvt=day9[11],hum=day9[12],ppt=day9[13],snw=day9[14],cld=day9[15],mph=day9[16],wmh=day9[17],wkm=day9[18],wkt=day9[19],wdg=day9[20],wdi=day9[21],cd2=day9[22]}
day10={day=day10[1],dat=day10[2],con=day10[3],hih=day10[4],low=day10[5],sri=day10[6],sst=day10[7],mri=day10[8],mst=day10[9],uvn=day10[10],uvt=day10[11],hum=day10[12],ppt=day10[13],snw=day10[14],cld=day10[15],mph=day10[16],wmh=day10[17],wkm=day10[18],wkt=day10[19],wdg=day10[20],wdi=day10[21],cd2=day10[22]}
font={now=font[1],day1=font[2],day2=font[3],day3=font[4],day4=font[5],day5=font[6],day6=font[7],day7=font[8],day8=font[9],day9=font[10],day10=font[11]}
image={now=image[1],day1=image[2],day2=image[3],day3=image[4],day4=image[5],day5=image[6],day6=image[7],day7=image[8],day8=image[9],day9=image[10],day10=image[11]}
windfont={now=windfont[1],day1=windfont[2],day2=windfont[3],day3=windfont[4],day4=windfont[5],day5=windfont[6],day6=windfont[7],day7=windfont[8],day8=windfont[9],day9=windfont[10],day10=windfont[11]}
windicon={now=windicon[1],day1=windicon[2],day2=windicon[3],day3=windicon[4],day4=windicon[5],day5=windicon[6],day6=windicon[7],day7=windicon[8],day8=windicon[9],day9=windicon[10],day10=windicon[11]}
moonfont={day1=moonfont[1],day2=moonfont[2],day3=moonfont[3],day4=moonfont[4],day5=moonfont[5],day6=moonfont[6],day7=moonfont[7],day8=moonfont[8],day9=moonfont[9],day10=moonfont[10]}
moonicon={day1=moonicon[1],day2=moonicon[2],day3=moonicon[3],day4=moonicon[4],day5=moonicon[5],day6=moonicon[6],day7=moonicon[7],day8=moonicon[8],day9=moonicon[9],day10=moonicon[10]}
end--if data1==nil
return ""
--#########################################
end--weather data gathering function#######
--#########################################
--#############################################################
function conky_weather(conkydata,xpos,ypos,scale1,scale2)--####
--#############################################################
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)
if xpos==nil then xpos=0 end
if ypos==nil then ypos=0 end
if scale1==nil then scale1=0 end
if scale2==nil then scale2=0 end
--[[data available
--current info.. use now.option
--options
con=conditions summary
cd2=conditions secondary
tmp=temperature
flk=Feels Like
wch=wind chill
cel=ceiling
hid=heat index
vis=visibility
dpt=dew point
wsp=wind speed (in mph)
wdg=wind direction in degrees
wdi=wind direction NSEW
wgs=wind gusts
hum=humidity
prs=pressure
--forecast information, 10 day
--use like this dayX.option (where X=day number (1=today,2=tomorrow))
--options
day=forecast day
dat=forecast date
con=conditions summary
cd2=conditions secondary
hih=high temp
low=low temp
sri=sunrise
sst=sunset
mri=moon rise
mst=moon set
uvi=ultraviolet index
hum=humidity
ppt=chance of precipitation
snw=chance of snow
cld=cloud cover
mph=moon phase
wmh=wind speed in mph
wkm=wind speed in km/h
wkt=wind speed in knots
wdg=wind direction in degrees
wdi=wind direction in nesw
for weather images/icons
${lua weather image.now x y scalex scaley) for current
${lua weather image.dayX x y scalex scaley) where X = 1 to 10
for weather font
${lua weather font.now x y fontsize color) for current
${lua weather font.dayX x y fontsize color) where X = 1 to 10
for wind direction font
${lua weather windfont.now x y fontsize scaley) for current
${lua weather windfont.dayX x y fontsize color) where X = 1 to 10
for moon phase font
no moon phase for current conditions
${lua weather moonfont.dayX x y fontsize color) where X = 1 to 10
]]
---------------------------------------------
--moon font
if string.find(conkydata,"moonfont")~=nil then
local function rgb_to_r_g_b(color)
return ((color/0x10000) % 0x100)/255,((color/0x100) % 0x100)/255,(color % 0x100)/255,1
end
wfont="Moon Phases"
fsize=scale1
text=(loadstring("return "..conkydata)())
cairo_select_font_face (cr, wfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr ,rgb_to_r_g_b(scale2))
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
conkydata=""
end--moon font
--wind font
if string.find(conkydata,"windfont")~=nil then
local function rgb_to_r_g_b(color)
return ((color/0x10000) % 0x100)/255,((color/0x100) % 0x100)/255,(color % 0x100)/255,1
end
wfont="ConkyWindNESW"
fsize=scale1
text=(loadstring("return "..conkydata)())
cairo_select_font_face (cr, wfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr ,rgb_to_r_g_b(scale2))
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
conkydata=""
end--wind font
--weather font comes last as will match windfont and moonfont
if string.find(conkydata,"font")~=nil then
local function rgb_to_r_g_b(color)
return ((color/0x10000) % 0x100)/255,((color/0x100) % 0x100)/255,(color % 0x100)/255,1
end
wfont="ConkyWeather"
fsize=scale1
text=(loadstring("return "..conkydata)())
cairo_select_font_face (cr, wfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr ,rgb_to_r_g_b(scale2))
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
conkydata=""
end--weather font
--weather image
if string.find(conkydata,"image")~=nil then
file=weathericons..(loadstring("return "..conkydata)())..".png"
imageshow(file,xpos,ypos,scale1,scale2)
conkydata=""
end--weather image
---------------------------------------------
if (loadstring("return " .. conkydata)())~=nil then
output=(loadstring("return " .. conkydata)())
else
output=""
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return output
end--main function
function imageshow(file,center_x,center_y,w,h)
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=center_x-(width/2)
local idown=center_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
Vert-Weather
conky.config = {
-- To use #! in a conky use: ${exec echo '#!'}
-- conky -c ~/wea_conky/Vert-Weather &
-- Created by Sector11 ###
-- Begin Window Settings #
-- Create own window instead of using desktop (required in nautilus)
own_window = true,
own_window_type = 'normal',
own_window_transparent = true,
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',--sticky,
--own_window_colour black
own_window_class = 'Forecast Conky',
own_window_title = 'Forecast 6-2 by MrP',
-- Use the Xdbe extension? (eliminates flicker)
-- It is highly recommended to use own window with this one
-- so double buffer won't be so big.
double_buffer = true,
-- ARGB can be used for real transparency
-- NOTE that a composite manager is required for real transparency.
-- This option will not work as desired (in most cases) in conjunction with
-- 'own_window_type override'
own_window_argb_visual = true,
-- When ARGB visuals are enabled, this use this to modify the alpha value
-- Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
-- own_window_argb_value 0
minimum_width = 195, minimum_height = 0,
maximum_width = 195,
gap_x = 10,
gap_y = 10,
alignment = 'bottom_right',
-- End Window Settings #
-- Font Settings #
-- Use Xft (anti-aliased font and stuff)
use_xft = true,
font = 'Anonymous Pro:size=9',
-- Alpha of Xft font. Must be a value at or between 1 and 0 #
xftalpha = 0,
-- Force UTF8? requires XFT #
override_utf8_locale = true,
draw_shades = false,
default_shade_color = 'black',
draw_outline = false,
default_outline_color = 'black',
uppercase = false,
-- End Font Settings #
-- Color Settings #
default_shade_color = 'grey',
default_outline_color = 'black',
default_color = '#DCDCDC',--Gainsboro
color0 = '#778899',--LightSlateGrey
color1 = '#BA55D3',--MediumOrchid
color2 = '#7FFFD4',--Aquamarine
color3 = '#C6FF8E',--Light Green
color4 = '#F08080',--LightCoral
color5 = '#FFDEAD',--NavajoWhite
color6 = '#00BFFF',--DeepSkyBlue
color7 = '#48D1CC',--MediumTurquoise
color8 = '#FFFF00',--Yellow
color9 = '#FF0000',--Red
-- End Color Settings #
-- Borders Section #
draw_borders = false,
-- Stippled borders?
stippled_borders = 0,
-- border margins
border_inner_margin = 10,
border_outer_margin = 0,
-- border width
border_width = 0,
-- graph borders
draw_graph_borders = false,
-- End Borders Secton #
-- Miscellaneous Section #
-- Boolean value, if true, Conky will be forked to background when started.
background = false,
-- Adds spaces around certain objects to stop them from moving other things
-- around, this only helps if you are using a mono font
-- Options: right, left or none
use_spacer = 'none',
text_buffer_size = 256,
-- Subtract (file system) buffers from used memory?
no_buffers = true,
-- change GiB to G and MiB to M
short_units = true,
pad_percents = 2,
-- End Miscellaneous Section #
-- LUA Settings #
lua_load = '~/wea_conky/draw_bg.lua',
lua_load = '~/wea_conky/forecast_VW.lua',
lua_draw_hook_pre = 'weatherdata',
-- End LUA Settings #
update_interval = 2,
};
conky.text = [[
${lua conky_draw_bg 15 0 0 0 0 0x000000 0.4}${color6}${lua weather day1.day}${goto 100}${color2} Low ${lua weather day1.low}° ${font}${color white}/ ${color4}Hi ${lua weather day1.hih}°${color}
${goto 50}Now ${font Zekton:size=16}${color6}${lua weather now.tmp}° ${color5}/ ${voffset -10}${font}FL ${font Zekton:size=16}${color6}${lua weather now.flk}°${color}${font}\
${lua weather image.now 50 80 60 60}
${goto 100}${color7} Humidity:${color} ${lua weather now.hum}%
${goto 100}${color7} Dew Point:${color} ${lua weather now.dpt}°
${goto 100}${color7}Wind Chill:${color} ${lua weather now.wch}°
${goto 100}${color7}Heat Index:${color} ${lua weather now.hid}°
${color7}Ceil:${color} ${lua weather now.cel}${goto 100}${color7}Visibility:${color} ${lua weather now.vis}
${color7}Wind:${color} ${lua weather now.wsp} mph ${color7}@${color} ${lua weather now.wdg}° ${color7}(${color}${lua weather now.wdi}${color7})${color}
${color7}Barometer:${color} ${lua weather now.prs} ${color7}Gusts:${color} ${lua weather now.wgs}${color}
${color7}Phase: ${color}${lua weather day1.mph}
${font Zekton:size=16}${color}${lua weather now.con}${font}
${color5}Today's Forecast ${hr}${color}${lua weather image.day1 30 240 35 35}
${goto 50}${color7}Precip:${color}${lua weather day1.ppt}% ${goto 130}${color7}Cloud: ${color}${lua weather day1.cld}%
${goto 55}${color7} UVI: ${color}${lua weather day1.uvn} (${lua weather day1.uvt})
${goto 55}${color7} Sun: ${color5}${lua weather day1.sri} ${color0}${lua weather day1.sst}
${goto 55}${color7}Moon: ${color5}${lua weather day1.mri} ${color0}${lua weather day1.mst}${color}
${lua weather moonfont.day1 20 280 20 0xFFFFFF}${goto 55}${color}${lua weather day1.mph}
${stippled_hr 2}
${color6}${lua weather day2.day}${goto 120}${lua weather day3.day}
${color2}${lua weather day2.low}° <${color4}> ${lua weather day2.hih}°${color}\
${goto 120}${color2}${lua weather day3.low}° <${color4}> ${lua weather day3.hih}°\
${lua weather image.day2 45 355 35 35}${lua weather image.day3 155 355 35 35}
${color6}${lua weather day4.day}${goto 120}${lua weather day5.day}
${color2}${lua weather day4.low}° <${color4}> ${lua weather day4.hih}°${color}\
${goto 120}${color2}${lua weather day5.low}° <${color4}> ${lua weather day5.hih}°\
${lua weather image.day4 45 425 35 35}${lua weather image.day5 155 425 35 35}
${color6}${lua weather day6.day}${goto 120}${lua weather day7.day}
${color2}${lua weather day6.low}° <${color4}> ${lua weather day6.hih}°${color}\
${goto 120}${color2}${lua weather day7.low}° <${color4}> ${lua weather day7.hih}°\
${lua weather image.day6 45 500 35 35}${lua weather image.day7 155 500 35 35}
${color6}${lua weather day8.day}${goto 120}${lua weather day9.day}
${color2}${lua weather day8.low}° <${color4}> ${lua weather day8.hih}°${color}\
${goto 120}${color2}${lua weather day9.low}° <${color4}> ${lua weather day9.hih}°\
${lua weather image.day8 45 575 35 35}${lua weather image.day9 155 575 35 35}
${color}${hr}
#${execpi 1800 conkyForecast -i --location=340044 --template=/media/DATEN/Abgleich/Conky/Sector11/wea_conky/vert.template}
#+- Updated: ${execpi 120 conkyForecast --datatype=LU}
#+- Fetched: ${execpi 120 conkyForecast --datatype=LF}
]];
draw_bg.lua
--[[Background originally by londonali1010 (2009)
ability to set any size for background mrpeachy 2011
ability to set variables for bg in conkyrc dk75
the change is that if you set width and/or height to 0
then it assumes the width and/or height of the conky window
so:
lua_load ~/wea_conky/draw_bg.lua
TEXT
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}
See below: 1 2 3 4 5 6 7
${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
covers the whole window and will change if you change the minimum_size setting
1 = 20 corner_radius
2 = 0 x_position
3 = 0 y_position
3 = 0 width
5 = 0 height
6 = 0x000000 color
7 = 0.4 alpha
]]
require 'cairo'
local cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
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))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
Offline
My last one had too much empty space, so I made a new one.
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Offline
I made some headway on my weather conky but now I am stuck. It updates but I have error message that I don't know about. Any help would be very appreciated. Thanks
Do you have the images in ~/weathericons/?
Offline
Trying the lua script the problem could be that something in the weather page has changed.
Offline
It updates fine and I do have the weather icons in ~/weathericons.
Offline
https://forums.bunsenlabs.org/viewtopic … 124#p68124
@loutch,
Thank you for sharing.
I like it very much, because of the bigger picture. In the configuration I had to adjust this line because the autostart was not done with the system.
${texeci 2 $HOME/.conky/radiotray/logo.sh}${texeci 5 $HOME/.conky/radiotray/pochette.sh}
The channel logo only works for as long as the channel is running. If I turn off radiotray, the logo.sh-script takes the "general Google image" (according to
~/.conky/radiotray/images no picture is stored).
If you want to test it, here's my channel:
http://stream.srg-ssr.ch/m/rsp/mp3_128
http://www.radioswisspop.ch/en
Last edited by unklar (2018-02-13 16:34:45)
Offline
Hello
@ unklar
i don't have this problem because i use a script too call-kill the conky & radiotray with a shortcut in my Xbar
first clic open conky & radiotray
choose any station & listen
second clic kill conky & radiotray
so the conky & radiotray are killed together
Maybe modifiy the conkyrc like this
${if_running radiotray}
${lua fDrawImage ~/.conky/radiotray/images/caset.png 00 00 150 150}
${voffset 120}${if_match "${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30}" == "Playing"}
${else}${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30 }${endif}
${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30 > ~/.conky/radiotray/artiste_titre.txt}
${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray net.sourceforge.radiotray.getCurrentRadio > ~/.conky/radiotray/logo.txt}
${texeci 5 ~/.conky/radiotray/pochette.sh}${texeci 2 ~/.conky/radiotray/logo.sh}
${if_match "${execi 5 qdbus net.sourceforge.radiotray /net/sourceforge/radiotray getCurrentMetaData| fold -s -w30}" == "Playing"}${lua fDrawImage ~/.conky/radiotray/logo.png 19 19 112 112}
${else}${lua fDrawImage ~/.conky/radiotray/pochette.png 19 19 112 112}${endif}${else}
Radiotray not running${endif}
After "${else}"radiotray not running" you can put something else or any image .
@+
Last edited by loutch (2018-02-14 09:03:15)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
It updates fine and I do have the weather icons in ~/weathericons.
Do you have icons in the day 1 and 2 of the forecast?
Offline
first clic open conky & radiotray
choose any station & listen
second clic kill conky & radiotray
^ Hello,
that does the trick!
Merci beaucoup, loutch.
Offline
Alpetjr wrote:It updates fine and I do have the weather icons in ~/weathericons.
Do you have icons in the day 1 and 2 of the forecast?
When I start it up none of the current weather appear, with no icons. When I close the terminal the current weather disappears. The template is showing, but nothing else.
Offline
This is because the page where it takes the data has changed. The best solution is to use another weather forecast lua script and modiofy it to something you like.
Offline
Any chance you could post your weather code? Every time try to get some weather code to work I run into a invisible wall and I have nothing but problems. Thanks
Offline
conkyrc
conky.config = {
--Use XFT?
use_xft = true,
font = 'caviar dreams:size=10',
xftalpha = 0.8,
text_buffer_size = 2048,
max_text_width = 0,
override_utf8_locale = true,
uppercase = false,
no_buffers = true,
short_units = true,
format_human_readable = true,
-- Like it says, ot pads the decimals on % values
-- doesn't seem to work since v1.7.1
pad_percents = 2,
-- Update interval in seconds
update_interval = 1,
-- This is the number of times Conky will update before quitting.
-- Set to zero to run forever.
total_run_times = 0,
-- Create own window instead of using desktop (required in nautilus)
own_window = true,
own_window_transparent = true,
own_window_type = 'desktop',
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
own_window_argb_visual = true,
own_window_argb_value = 255,
background = true,
use_spacer = 'none',
-- Use double buffering (reduces flicker, may not work for everyone)
double_buffer = true,
-- Minimum size of text area -adjust if you would like to user smaller fonts etc.
minimum_width = 450, minimum_height = 570,
--maximum_width = 465,
--max_specials = '1024',
max_user_text = 16384,
--default_bar_size 215 5
-- Desired output unit of all objects displaying a temperature. Parameters are
-- either "fahrenheit" or "celsius". The default unit is degree Celsius.
temperature_unit = 'fahrenheit',
-- Draw shades?
draw_shades = false,
default_shade_color = '#000000',
-- Draw outlines?
draw_outline = false,
default_outline_color = '#000000',
--## Color Settings
default_color = 'b2b2b2',
color0 = '555555',
color1 = '483D8B', -- Dark Slate Blue
color2 = 'B8860B', -- Dark goldenrod
color3 = '#7FFF00',--127 255 0 Chartreuse
color4 = '8B0000', -- Dark red
color5 = '008080', -- Teal
color6 = '99ccff', -- Gray20
color7 = 'C8C8FF', -- (COOL)
color8 = 'FFFFCC', -- (WARM)
color9 = 'FCCCCC', -- (HOT)
-- Draw borders around text
draw_borders = false,
-- Stippled borders?
stippled_borders = 0,
-- border margins
border_inner_margin = 10,
border_outer_margin = 0,
-- border width
border_width = 1,
-- graph borders
draw_graph_borders = false,--no
--default_graph_size 15 40
--show_graph_range = false,
--show_graph_scale = false,
-- Text alignment, other possible values are commented
--alignment = 'top_left',
alignment = 'top_right',
--alignment = 'top_middle',
--alignment = 'bottom_left',
--alignment = 'bottom_right',
--alignment = 'bottom_middle',
-- Gap between borders of screen and text
-- same thing as passing -x at command line
gap_x = 13,
gap_y = 20,
-- -- Lua Load -- #
lua_load = '~/.draw-bg.lua',
-- ${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
--lua_draw_hook_pre = 'draw_bg 20 0 0 0 0 0x000000 0.2'
--lua_draw_hook_post = 'draw_bg 20 0 0 0 0 0x000000 0.2',
-- -- Album art fix -- #
imlib_cache_size = 0,
template0 = [[
${font Neuropolitical:bold:size=8}${color7}\1 ${font}${hr 2}${font}${color8}]],
template1 = [[
${color8}$\1]],
template2 = [[
${color8}\1${color8} \2]],
-- ASCII Characters
-- │ ─ ┌ ┬ ┐ └ ┴ ┘ ├ ┼ ┤
-- ║ ═ ╔ ╦ ╗ ╚ ╩ ╝ ╠ ╬ ╣
-- ↑ ↓ → ← ↔ ► ◄ ▲ ▼ « »
-- ░ ▒ ▓ ☺ ☻ ♥ ♦ ♣ ♠
-- • ◘ ○ ◙ ♂ ♀ ♪ ♫ ☼
-- ¼ ½ ¾ ® ©
lua_load = '~/conky-conf/weather/launcher.lua',
lua_draw_hook_post = 'main',
};
conky.text = [[
${texeci 500 bash $HOME/1_accuweather/1_accuweather -f2015}
${voffset -15}${execpi 600 sed -n '1p' $HOME/1_accuweather/first_days} ${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -c1-20}${execpi 600 sed -n '5p' $HOME/1_accuweather/first_days|cut -c21-40} ${execpi 600 sed -n '3p' $HOME/1_accuweather/first_days}°/${execpi 600 sed -n '4p' $HOME/1_accuweather/first_days}°
#### Prelier cadre ####
${voffset 10}${font 7LED :size=55:style=Medium}${color 808080}${goto 20}${time %I}${goto 130}${time %M}${font 7LED :size=20:style=Medium}${color 808080}${goto 235}${time %S}$font
#### Date ####
${voffset -30}${color white}${font caviar dreams:size=9}${alignc -120}${time %A, %d %B %Y}$font
### vent ####
${voffset 10}
${goto 310}${font caviar dreams:size=10}Wind D : ${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond}
${goto 310}Wind S : ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}
${goto 310}Pressure : ${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond}
${goto 310}Index UV : ${execi 90 sed -n '9p' $HOME/1_accuweather/curr_cond}${alignr}Dp: ${color8}${execpi 300 sed -n '12p' $HOME/1_accuweather/curr_cond}° $font
#### Ville ####
${voffset -40}${font caviar dreams:size=13}${execi 90 sed -n '4p' $HOME/1_accuweather/curr_cond}${font}
Temp.: ${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond} °F Feels.: ${execi 90 sed -n '3p' $HOME/1_accuweather/curr_cond} °F
#### Deuxième cadre ####
##### Affichage temperatures #####
${voffset 20}
${goto 20}${color7}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}°${color}\
${goto 95}${color7}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}°${color}\
${goto 170}${color7}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}°${color}\
${goto 245}${color7}${execi 90 sed -n '24p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '23p' $HOME/1_accuweather/first_days}°${color}\
${goto 320}${color7}${execi 90 sed -n '4p' $HOME/1_accuweather/last_days}°${color}/${color9}${execi 90 sed -n '3p' $HOME/1_accuweather/last_days}°${color}\
${goto 400}${color7}${execi 90 sed -n '9p' $HOME/1_accuweather/last_days}°${color}/${color9}${execi 90 sed -n '8p' $HOME/1_accuweather/last_days}°${color}
#### Affichage date ####
${voffset 40}
${goto 20}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="1 day" | awk '{print $3}'`}\
${goto 95}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $3}'`}\
${goto 170}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $3}'`}\
${goto 245}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $3}'`}\
${goto 320}${execi 3600 echo `date --date="5 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="5 day" | awk '{print $3}'`}\
${goto 400}${execi 3600 echo `date --date="6 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="6 day" | awk '{print $3}'`}
${execpi 90 ~/conky-conf/weather/alert.sh}
#### premier cadre ####
${lua conky_draw_bg 20 0 0 0 180 0x000000 0.6}
${lua conky_draw_bg 20 0 185 0 145 0x000000 0.6}
${lua conky_draw_bg 20 0 340 0 250 0x000000 0.6}
#${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 40 450 110}
#${lua fDrawImage ~/conky-conf/weather/flip_bg.png 9 25 110 100}
#${lua fDrawImage ~/conky-conf/weather/flip_bg.png 119 25 110 100}
#### Second cadre ####
#${image ~/conky-conf/weather/flip_bg.png -p 0,20 -s 100x90}
#${image ~/conky-conf/weather/flip_bg.png -p 120,20 -s 100x90}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_0.png 175 115 132 70}
${lua fDrawImage ~/1_accuweather/forecast_2015/wind_0.png 385 70 90 90}
#${image $HOME/1_accuweather/forecast_2015/forecast_0.png -p 170,100 -s 132x70}
#${image $HOME/1_accuweather/forecast_2015/wind_0.png -p 385,55 -s 90x90}
#### icônes Second ####
${texeci 500 bash $HOME/4_Moon/moon_MoonGiant}${lua fDrawImage ~/4_Moon/0.png 390 10 60 60}
#${image $HOME/1_accuweather/forecast_2015/forecast_1.png -p 350,0 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_2.png -p -5,195 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_3.png -p 70,195 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_4.png -p 145,195 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_5.png -p 220,195 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_6.png -p 295,195 -s 90x54}
#${image $HOME/1_accuweather/forecast_2015/forecast_7.png -p 375,195 -s 90x54}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_1.png 300 20 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_2.png 0 210 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_3.png 70 210 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_4.png 145 210 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_5.png 220 210 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_6.png 295 210 90 55}
${lua fDrawImage ~/1_accuweather/forecast_2015/forecast_7.png 375 210 90 55}
#${voffset -220}
]];
draw_bg.lua
--[[Background originally by londonali1010 (2009)
ability to set any size for background mrpeachy 2011
ability to set variables for bg in conkyrc dk75
the change is that if you set width and/or height to 0
then it assumes the width and/or height of the conky window
so:
lua_load ~/Conky/LUA/draw_bg.lua
TEXT
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}
${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
covers the whole window and will change if you change the minimum_size setting
20 corner_radius
0 x_position
0 y_position
0 width
0 height
0x000000 color
0.4 alpha
]]
require 'cairo'
local cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
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))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
equalizer.lua
--[[ BARGRAPH WIDGET
v2.1 by wlourf (07 Jan. 2011)
edited by Caymus
this widget draws a bargraph with different effects
http://u-scripts.blogspot.com/2010/07/bargraph-widget.html
To call the script in a conky, use, before TEXT
lua_load /path/to/the/script/bargraph.lua
lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT
Parameters are :
3 parameters are mandatory
name - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
arg - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
arg can be a numerical value if name=""
max - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100
Optional parameters:
x,y - coordinates of the starting point of the bar, default = middle of the conky window
cap - end of cap line, ossibles values are r,b,s (for round, butt, square), default="b"
http://www.cairographics.org/samples/set_line_cap/
angle - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
set to 90 for an horizontal bar
skew_x - skew bar around x axis, default = 0
skew_y - skew bar around y axis, default = 0
blocks - number of blocks to display for a bar (values >0) , default= 10
height - height of a block, default=10 pixels
width - width of a block, default=20 pixels
space - space between 2 blocks, default=2 pixels
angle_bar - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
radius - for cicular bars, internal radius, default=0
with radius, parameter width has no more effect.
Colours below are defined into braces {colour in hexadecimal, alpha}
fg_colour - colour of a block ON, default= {0x00FF00,1}
bg_colour - colour of a block OFF, default = {0x00FF00,0.5}
alarm - threshold, values after this threshold will use alarm_colour colour , default=max
alarm_colour - colour of a block greater than alarm, default=fg_colour
smooth - (true or false), create a gradient from fg_colour to bg_colour, default=false
mid_colour - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
led_effect - add LED effects to each block, default=no led_effect
if smooth=true, led_effect is not used
possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
led_effect has to be used with theses colours :
fg_led - middle colour of a block ON, default = fg_colour
bg_led - middle colour of a block OFF, default = bg_colour
alarm_led - middle colour of a block > ALARM, default = alarm_colour
reflection parameters, not avaimable for circular bars
reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
other values = starting opacity
reflection_scale - scale of the reflection (default = 1 = height of text)
reflection_length - length of reflection, define where the opacity will be set to zero
calues from 0 to 1, default =1
reflection - position of reflection, relative to a vertical bar, default="b"
possibles values are : "b","t","l","r" for bottom, top, left, right
draw_me - if set to false, text is not drawn (default = true or 1)
it can be used with a conky string, if the string returns 1, the text is drawn :
example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value
v1.2 (28 Feb. 2010) just renamed the widget to bargraph
v1.3 (03 Mar. 2010) added parameters radius & angle_bar to draw the bar in a circular way
v2.0 (12 Jul. 2010) rewrite script + add reflection effects and parameters are now set into tables
v2.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation version 3 (GPLv3)
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301, USA.
]]
require 'cairo'
----------------START OF PARAMETERS ----------
function conky_main_bars()
local bars_settings={
{
name="cpu",
arg="cpu0",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=10,y=438,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="cpu",
arg="cpu1",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=95,y=438,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="cpu",
arg="cpu2",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=190,y=438,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="cpu",
arg="cpu3",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=285,y=438,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="cpu",
arg="cpu4",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=380,y=438,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="memperc",
arg="",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
x=10,y=460,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="fs_used_perc",
arg="/",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=95,y=460,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="fs_used_perc",
arg="/media/manuel/Files",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=190,y=460,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="fs_used_perc",
arg="/media/manuel/Windows 10",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=285,y=460,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="fs_used_perc",
arg="/media/manuel/L-Mint",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=380,y=460,
blocks=25,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="downspeedf",
arg="eth0",
max=1000,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=10,y=530,
blocks=45,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
draw_me="${if_existing /proc/net/route eth0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="upspeedf",
arg="eth0",
max=500,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=330,y=530,
blocks=45,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
draw_me="${if_existing /proc/net/route eth0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="downspeedf",
arg="wlan0",
max=1000,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=10,y=530,
blocks=40,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
draw_me="${if_existing /proc/net/route wlan0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="upspeedf",
arg="wlan0",
max=500,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=350,y=530,
blocks=40,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
draw_me="${if_existing /proc/net/route wlan0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="wireless_link_qual_perc",
arg="wlan0",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=165,y=530,
blocks=45,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
draw_me="${if_existing /proc/net/route wlan0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
{
name="battery_percent",
arg="BAT0",
max=100,
alarm=80,
bg_colour={0XDCDCDC,0.25},
fg_colour={0X7FFF00,1},
alarm_colour={0xff0000,1},
x=200,y=573,
blocks=85,
height=1,width=7,
angle=90,
smooth=true,
cap="e",
skew_y=0,
--draw_me="${if_existing /proc/net/route wlan0}1${else}0$endif",
mid_colour={{0.5,0xFF8C00,1}}
},
}
-----------END OF PARAMETERS--------------
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)
--prevent segmentation error when reading cpu state
if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(bars_settings) do
draw_multi_bar_graph(bars_settings[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ")
return
end
if t.max==nil then
print ("No maximum value defined, use 'max'")
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end
--set default values
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"}) do
if v==t.cap then cap=v end
end
local delta=0
if t.cap=="r" or t.cap=="s" then delta = t.height end
if cap=="s" then cap = CAIRO_LINE_CAP_SQUARE
elseif cap=="r" then
cap = CAIRO_LINE_CAP_ROUND
elseif cap=="b" then
cap = CAIRO_LINE_CAP_BUTT
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle
--colours
if t.bg_colour == nil then t.bg_colour = {0x00FF00,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0x00FF00,0.5} end
if t.fg_colour == nil then t.fg_colour = {0x00FF00,1} end
if #t.fg_colour~=2 then t.fg_colour = {0x00FF00,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end
if t.mid_colour ~= nil then
for i=1, #t.mid_colour do
if #t.mid_colour[i]~=3 then
print ("error in mid_color table")
t.mid_colour[i]={1,0xFFFFFF,1}
end
end
end
if t.bg_led ~= nil and #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil and #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end
if t.led_effect~=nil then
if t.bg_led == nil then t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil then t.alarm_led = t.fg_led end
end
if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
if t.smooth == nil then t.smooth = false end
if t.skew_x == nil then
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil then
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
end
if t.reflection_alpha==nil then t.reflection_alpha=0 end
if t.reflection_length==nil then t.reflection_length=1 end
if t.reflection_scale==nil then t.reflection_scale=1 end
--end of default values
local 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
--functions used to create patterns
local function create_smooth_linear_gradient(x0,y0,x1,y1)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end
local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
if t.mid_colour ~=nil then
for i=1, #t.mid_colour do
cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
end
end
return pat
end
local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
return pat
end
local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
if mode==3 then
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))
cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
else
cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))
end
return pat
end
local function draw_single_bar()
--this fucntion is used for bars with a single block (blocks=1) but
--the drawing is cut in 3 blocks : value/alarm/background
--not zvzimzblr for circular bar
local function create_pattern(col_alp,col_led,bg)
local pat
if not t.smooth then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if bg then
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
else
pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
end
end
return pat
end
local y1=-t.height*pct/100
local y2,y3
if pct>(100*t.alarm/t.max) then
y1 = -t.height*t.alarm/100
y2 = -t.height*pct/100
if t.smooth then y1=y2 end
end
if t.angle_bar==0 then
--block for fg value
local pat = create_pattern(t.fg_colour,t.fg_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,0,t.width,y1)
cairo_fill(cr)
cairo_pattern_destroy(pat)
-- block for alarm value
if not t.smooth and y2 ~=nil then
pat = create_pattern(t.alarm_colour,t.alarm_led,false)
cairo_set_source(cr,pat)
cairo_rectangle(cr,0,y1,t.width,y2-y1)
cairo_fill(cr)
y3=y2
cairo_pattern_destroy(pat)
else
y2,y3=y1,y1
end
-- block for bg value
cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
pat = create_pattern(t.bg_colour,t.bg_led,true)
cairo_set_source(cr,pat)
cairo_pattern_destroy(pat)
cairo_fill(cr)
end
end --end single bar
local function draw_multi_bar()
--function used for bars with 2 or more blocks
for pt = 1,t.blocks do
--set block y
local y1 = -(pt-1)*(t.height+t.space)
local light_on=false
--set colors
local col_alp = t.bg_colour
local col_led = t.bg_led
if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
if pct>=(pcb*(pt-1)) then
light_on = true
col_alp = t.fg_colour
col_led = t.fg_led
if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then
col_alp = t.alarm_colour
col_led = t.alarm_led
end
end
end
--set colors
--have to try to create gradients outside the loop ?
local pat
if not t.smooth then
if t.angle_bar==0 then
if t.led_effect=="e" then
pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
elseif t.led_effect=="a" then
pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)
elseif t.led_effect=="r" then
pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
else
if t.led_effect=="a" then
pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
0, 0, t.radius+(t.height+t.space)*(pt),
col_alp,col_led,3)
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(col_alp))
end
end
else
if light_on then
if t.angle_bar==0 then
pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
else
pat = create_smooth_radial_gradient(0, 0, (t.height+t.space), 0,0,(t.blocks+1)*(t.height+t.space),2)
end
else
pat = cairo_pattern_create_rgba (rgb_to_r_g_b(t.bg_colour))
end
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
--draw a block
if t.angle_bar==0 then
cairo_move_to(cr,0,y1)
cairo_line_to(cr,t.width,y1)
else
cairo_arc( cr,0,0,
t.radius+(t.height+t.space)*(pt)-t.height/2,
-t.angle_bar -math.pi/2 ,
t.angle_bar -math.pi/2)
end
cairo_stroke(cr)
end
end
local function setup_bar_graph()
--function used to retrieve the value to display and to set the cairo structure
if t.blocks ~=1 then t.y=t.y-t.height/2 end
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
--$to_bytes doesn't work when value has a decimal point,
--https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f
--http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310
--conky bug?
--value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
--if string.match(value,"%w") then
-- value = conky_parse(string.format('${to_bytes %s}',value))
--end
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
pct = 100*value/t.max
pcb = 100/t.blocks
cairo_set_line_width (cr, t.height)
cairo_set_line_cap (cr, cap)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle)
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
cairo_transform(cr,matrix0)
--call the drawing function for blocks
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
else
draw_multi_bar()
end
--dot for reminder
--[[
if t.blocks ~=1 then
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
cairo_fill(cr)
else
cairo_set_source_rgba(cr,1,0,0,1)
cairo_arc(cr,0,0,3,0,2*math.pi)
cairo_fill(cr)
end]]
--call the drawing function for reflection and prepare the mask used
if t.reflection_alpha>0 and t.angle_bar==0 then
local pat2
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
if t.angle_bar==0 then
pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
if t.reflection=="t" then
cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
elseif t.reflection=="r" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
elseif t.reflection=="l" then
cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
else --bottom
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
end
end
cairo_transform(cr,matrix1)
if t.blocks==1 and t.angle_bar==0 then
draw_single_bar()
cairo_translate(cr,0,-t.height/2)
else
draw_multi_bar()
end
cairo_set_line_width(cr,0.01)
cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
if t.angle_bar==0 then
cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
end
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
end --reflection
pct,pcb=nil
end --setup_bar_graph()
--start here !
setup_bar_graph()
cairo_restore(cr)
end
function conky_main_box()
if conky_window==nil then return end
---------------------- PARAMETERS BEGIN HERE
local boxes_settings={
{x=0,y=50,w=200,h=60, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
{x=0,y=195,w=200,h=60, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
{x=0,y=320,w=200,h=60, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
{x=0,y=410,w=200,h=60, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
{x=0,y=520,w=200,h=60, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
{x=0,y=615,w=200,h=150, corners={ {"circle",10} },colour={ {0,0x1F1F1F,0.5} },operator="atop" } ,
}
---------------------------- PARAMETERS END HERE
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr=cairo_create(cs)
if tonumber(conky_parse("$updates"))<5 then return end
for i in pairs(boxes_settings) do
draw_box (cr,boxes_settings[i])
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
function draw_box(cr,t)
if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
local table_corners={"circle","curve","line"}
local t_operators={
clear = CAIRO_OPERATOR_CLEAR,
source = CAIRO_OPERATOR_SOURCE,
over = CAIRO_OPERATOR_OVER,
["in"] = CAIRO_OPERATOR_IN,
out = CAIRO_OPERATOR_OUT,
atop = CAIRO_OPERATOR_ATOP,
dest = CAIRO_OPERATOR_DEST,
dest_over = CAIRO_OPERATOR_DEST_OVER,
dest_in = CAIRO_OPERATOR_DEST_IN,
dest_out = CAIRO_OPERATOR_DEST_OUT,
dest_atop = CAIRO_OPERATOR_DEST_ATOP,
xor = CAIRO_OPERATOR_XOR,
add = CAIRO_OPERATOR_ADD,
saturate = CAIRO_OPERATOR_SATURATE,
}
function rgba_to_r_g_b_a(tc)
--tc={position,colour,alpha}
local colour = tc[2]
local alpha = tc[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function table.copy(t)
local t2 = {}
for k,v in pairs(t) do
t2[k] = {v[1],v[2]}
end
return t2
end
function draw_corner(num,t)
local shape=t[1]
local radius=t[2]
local x,y = t[3],t[4]
if shape=="line" then
if num == 1 then cairo_line_to(cr,radius,0)
elseif num == 2 then cairo_line_to(cr,x,radius)
elseif num == 3 then cairo_line_to(cr,x-radius,y)
elseif num == 4 then cairo_line_to(cr,0,y-radius)
end
end
if shape=="circle" then
local PI = math.pi
if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2)
elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
end
end
if shape=="curve" then
if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0)
elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
end
end
end
--check values and set default values
if t.x == nil then t.x = 0 end
if t.y == nil then t.y = 0 end
if t.w == nil then t.w = conky_window.width end
if t.h == nil then t.h = conky_window.height end
if t.radius == nil then t.radius = 0 end
if t.border == nil then t.border = 0 end
if t.colour==nil then t.colour={{1,0xFFFFFF,0.5}} end
if t.linear_gradient ~= nil then
if #t.linear_gradient ~= 4 then
t.linear_gradient = {t.x,t.y,t.width,t.height}
end
end
if t.angle==nil then t.angle = 0 end
if t.skew_x == nil then t.skew_x=0 end
if t.skew_y == nil then t.skew_y=0 end
if t.scale_x==nil then t.scale_x=1 end
if t.scale_y==nil then t.scale_y=1 end
if t.rot_x == nil then t.rot_x=0 end
if t.rot_y == nil then t.rot_y=0 end
if t.operator == nil then t.operator = "over" end
if (t_operators[t.operator]) == nil then
print ("wrong operator :",t.operator)
t.operator = "over"
end
if t.radial_gradient ~= nil then
if #t.radial_gradient ~= 6 then
t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
end
end
for i=1, #t.colour do
if #t.colour[i]~=3 then
print ("error in color table")
t.colour[i]={1,0xFFFFFF,1}
end
end
if t.corners == nil then t.corners={ {"line",0} } end
local t_corners = {}
local t_corners = table.copy(t.corners)
--don't use t_corners=t.corners otherwise t.corners is altered
--complete the t_corners table if needed
for i=#t_corners+1,4 do
t_corners[i]=t_corners[#t_corners]
local flag=false
for j,v in pairs(table_corners) do flag=flag or (t_corners[i][1]==v) end
if not flag then print ("error in corners table :",t_corners[i][1]);t_corners[i][1]="curve" end
end
--this way :
-- t_corners[1][4]=x
-- t_corners[2][3]=y
--doesn't work
t_corners[1]={t_corners[1][1],t_corners[1][2],0,0}
t_corners[2]={t_corners[2][1],t_corners[2][2],t.w,0}
t_corners[3]={t_corners[3][1],t_corners[3][2],t.w,t.h}
t_corners[4]={t_corners[4][1],t_corners[4][2],0,t.h}
t.no_gradient = (t.linear_gradient == nil ) and (t.radial_gradient == nil )
cairo_save(cr)
cairo_translate(cr, t.x, t.y)
if t.rot_x~=0 or t.rot_y~=0 or t.angle~=0 then
cairo_translate(cr,t.rot_x,t.rot_y)
cairo_rotate(cr,t.angle*math.pi/180)
cairo_translate(cr,-t.rot_x,-t.rot_y)
end
if t.scale_x~=1 or t.scale_y~=1 or t.skew_x~=0 or t.skew_y~=0 then
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
cairo_matrix_init (matrix0, t.scale_x,math.pi*t.skew_y/180 , math.pi*t.skew_x/180 ,t.scale_y,0,0)
cairo_transform(cr,matrix0)
end
local tc=t_corners
cairo_move_to(cr,tc[1][2],0)
cairo_line_to(cr,t.w-tc[2][2],0)
draw_corner(2,tc[2])
cairo_line_to(cr,t.w,t.h-tc[3][2])
draw_corner(3,tc[3])
cairo_line_to(cr,tc[4][2],t.h)
draw_corner(4,tc[4])
cairo_line_to(cr,0,tc[1][2])
draw_corner(1,tc[1])
if t.no_gradient then
cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
else
if t.linear_gradient ~= nil then
pat = cairo_pattern_create_linear (t.linear_gradient[1],t.linear_gradient[2],t.linear_gradient[3],t.linear_gradient[4])
elseif t.radial_gradient ~= nil then
pat = cairo_pattern_create_radial (t.radial_gradient[1],t.radial_gradient[2],t.radial_gradient[3],
t.radial_gradient[4],t.radial_gradient[5],t.radial_gradient[6])
end
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
cairo_set_operator(cr,t_operators[t.operator])
if t.border>0 then
cairo_close_path(cr)
if t.dash ~= nil then cairo_set_dash(cr, t.dash, 1, 0.0) end
cairo_set_line_width(cr,t.border)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end
image.lua
-- From Didier-T
require 'cairo'
home = os.getenv ('HOME')
-- Display function
function conky_fDrawImage (path, x, y, w, h, arc)
path = string.gsub (path, "~", home)
path = string.gsub (path, "$HOME", home)
local cs = cairo_xlib_surface_create (conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local function fDrawImage (path, x, y, w, h, arc)
x = x + (w / 2)
y = y + (h / 2)
local img = cairo_image_surface_create_from_png (path)
local w_img, h_img = cairo_image_surface_get_width (img), cairo_image_surface_get_height (img)
local cr = cairo_create (cs)
cairo_translate (cr, x, y)
if arc then
cairo_rotate (cr, arc)
end
cairo_scale (cr, w / w_img, h / h_img)
cairo_set_source_surface (cr, img, -w_img / 2, -h_img / 2)
cairo_paint (cr)
cairo_destroy (cr)
cairo_surface_destroy (img)
end
fDrawImage (path, x, y, w, h, arc)
cairo_surface_destroy (cs)
return ""
end
text.lua
--[[TEXT WIDGET v1.3 by Wlourf 25/06/2010
This widget can drawn texts set in the "text_settings" table with some parameters
http://u-scripts.blogspot.com/2010/06/text-widget.html
The parameters (all optionals) are :
text - text to display, default = "Conky is good for you"
use conky_parse to display conky value ie text=conly_parse("${cpu cpu1}")
- coordinates below are relative to top left corner of the conky window
x - x coordinate of first letter (bottom-left), default = center of conky window
y - y coordinate of first letter (bottom-left), default = center of conky window
h_align - horizontal alignement of text relative to point (x,y), default="l"
available values are "l": left, "c" : center, "r" : right
v_align - vertical alignment of text relative to point (x,y), default="b"
available values "t" : top, "m" : middle, "b" : bottom
font_name - name of font to use, default = Free Sans
font_size - size of font to use, default = 14
italic - display text in italic (true/false), default=false
oblique - display text in oblique (true/false), default=false (I don' see the difference with italic!)
bold - display text in bold (true/false), default=false
angle - rotation of text in degrees, default = 0 (horizontal)
colour - table of colours for text, default = plain white {{1,0XC8C8FF,0.5}}
this table contains one or more tables with format {P,C,A}
P=position of gradient (0 = beginning of text, 1= end of text)
C=hexadecimal colour
A=alpha (opacity) of color (0=invisible,1=opacity 100%)
Examples :
for a plain color {{1,0x00FF00,0.5}}
for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle of the text
for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
and so on ...
orientation - in case of gradient, "orientation" defines the starting point of the gradient, default="ww"
there are 8 available starting points : "nw","nn","ne","ee","se","ss","sw","ww"
(n for north, w for west ...)
theses 8 points are the 4 corners + the 4 middles of text's outline
so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)
a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)
radial - define a radial gradient (if present at the same time as "orientation", "orientation" will have no effect)
this parameter is a table with 6 numbers : {xa,ya,ra,xb,yb,rb}
they define two circle for the gradient :
xa, ya, xb and yb are relative to x and y values above
reflection_alpha - add a reflection effect (values from 0 to 1) default = 0 = no reflection
other values = starting opacity
reflection_scale - scale of the reflection (default = 1 = height of text)
reflection_length - length of reflection, define where the opacity will be set to zero
calues from 0 to 1, default =1
skew_x,skew_y - skew text around x or y axis
Needs conky 1.8.0
To call this script in the conkyrc, in before-TEXT section:
lua_load /path/to/the/lua/script/text.lua
lua_draw_hook_pre draw_text
v1.0 07/06/2010, Original release
v1.1 10/06/2010 Add "orientation" parameter
v1.2 15/06/2010 Add "h_align", "v_align" and "radial" parameters
v1.3 25/06/2010 Add "reflection_alpha", "reflection_length", "reflection_scale",
"skew_x" et "skew_y"
-- 18/06/14/ram leak modified
]]
require 'cairo'
function conky_draw_text()
--BEGIN OF PARAMETRES
local ts=os.date("*t")
local text_settings={
--date
--[[ {
text=conky_parse"${time %a %d %b %Y}",
font_name="Larabiefont",
font_size=20,
h_align="l",
--v_align="m",
bold=true,
x=50,
y=430,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--time
{
text=conky_parse"${time %I %M}",
font_name="hooge 05_53",
font_size=50,
h_align="l",
--v_align="m",
bold=true,
x=70,
y=70,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},--]]
{
text=conky_parse"${execi 3600 lsb_release -d | cut -c14-38} ${kernel} - ${machine}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=360,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${nodename} System Updates:${execi 3600 aptitude search '~U' | wc -l | tail} Uptime: ${uptime_short} ",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=375,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"System:${fs_type} Load: $loadavg Processes: $processes ($running_processes running)",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=390,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"Env.:${execp env | grep DESKTOP_SESSION= |cut -c 17-} Week: ${time %W} (Day: ${time %j} / 365)",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=405,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${execi 3600 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //' | tail -n1} Cpu temp:${acpitemp}F",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=420,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--cpu1
{
text=conky_parse"cpu ${cpu cpu0}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=435,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--cputext
--cpu2
{
text=conky_parse"cpu1 ${cpu cpu1}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=96,
y=435,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--cpu2text
{
text=conky_parse"cpu2 ${cpu cpu2}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=191,
y=435,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--cpu2text
--ram
{
text=conky_parse"cpu3 ${cpu cpu3}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=286,
y=435,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--memtext
{
text=conky_parse"cpu4 ${cpu cpu4}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=380,
y=435,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"mem ${memperc}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=457,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse" Root ${fs_used_perc /}% Files ${fs_used_perc /media/manuel/Files}% Win10 ${fs_used_perc /media/manuel/Windows 10}% Mint ${fs_used_perc /media/manuel/L-Mint}%",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=457,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"HDD Temp: ${exec hddtemp /dev/sda -n --unit=F}° Diskio_read: ${diskio_read /dev/sdb7} Diskio_write: ${diskio_write /dev/sdb7}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=480,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${if_gw}Network:Online DGW:$gw_ip${endif} Nameserver:$nameserver",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=495,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${if_existing /proc/net/route eth0}Interface:eth0 IP-Address:${addr eth0}${else}${endif}${if_existing /proc/net/route wlan0}Interface:wifi IP-Address:${addr wlan0}${endif}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=510,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${if_existing /proc/net/route eth0}Speed: Down:${downspeedf eth0} TCP Connections ${tcp_portmon 1 65535 count} Up:${upspeedf eth0}${else}${endif}${if_existing /proc/net/route wlan0}Speed: Down:${downspeedf wlan0} TCP Connections ${tcp_portmon 1 65535 count} Up:${upspeedf wlan0}${else}${endif}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=525,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
--ul
{
text=conky_parse"${if_existing /proc/net/route wlan0} ESSID: ${wireless_essid wlan0}${endif}${if_existing /proc/net/route wlan0} Qualty: ${wireless_link_qual_perc wlan0}${endif}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=120,
y=550,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"Battery is ${battery BAT0}. Ac: ${acpiacadapter AC0}",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=565,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},
{
text=conky_parse"${battery_time BAT0} remaining.",
font_name="caviar dreams",
font_size=13,
h_align="l",
--v_align="m",
bold=true,
x=10,
y=580,
colour={{0.5,0xFFFFCC,0.6},{1,0XC8C8FF,0.5}},
--radial={0,300,0,0,300,370},
orientation="nn",
},--]]
}
--------------END OF PARAMETERES----------------
--------------END OF PARAMETERES----------------
if conky_window == nil then return end
if tonumber(conky_parse("$updates"))<3 then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
for i,v in pairs(text_settings) do
cr = cairo_create (cs)
display_text(v)
cairo_destroy(cr)
cr = nil
end
cairo_surface_destroy(cs)
end
function rgb_to_r_g_b2(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function display_text(t)
if t.draw_me==true then t.draw_me = nil end
if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
local function set_pattern(te)
--this function set the pattern
if #t.colour==1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
else
local pat
if t.radial==nil then
local pts=linear_orientation(t,te)
pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
else
pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
end
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
end
--set default values if needed
if t.text==nil then t.text="Conky is good for you !" end
if t.x==nil then t.x = conky_window.width/2 end
if t.y==nil then t.y = conky_window.height/2 end
if t.colour==nil then t.colour={{1,0XC8C8FF,0.5}} end
if t.font_name==nil then t.font_name="Arial" end
if t.font_size==nil then t.font_size=13 end
if t.angle==nil then t.angle=0 end
if t.italic==nil then t.italic=false end
if t.oblique==nil then t.oblique=false end
if t.bold==nil then t.bold=false end
if t.radial ~= nil then
if #t.radial~=6 then
print ("error in radial table")
t.radial=nil
end
end
if t.orientation==nil then t.orientation="ww" end
if t.h_align==nil then t.h_align="l" end
if t.v_align==nil then t.v_align="b" end
if t.reflection_alpha == nil then t.reflection_alpha=0 end
if t.reflection_length == nil then t.reflection_length=1 end
if t.reflection_scale == nil then t.reflection_scale=1 end
if t.skew_x==nil then t.skew_x=0 end
if t.skew_y==nil then t.skew_y=0 end
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle*math.pi/180)
cairo_save(cr)
local slant = CAIRO_FONT_SLANT_NORMAL
local weight = CAIRO_FONT_WEIGHT_NORMAL
if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
cairo_select_font_face(cr, t.font_name, slant,weight)
for i=1, #t.colour do
if #t.colour[i]~=3 then
print ("error in color table")
t.colour[i]={1,0XC8C8FF,0.5}
end
end
local matrix0 = cairo_matrix_t:create()
tolua.takeownership(matrix0)
local skew_x,skew_y=t.skew_x/t.font_size,t.skew_y/t.font_size
cairo_matrix_init (matrix0, 1,skew_y,skew_x,1,0,0)
cairo_transform(cr,matrix0)
cairo_set_font_size(cr,t.font_size)
local te=cairo_text_extents_t:create()
tolua.takeownership(te)
local text=conky_parse(t.text)
if text~="" then t.text = text end
cairo_text_extents (cr,t.text,te)
set_pattern(te)
local mx,my=0,0
if t.h_align=="c" then
mx=-te.width/2-te.x_bearing
elseif t.h_align=="r" then
mx=-te.width
end
if t.v_align=="m" then
my=-te.height/2-te.y_bearing
elseif t.v_align=="t" then
my=-te.y_bearing
end
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
if t.reflection_alpha ~= 0 then
local matrix1 = cairo_matrix_t:create()
tolua.takeownership(matrix1)
cairo_set_font_size(cr,t.font_size)
cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
cairo_set_font_size(cr,t.font_size)
te=nil
local te=cairo_text_extents_t:create()
tolua.takeownership(te)
cairo_text_extents (cr,t.text,te)
cairo_transform(cr,matrix1)
set_pattern(te)
cairo_move_to(cr,mx,my)
cairo_show_text(cr,t.text)
local pat2 = cairo_pattern_create_linear (0,
(te.y_bearing+te.height+my),
0,
te.y_bearing+my)
cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
--line is not drawn but with a size of zero, the mask won't be nice
cairo_set_line_width(cr,1)
local dy=te.x_bearing
if dy<0 then dy=dy*(-1) end
cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
cairo_clip_preserve(cr)
cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
--cairo_stroke(cr)
cairo_mask(cr,pat2)
cairo_pattern_destroy(pat2)
cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
te=nil
end
end
function linear_orientation(t,te)
local w,h=te.width,te.height
local xb,yb=te.x_bearing,te.y_bearing
if t.h_align=="c" then
xb=xb-w/2
elseif t.h_align=="r" then
xb=xb-w
end
if t.v_align=="m" then
yb=-h/2
elseif t.v_align=="t" then
yb=0
end
local p=0
if t.orientation=="nn" then
p={xb+w/2,yb,xb+w/2,yb+h}
elseif t.orientation=="ne" then
p={xb+w,yb,xb,yb+h}
elseif t.orientation=="ww" then
p={xb,h/2,xb+w,h/2}
elseif vorientation=="se" then
p={xb+w,yb+h,xb,yb}
elseif t.orientation=="ss" then
p={xb+w/2,yb+h,xb+w/2,yb}
elseif t.orientation=="ee" then
p={xb+w,h/2,xb,h/2}
elseif t.orientation=="sw" then
p={xb,yb+h,xb+w,yb}
elseif t.orientation=="nw" then
p={xb,yb,xb+w,yb+h}
end
return p
end
alert.sh
#!/bin/bash
# alert.sh
# copyright 2011 by Mobilediesel
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
if ping -c1 www.weather.gov 1>/dev/null
then
alert=$(~/conky-conf/weather/conky-rss.sh "https://alerts.weather.gov/cap/wwaatmget.php?x=VAC069&y=1"|sed -e 's/\(NOAA - National Weather Service\)//' -e 's/\(There are no active watches, warnings or advisories.*\|special weather statement.*\)//i' -e '/^$/d'|sort -u|fold -sw75|sed -e "s/\(.*Warning .*\)/\${color red}\1\${color 99ccff}/" -e "s/\(.*Watch .*\)/\${color red}\1\${color red}/")
fi
if [ -z "$alert" ]
then
echo "$alert"
else
alert=$(echo -en "\${color3}Weather Alert\${color 99ccff}\n$alert")
echo "$alert"
fi
conky-rss.sh
#!/bin/bash
# RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0
############################################################
# This work is licensed under the Creative Commons #
# Attribution-Share Alike 3.0 Unported License. #
# To view a copy of this license, visit #
# http://creativecommons.org/licenses/by-sa/3.0/ #
# or send a letter to Creative Commons, 171 Second Street, #
# Suite 300, San Francisco, California, 94105, USA. #
############################################################
#
#RSS Setup - Don't change unless you want these values hard-coded!
uri=$1 #URI of RSS Feed
lines=$2 #Number of headlines
titlenum=$3 #Number of extra titles
#Script start
#Require a uri, as a minimum
if [[ "$uri" == "" ]]; then
echo "No URI specified, cannot continue!" >&2
echo "Please read script for more information" >&2
else
#The actual work
curl -A "mozilla/10.0" -s --connect-timeout 30 $uri |\
sed 's/\(<\!\[CDATA\[\|\]\]\)//g'|\
grep -io "<[rs:]\{0,4\}title>[^<>]*"|\
sed -e 's/<[^>]*>//'|\
head -n $[${lines:-25} + ${titlenum:-2}] |\
tail -n $[${lines:-25}]
fi
launcher.lua
function conky_main()
dofile ('/home/manuel/conky-conf/weather/image.lua')
dofile ('/home/manuel/conky-conf/weather/text.lua')
dofile ('/home/manuel/conky-conf/weather/equalizer.lua')
dofile ('/home/manuel/conky-conf/weather/draw_bg.lua')
conky_draw_text()
conky_main_bars()
conky_fDrawImage (path, x, y, w, h, arc)
end
Offline