Für mich eine der schönsten Uhren überhaupt, 12 Stundenanzeige, langer Sekundenzeiger teilweise in rot, Tag/Wochentag, Monat, Wetterdaten.
Jahrelang hatte ich nur ein Bild und fand einfach nicht den zugehörigen Code. Bei den Tips, Tricks & Scripts im
chrunchbang-forum mit über 300 Seiten fand ich mittig schließlich eine Spur. Aber der Schöpfer "McLovin" machte es wirklich nicht einfach.
Nachdem ich die Pfade entsprechend eingerichtet, präsentierte sich der erste Conky-Aufruf so:
und das Terminal zeigte mir fortlaufend den lua-Fehler:
- Code: Alles auswählen
Conky: llua_do_call: function conky_weather execution failed: ...r11-1/McLovin/originalChronograph/chrono-weather.lua:96: attempt to perform arithmetic on global 'start_day' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: ...r11-1/McLovin/originalChronograph/chrono-weather.lua:96: attempt to perform arithmetic on global 'start_day' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: ...r11-1/McLovin/originalChronograph/chrono-weather.lua:96: attempt to perform arithmetic on global 'start_day' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: ...r11-1/McLovin/originalChronograph/chrono-weather.lua:96: attempt to perform arithmetic on global 'start_day' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: ...r11-1/McLovin/originalChronograph/chrono-weather.lua:96: attempt to perform arithmetic on global 'start_day' (a nil value)
Hm, nach *zig Versuchen, kam ich zu der Erkenntnis, es muß an der verwendeten Schriftart 'Antipasto' liegen. Nachdem ich diese gegen 'monofur' in der Konfiguration und den beiden Lua-Scripten ausgetauscht hatte, war sie da, die korrekte Anzeige der Uhr.
Dagegen war der fortlaufende lua-Fehler im Terminal wirklich eine "Nuss".
Nach ewigen, im nachhinein, sinnlosen herumprobiere, fand ich beim Lua-Meister @mrpeachy die Lösung in seinem
HoWoTo zum weather-LUA unter
PART 4Die Uhr zeigt ja das Wetter nur vom aktuellen Tag. Also mußte der
- Code: Alles auswählen
start_day=1
lauten.
Also
- Code: Alles auswählen
--########################################################################################
--start or weather forecast repeat section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=1
topy=240
ygap=80
Mit einfügen dieser Zeilen 93 - 100 in das zuständige "chrono-weather.lua" - Script verschwand der Fehler und ich hatte dieses wunderbare "Linux-Gefühl".

Die drei Konfigurationsdateien
conkyrc- Code: Alles auswählen
# killall conky & conky -c /media/DATEN/francescoPC/Conky/Sector11/12-1-Sector11-1/McLovin/McLovin_Chronograph.conky &
# mühsam gesucht @unklar im Dec.2016
######################
# - Conky settings - #
######################
background yes
update_interval 1
cpu_avg_samples 1
total_run_times 0
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 1024 #10240
imlib_cache_size 0 #10240
minimum_size 350 350
#maximum_width 350
#####################
# - Text settings - #
#####################
use_xft yes
xftfont monofur:size=10
#xftfont Antipasto:size=10
#xftfont CorporateMonoExtraBold:size=10
xftalpha 1 #.8
uppercase no
# Text alignment, other possible values are commented
#alignment middle_left
#alignment middle_middle
#alignment middle_right
#alignment top_middle
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment bottom_middle
gap_x 5
gap_y 5
######################
# - Color settings - #
######################
default_color c3c3c3
default_shade_color gray
default_outline_color black
color0 c3c3c3 #mid gray
color1 FF0000 #red
color2 09FF00 #bright green
color3 007EFF #bright blue
color4 E3E3E3 #very light gray
color5 FF8600 #an orange shade
color6 CA8718 #a dust like color
color7 FFE500 #a darker yellow color
color8 C3FF00 #lime green
color9 00FCFF #sky blue
#############################
# - Window specifications - #
#############################
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Chronograph
own_window_argb_visual yes
own_window_argb_value 200
border_inner_margin 0
border_outer_margin 0
#########################
# - Graphics settings - #
#########################
draw_shades no #yes
draw_outline no
draw_borders no
stippled_borders 0
draw_graph_borders no
####################
# - LUA Settings - #
####################
lua_load /media/DATEN/francescoPC/Conky/Sector11/12-1-Sector11-1/McLovin/letzteChronograph.lua
lua_draw_hook_post main
#lua_load /media/5/conky/McBars_McLovin/McBars/scripts/clock_rings.lua
#lua_draw_hook_pre clock_rings
# - WEATHER - #
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /media/DATEN/francescoPC/Conky/Sector11/12-1-Sector11-1/McLovin/letzte-chrono-weather.lua
lua_load ~/LUA/draw-bg.lua
TEXT
${lua conky_draw_bg 15 0 0 0 0 0x000000 0.2}
Chronograph.lua- Code: Alles auswählen
--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
21 Jun 2012 - Chronograph modifications by Sector11
22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
02 Nov 2012 - edited by McLovin to add the outside rings, and minute numbers
12 Nov 2012 - memory leak plugged - mrpeachy via arclance
use in conkyrc
lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT
-- INDEX (use find with):
-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ###### ALL CLOCKS
-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME
NOTE: Putting ### CLOCK A ### last insures that it's functions are written
over the other dials.
]]
require 'cairo'
function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")
-- ###### 12 OR 24 CLOCK FACE #############################
local clock_type_A=12 -- Large Main 24 HR Clock
local clock_type_E=12 -- Bottom - 12 HR Clock
-- ###### CLOCK SETTINGS ##################################
-- SET BORDER OPTIONS FOR "CLOCKS" ########################
local clock_border_width=0
-- set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1 -- full opaque white
-- gap from clock border to minute marks
local b_to_m=1
-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=175
local center_y=95
local radius=50
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,42/255,149/255,180/255,1) --(cr,194/255,204/255,255/255,1) --(cr,42/255,149/255,180/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"So","Mo","Di","Mi","Do","Fr","Sa",} -- English
--text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",} -- Spanish
--text_days={"dim","lun","mar","mer","jeu","ven","sam",} -- French
for i=1,7 do
-- work out points
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
cairo_set_source_rgba (cr,195/255,195/255,195/255,1)
local radius=38
for i=1,7 do
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current day of week
cairo_set_source_rgba (cr,1,0,0,1)
local hand_length=30
local day_number=tonumber(os.date("%w"))
local point=(math.pi/180)*((360/7)*(day_number))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
local hand_width=2
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END DIAL B #########################################
-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=260
local center_y=175
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,42/255,149/255,180/255,1) --(cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} -- English
--text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} -- Spanish
--text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} -- French
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current month
cairo_set_source_rgba (cr,1,0,0,1)
local this_month=tonumber(os.date("%m"))
local hand_length=28 --radius for this calculation
local point=(math.pi/180)*((360/12)*(this_month-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK C ########################################
-- ########################################################
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=95
local center_y=175
local radius=50
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 9)
cairo_set_source_rgba (cr,42/255,149/255,180/255,1) --(cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
for i=1,number_days do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
--only print even numbers
if math.mod(i, 1) == 0 then
--set text when even
text=string.format("%01d",i) --formats numbers to double digits
else
--set text when odd
text=""
end--odd even matching
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
local radius=42
for i=1,number_days do
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current DAY
cairo_set_source_rgba (cr,1,0,0,1)
local this_day=tonumber(os.date("%d"))
local hand_length=40--radius for this calculation
local point=(math.pi/180)*((360/number_days)*(this_day-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK D ########################################
-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=175
clock_centery=260
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_E
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line-- MARKS AROUND CLOCK A
cairo_stroke (cr)
end-- of for loop
--[[ TIME CALCULATIONS CLOCK E
if clock_type_E==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_E==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds and draw it
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_E))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_E)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_E)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_E)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=260
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
-- FOR A 12 HOUR CLOCK WITH THE NUMBERS 13-00
text_days={"00","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end ]]
-- ### END CLOCK E ########################################
-- ########################################################
-- ### START CLOCK A ######################################
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=12
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1 -- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=120
-- set hour hand width
hh_width_A=4
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
cairo_set_source_rgba (cr,69/255,169/255,19/255,1)
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=140
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,0,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
sh_length_A=150
-- set hour hand width
sh_width_A=2
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK A ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=175
clock_centery=175
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- HOUR MARKS
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
--cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
--cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))BOLD
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
]]
--[[ ####################################################################
-- outer part of a Hour hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%I"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/12)*hours)
--calculate point 1
local radius1=90
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=140
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,255/255,0/255,0/255,1)
cairo_stroke (cr)]]
-- ####################################################################
-- outer part of a second hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=90
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=140
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,255/255,0/255,0/255,1)
cairo_stroke (cr)
-- ####################################################################
-- inner part of a second hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=1
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=90
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_stroke (cr)
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=175
local radius=165
-- FONT
--[[cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 15)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,24 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=150
for i=1,24 do
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- ####################################################################]]
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=175
local radius=165
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 20)
cairo_set_source_rgba (cr,42/255,149/255,180/255,1) --(cr,42/255,149/255,180/255,1)_light blue --(cr,194/255,204/255,255/255,1)_light-gray -- (cr,1,1,1,1)_white
-- TABLE OF TEXT -- in order
text_days={"12","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
--[[ CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end]]
-- POSITION FOR TEXT MINUTE NUMBERS
local center_x=175
local center_y=175
local radius=160
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,1,1,1,128/255) --(cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"","1","2","3","4","","6","7","8","9","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
for i=1,60 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/60)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
cairo_set_source_rgba (cr,1,1,1,1)
local radius=150
for i=1,60 do
local point=(math.pi/180)*((360/60)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
--[[ HOUR POINTS CIRCLES, ##########Uncoment section to draw rings around numbers
local radius=162
for i=1,60 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,12,0,2*math.pi)
cairo_stroke (cr)
end]]
-- ### END CLOCK A ########################################
-- ########################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
chrono-weather.lua- Code: Alles auswählen
--[[
The latest script is a lua only weather script. aka: v9000
http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/
the file:
http://dl.dropbox.com/u/19008369/v9000.tar.gz
mrppeachys LUA Tutorial
http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
--sun_rise[n]
--sun_set[n]
--moon_rise[n]
--moon_set[n]
--now["time"]
--now["fc_hour1_time"]
--now["fc_hour2_time"]
--now["fc_hour3_time"]
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="monofur"--font must be in quotes
default_font_size=16
default_color=0xffffff --white
default_alpha=1 --fully opaque
default_image_width=60
default_image_height=60
-- ## New Options ###
default_face="normal"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################
--[[ SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="monofur"--font must be in quotes
default_font_size=15
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################]]
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
-- Icon and Image section
image({x=120,y=180,h=110,w=110,file=now["weather_icon"]})
image({x=52,y=132,h=85,w=85,file=now["wind_icon"]})
image({x=140,y=60,h=70,w=70,file=moon_icon[1]})
-- Temp / FeelsLike & CONDITIONS TEXT
out({c=0xE3E3E3,a=1,f="monofur",fs=13,x=60,y=90,txt=moon_phase[1] })
out({c=0x21768E,a=1,f="monofur",fs=30,x=265,y=253,txt=now["temp"].."°"})
out({c=0xE3E3E3,a=1,f="monofur",fs=18,x=220,y=249,txt="Temp:"})
out({c=0x21768E,a=1,f="monofur",fs=20,x=263,y=270,txt=now["feels_like"].."°"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=210,y=270,txt="Feels:"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=215,y=283,txt="Hi:"})
out({c=0xC94029,a=1,f="monofur",fs=15,x=255,y=283,txt=high_temp[1].."°"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=210,y=295,txt="Lo:"})
out({c=0x21768E,a=1,f="monofur",fs=15,x=240,y=295,txt=low_temp[1].."°"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=40,y=128,txt="Wind:"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=50,y=240,txt=now["wind_nesw"].." @"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=90,y=240,txt=now["wind_mph"]})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=55,y=255,txt="Wind Chill:"})
out({c=0x21768E,a=1,f="monofur",fs=15,x=145,y=255,txt=now["wind_chill"].."°"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=70,y=270,txt="Hum:"})
out({c=0x21768E,a=1,f="monofur",fs=15,x=110,y=270,txt=now["humidity"].."%"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=80,y=285,txt="Precip:"})
out({c=0x21768E,a=1,f="monofur",fs=15,x=140,y=285,txt=precipitation[1].."%"})
out({c=0xE3E3E3,a=1,f="monofur",fs=15,x=100,y=300,txt="Dew-P:"})
out({c=0x21768E,a=1,f="monofur",fs=15,x=155,y=300,txt=now["dew_point"].."°"})
--########################################################################################
-- 3 hour output
--out({c=0x94C2FF,a=1,f="monofur",fs=16,x=25,y=380,txt="Next 3"})
--out({c=0x94C2FF,a=1,f="monofur",fs=16,x=25,y=395,txt="Hours"})
-- 1st hour
--out({c=0xFF9600,x=75,y=365,txt=now["fc_hour1_time"]..":00"})
--image({w=60,h=60,x=60,y=365,file=now["fc_hour1_wicon"]}) -- image({w=30,h=30,x=223,y=55,file="/home/sector11/Conky/images/red_1.png"})
--out({c=0xAFAFAF,x=85,y=425,txt=now["fc_hour1_temp"] .."°"})
-- 2nd hour
--out({c=0xFF9600,x=178,y=365,txt=now["fc_hour2_time"]..":00"})
--image({w=60,h=60,x=160,y=365,file=now["fc_hour2_wicon"]}) -- image({w=30,h=30,x=223,y=130,file="/home/sector11/Conky/images/red_1.png"})
--out({c=0xAFAFAF,x=185,y=425,txt=now["fc_hour2_temp"] .."°"})
-- 3rd hour
--out({c=0xFF9600,x=278,y=365,txt=now["fc_hour3_time"]..":00"})
--image({w=60,h=60,x=260,y=365,file=now["fc_hour3_wicon"]}) -- image({w=30,h=30,x=223,y=215,file="/home/sector11/Conky/images/red_1.png"})
--out({c=0xAFAFAF,x=285,y=425,txt=now["fc_hour3_temp"] .."°"})
--########################################################################################
--start or weather forecast repeat section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=1
topy=240
ygap=80
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
und, es wird für die Darstellung des Wetter @mrpeachy's v9000
viewtopic.php?f=4&t=523&start=125#p30247 gebraucht.
Mit bestem Wissen...
wünsche ich Erfolg!
