SEARCH

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

You are not logged in.

#3876 2012-11-19 17:56:43

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

mosesgunn wrote:

Thanks Sector11!  It says it only is i386 architecture?  I am using 64 bit.  Will it still work?

Yup, no problem, I'm running an AMD-64.

Offline

Be excellent to each other!

#3877 2012-11-19 23:19:13

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

ok thanks to sector11 showing me some problems he was having, I have fixed all but one.

The one I couldn't fix was the mem_perc returning a nill value for the first couple of seconds. This even has me confused as it corrects itself to a real value afterwards.

So with those problems fixed and so code cleaning, I think I can say that it is coming along nicely.

I didn't write up a change log for this one cause it was mostly just retyping codes that already existed and deleting existing redundant codes... novices and our novice mistakes.

2012_11_19_1353337273_820x213_scrot.jpg
So here is the new code:

--insturment panel beta 4.0
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 updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--message can be deleted when no longer needed
print(cr,"######################################")
print(cr,"As you can see if you look at first print of mem perc that it is a nil value. I do not understand why it starts that way but after that as you can see it work perfectly fine")
print(cr,mem_perc)
print(cr,"######################################")
--######################################################################
--Settings
--######################################################################
--default settings######################################################
d_line_width=2
deg_math=(math.pi/180)
max_value=100
d_foreground_width=4
d_font_color_red=.8
d_font_color_green=.8
d_font_color_blue=.8
d_font_color_alpha=1
d_gauge_color_red=1
d_gauge_color_green=0
d_gauge_color_blue=0
d_gauge_color_alpha=1
d_foreground_color_red=.5
d_foreground_color_green=0
d_foreground_color_blue=.1
d_foreground_color_alpha=1
d_inner_arc_color_red=.2
d_inner_arc_color_green=.2
d_inner_arc_color_blue=.2
d_inner_arc_color_alpha=1
d_fill_color_red=.05
d_fill_color_green=.05
d_fill_color_blue=.05
d_fill_color_alpha=.75
d_font="mono"
d_font_size=11
d_font_slant=CAIRO_FONT_SLANT_NORMAL
d_font_face=CAIRO_FONT_WEIGHT_NORMAL
rotate_d=-90
rotate_r=deg_math*rotate_d
--colors################################################################
--panel border
panel_border_color_red=.3
panel_border_color_green=.3
panel_border_color_blue=.3
panel_border_color_alpha=1
--sperators fill
seperator_fill_color_red=.1
seperator_fill_color_green=.1
seperator_fill_color_blue=.1
seperator_fill_color_alpha=.75
--temp background
tempbg_red=.1
tempbg_green=.1
tempbg_blue=.1
tempbg_alpha=1
--alert
alert_color1_red=.1
alert_color1_green=.1
alert_color1_blue=.1
alert_color1_alpha=.85
alert_color2_red=1
alert_color2_green=0
alert_color2_blue=0
alert_color2_alpha=1
--conky values##########################################################
cpu_core_avg=tonumber(conky_parse("${cpu cpu0}"))
cpu_core_1=tonumber(conky_parse("${cpu cpu1}"))
cpu_core_2=tonumber(conky_parse("${cpu cpu2}"))
cpu_core_3=tonumber(conky_parse("${cpu cpu3}"))
cpu_core_4=tonumber(conky_parse("${cpu cpu4}"))
temp1=conky_parse("${hwmon temp 1}")
temp2=conky_parse("${hwmon temp 2}")
temp3=conky_parse("${hwmon temp 3}")
temp4=conky_parse("${hwmon temp 4}")
mem_perc=tonumber(conky_parse("${memperc}"))
mem_used=conky_parse("${mem}")
mem_max=conky_parse("${memmax}")
swap_perc=tonumber(conky_parse("${swapperc}"))
swap_used=conky_parse("${swap}")
swap_max=conky_parse("${swapmax}")
system_perc=tonumber(conky_parse("${fs_used_perc /}"))
system_used=conky_parse("${fs_used /}")
system_size=conky_parse("${fs_size /}")
home_perc=tonumber(conky_parse("${fs_used_perc /home}"))
home_used=conky_parse("${fs_used /home}")
home_size=conky_parse("${fs_size /home}")
down_speed_limited=conky_parse("${if_match 1000 < ${downspeedf}}1001${else}${downspeedf}${endif}")
down_scale_adjuster=conky_parse("${if_match 1000 < ${downspeedf}}1001${else}${if_match 500 < ${downspeedf}}1000${else}${if_match 250 < ${downspeedf}}500${else}${if_match 100 < ${downspeedf}}250${else}100${endif}${endif}${endif}${endif}")
up_speed_limited=conky_parse("${if_match 100 < ${upspeedf}}101${else}${upspeedf}${endif}")
up_scale_adjuster=conky_parse("${if_match 100 < ${upspeedf}}101${else}${if_match 50 < ${upspeedf}}100${else}50${endif}${endif}")
network_status=tonumber(conky_parse("${if_gw}0${else}1${endif}"))
--panel and seperators##################################################
--panel points
--left line
panel_start_x=5
panel_start_y=35
panel_point2_x=5
panel_point2_y=175
--bottom line
panel_point3_x=35
panel_point3_y=205
panel_point4_x=775
panel_point4_y=205
--right line
panel_point5_x=805
panel_point5_y=175
panel_point6_x=805
panel_point6_y=35
--top line
panel_point7_x=775
panel_point7_y=5
panel_point8_x=35
panel_point8_y=5
--seperators points
--seperator 1
seperator1_start_x=55
seperator1_start_y=5
seperator1_point1_x=205
seperator1_point1_y=105
seperator1_end_x=255
seperator1_end_y=202
--seperator 2
seperator2_start_x=755
seperator2_start_y=5
seperator2_point1_x=605
seperator2_point1_y=105
seperator2_end_x=555
seperator2_end_y=202
--alert system setttings################################################
alert_value=75
if mem_perc >= alert_value then
mem_a_level=1
else
mem_a_level=0
end
if cpu_core_avg >= alert_value then
cpu_a_level=1
else
cpu_a_level=0
end
if swap_perc >= alert_value then
swap_a_level=1
else
swap_a_level=0
end
if system_perc >= alert_value then
sys_a_level=1
else
sys_a_level=0
end
if home_perc >= alert_value then
home_a_level=1
else
home_a_level=0
end
alert_level=mem_a_level+cpu_a_level+swap_a_level+sys_a_level+home_a_level
m_a_t1_rad=45*deg_math
m_a_t2_rad=315*deg_math
m_a_size=20
a_panel_h=25
a_panel_w=80
a_panel1_pad_x=27
a_panel2_pad_x=24
a_panel_pad_y=16
--text
m_a_t1="Master"
m_a_t2="Alert"
network_a_t="Net"
swap_a_t="Swp"
system_a_t="Sys"
--x and y
m_a_t1_x=155
m_a_t1_y=95
m_a_t2_x=610
m_a_t2_y=138
a_panel1_p1_x=300
a_panel1_p1_y=150
a_panel1_p2_x=a_panel1_p1_x+a_panel_w
a_panel1_p2_y=a_panel1_p1_y
a_panel1_p3_x=a_panel1_p2_x
a_panel1_p3_y=a_panel1_p2_y+a_panel_h
a_panel1_p4_x=a_panel1_p1_x
a_panel1_p4_y=a_panel1_p3_y
a_panel2_p1_x=431
a_panel2_p1_y=150
a_panel2_p2_x=a_panel2_p1_x+a_panel_w
a_panel2_p2_y=a_panel2_p1_y
a_panel2_p3_x=a_panel2_p2_x
a_panel2_p3_y=a_panel2_p2_y+a_panel_h
a_panel2_p4_x=a_panel2_p1_x
a_panel2_p4_y=a_panel2_p3_y
network_a_x=a_panel1_p1_x+2
network_a_y=a_panel1_p1_y+a_panel_pad_y
mem_a_x=network_a_x+a_panel1_pad_x
mem_a_y=network_a_y
cpu_a_x=mem_a_x+a_panel1_pad_x
cpu_a_y=network_a_y
swap_a_x=a_panel2_p1_x+2
swap_a_y=a_panel2_p1_y+a_panel_pad_y
system_a_x=swap_a_x+a_panel2_pad_x
system_a_y=swap_a_y
home_a_x=system_a_x+a_panel2_pad_x
home_a_y=swap_a_y
--cpu###################################################################
cpu_center_x=405
cpu_center_y=135
cpu_radius=120
--cpu background arc
cpu_arc_center_x=cpu_center_x
cpu_arc_center_y=cpu_center_y
cpu_arc_radius=cpu_radius
cpu_arc_start_degree=150
cpu_arc_end_degree=390
cpu_arc_start_angle=cpu_arc_start_degree*deg_math
cpu_arc_end_rad=cpu_arc_end_degree*deg_math
cpu_arc_end_math=cpu_arc_end_rad-cpu_arc_start_angle
cpu_arc_scale=cpu_arc_end_math/max_value
cpu_arc_end_angle_value=cpu_core_avg*cpu_arc_scale
cpu_arc_end_angle=cpu_arc_end_angle_value+cpu_arc_start_angle
--cpu foreground arc
cpu_foreground_arc_center_x=cpu_center_x
cpu_foreground_arc_center_y=cpu_center_y
cpu_foreground_arc_radius=cpu_radius
cpu_foreground_arc_start_degree=150
cpu_foreground_arc_end_degree=390
cpu_foreground_arc_start_angle=cpu_foreground_arc_start_degree*deg_math
cpu_foreground_arc_end_angle=cpu_foreground_arc_end_degree*deg_math
--cpu inner arc
cpu_inner_arc_center_x=405
cpu_inner_arc_center_y=175
cpu_inner_arc_radius=20
cpu_inner_arc_start_degree=0
cpu_inner_arc_end_degree=360
cpu_inner_arc_start_rad=cpu_inner_arc_start_degree*deg_math
cpu_inner_arc_end_rad=cpu_inner_arc_end_degree*deg_math
--temp##################################################################
temp_radius=cpu_radius+11
temp_max=90
--temp backgound
tempbg_width=d_foreground_width+d_foreground_width
tempbg_br_width=tempbg_width+d_line_width
--backgound 1
tempbg1_start_deg=150
tempbg1_end_deg=240
tempbg1_start=tempbg1_start_deg*deg_math
tempbg1_end=tempbg1_end_deg*deg_math
--background 2
tempbg2_start_deg=300
tempbg2_end_deg=30
tempbg2_start=tempbg2_start_deg*deg_math
tempbg2_end=tempbg2_end_deg*deg_math
--temp1
temp1_start_deg=150
temp1_end_deg=190
temp1_start=temp1_start_deg*deg_math
temp1_end_rad=temp1_end_deg*deg_math
temp1_end_math=temp1_end_rad-temp1_start
temp1_scale=temp1_end_math/temp_max
temp1_end_math2=temp1*temp1_scale
temp1_end=temp1_end_math2+temp1_start
--temp2
temp2_start_deg=240
temp2_end_deg=200
temp2_start=temp2_start_deg*deg_math
temp2_end_rad=temp2_end_deg*deg_math
temp2_end_math=temp2_end_rad-temp2_start
temp2_scale=temp2_end_math/temp_max
temp2_end_math2=temp2*temp2_scale
temp2_end=temp2_end_math2+temp2_start
--temp3
temp3_start_deg=300
temp3_end_deg=340
temp3_start=temp3_start_deg*deg_math
temp3_end_rad=temp3_end_deg*deg_math
temp3_end_math=temp3_end_rad-temp3_start
temp3_scale=temp3_end_math/temp_max
temp3_end_math2=temp3*temp3_scale
temp3_end=temp3_end_math2+temp3_start
--temp4
temp4_start_deg=30
temp4_end_deg=-10
temp4_start=temp4_start_deg*deg_math
temp4_end_rad=temp4_end_deg*deg_math
temp4_end_math=temp4_end_rad-temp4_start
temp4_scale=temp4_end_math/temp_max
temp4_end_math2=temp4*temp4_scale
temp4_end=temp4_end_math2+temp4_start
--ram###################################################################
--mem background arc
mem_arc_center_x=215
mem_arc_center_y=60
mem_arc_radius=40
mem_arc_start_degree=-270
mem_arc_end_degree=-505
mem_arc_start_angle=mem_arc_start_degree*deg_math
mem_arc_end_rad=mem_arc_end_degree*deg_math
mem_arc_scale_math=mem_arc_end_rad-mem_arc_start_angle
mem_arc_scale=mem_arc_scale_math/max_value
mem_arc_end_angle_math=mem_perc*mem_arc_scale
mem_arc_end_angle=mem_arc_end_angle_math+mem_arc_start_angle
--mem foreground arc
mem_foreground_arc_center_x=mem_arc_center_x
mem_foreground_arc_center_y=mem_arc_center_y
mem_foreground_arc_radius=mem_arc_radius
mem_foreground_arc_start_degree=mem_arc_start_degree
mem_foreground_arc_end_degree=mem_arc_end_degree
mem_foreground_arc_start_angle=mem_foreground_arc_start_degree*deg_math
mem_foreground_arc_end_angle=mem_foreground_arc_end_degree*deg_math
--mem inner arc
mem_inner_arc_center_x=mem_arc_center_x
mem_inner_arc_center_y=mem_arc_center_y
mem_inner_arc_radius=8
mem_inner_arc_start_degree=0
mem_inner_arc_end_degree=360
mem_inner_arc_start_rad=mem_inner_arc_start_degree*deg_math
mem_inner_arc_end_rad=mem_inner_arc_end_degree*deg_math
--swap##################################################################
--swap background arc
swap_arc_center_x=595
swap_arc_center_y=60
swap_arc_radius=40
swap_arc_start_degree=90
swap_arc_end_degree=325
swap_arc_start_angle=swap_arc_start_degree*deg_math
swap_arc_end_rad=swap_arc_end_degree*deg_math
swap_arc_scale_math=swap_arc_end_rad-swap_arc_start_angle
swap_arc_scale=swap_arc_scale_math/max_value
swap_arc_end_angle_math=swap_perc*swap_arc_scale
swap_arc_end_angle_math2=swap_arc_end_angle_math+swap_arc_start_angle
swap_arc_end_angle=swap_arc_end_angle_math2
--swap foreground arc
swap_foreground_arc_center_x=swap_arc_center_x
swap_foreground_arc_center_y=swap_arc_center_y
swap_foreground_arc_radius=swap_arc_radius
swap_foreground_arc_start_degree=swap_arc_start_degree
swap_foreground_arc_end_degree=swap_arc_end_degree
swap_foreground_arc_start_angle=swap_foreground_arc_start_degree*deg_math
swap_foreground_arc_end_angle=swap_foreground_arc_end_degree*deg_math
--swap inner arc
swap_inner_arc_center_x=swap_arc_center_x
swap_inner_arc_center_y=swap_arc_center_y
swap_inner_arc_radius=8
swap_inner_arc_start_degree=0
swap_inner_arc_end_degree=360
swap_inner_arc_start_rad=swap_inner_arc_start_degree*deg_math
swap_inner_arc_end_rad=swap_inner_arc_end_degree*deg_math
--file system###########################################################
file_system_center_x=745
file_system_center_y=105
file_system_radius=50
file_system_inner_radius=8
file_system_inner_arc_start_degree=0
file_system_inner_arc_start_angle=file_system_inner_arc_start_degree*deg_math
file_system_inner_arc_end_degree=360
file_system_inner_arc_end_angle=file_system_inner_arc_end_degree*deg_math
--system partition
system_arc_start_degree=100
system_arc_start_angle=system_arc_start_degree*deg_math
system_arc_end_degree=260
system_arc_end_rad=system_arc_end_degree*deg_math
system_arc_difference=system_arc_end_rad-system_arc_start_angle
system_arc_end_scale=system_arc_difference/max_value
system_arc_end_angle_math=system_perc*system_arc_end_scale
system_arc_end_angle=system_arc_end_angle_math+system_arc_start_angle
--home partition
home_arc_start_degree=-280
home_arc_start_angle=home_arc_start_degree*deg_math
home_arc_end_degree=-440
home_arc_end_rad=home_arc_end_degree*deg_math
home_arc_scale_math=home_arc_end_rad-home_arc_start_angle
home_arc_scale=home_arc_scale_math/max_value
home_arc_end_angle_math=home_perc*home_arc_scale
home_arc_end_angle=home_arc_end_angle_math+home_arc_start_angle
--network###############################################################
network_center_x=65
network_center_y=105
network_radius=50
network_inner_radius=8
network_inner_arc_start_degree=0
network_inner_arc_start_angle=network_inner_arc_start_degree*deg_math
network_inner_arc_end_degree=360
network_inner_arc_end_angle=network_inner_arc_end_degree*deg_math
--down speed
down_max_value=down_scale_adjuster
down_arc_start_degree=100
down_arc_start_angle=down_arc_start_degree*deg_math
down_arc_end_degree=260
down_arc_end_rad=down_arc_end_degree*deg_math
down_arc_difference=down_arc_end_rad-down_arc_start_angle
down_arc_end_scale=down_arc_difference/down_scale_adjuster
down_arc_end_angle_math=down_speed_limited*down_arc_end_scale
down_arc_end_angle=down_arc_end_angle_math+down_arc_start_angle
--up speed
up_max_value=up_scale_adjuster
up_arc_start_degree=-280
up_arc_start_angle=up_arc_start_degree*deg_math
up_arc_end_degree=-440
up_arc_end_rad=up_arc_end_degree*deg_math
up_arc_scale_math=up_arc_end_rad-up_arc_start_angle
up_arc_scale=up_arc_scale_math/up_scale_adjuster
up_arc_end_angle_math=up_speed_limited*up_arc_scale
up_arc_end_angle=up_arc_end_angle_math+up_arc_start_angle
--labels################################################################
--font settings
cpu_avg_size=19
cpu_value_size=16
network_scale_size=10
--text
--cpu
cpu_label="cpu"
cpu_avg_label="Average"
cpu_core_1_label="Core 1: "
cpu_core_2_label="Core 2: "
cpu_core_3_label="Core 3: "
cpu_core_4_label="Core 4: "
cpu_avg=""..cpu_core_avg.."%"
cpu_value1=""..cpu_core_1.."% "
cpu_value2=""..cpu_core_2.."%"
cpu_value3=""..cpu_core_3.."% "
cpu_value4=""..cpu_core_4.."%"
--temp1
temp1_label="temp1"
temp1_value=""..temp1.."C"
--temp2
temp2_label="temp2"
temp2_value=""..temp2.."C"
--temp3
temp3_label="temp3"
temp3_value=""..temp3.."C"
--temp4
temp4_label="temp4"
temp4_value=""..temp4.."C"
--mem text
mem_label="Ram"
mem_perc_text=""..mem_perc.."%"
--swap text
swap_label="Swap"
swap_perc_text=""..swap_perc.."%"
--system
system_label="System"
system_label2="System: "..system_used.." / "..system_size..""
--home
home_label="Home"
home_label2="Home: "..home_used.." / "..home_size..""
--down
down_label="Down"
down_speed_value=conky_parse("${downspeedf}")
down_speed_text=""..down_speed_value.."KiB/s"
down_label2="Down: "..down_speed_text..""
down_scale=down_scale_adjuster
--up
up_label="Up"
up_speed_value=conky_parse("${upspeedf}")
up_speed_text=""..up_speed_value.."KiB/s"
up_label2="Up: "..up_speed_text..""
up_scale=up_scale_adjuster
--x and y values
--cpu
cpu_label_x=393
cpu_label_y=150
cpu_avg_label_x=365
cpu_avg_label_y=55
cpu_avg_x=cpu_avg_label_x+28
cpu_avg_y=cpu_avg_label_y+20
cpu_value1_x=295
cpu_value1_y=105
cpu_value2_x=cpu_value1_x
cpu_value2_y=cpu_value1_y+15
cpu_value3_x=405
cpu_value3_y=105
cpu_value4_x=cpu_value3_x
cpu_value4_y=cpu_value3_y+15
cpu_scale_low_x=305
cpu_scale_low_y=180
cpu_scale_high_x=605
cpu_scale_high_y=180
--temp1
temp1_label_x=232
temp1_label_y=135
temp1_value_x=temp1_label_x
temp1_value_y=temp1_label_y+15
--temp2
temp2_label_x=270
temp2_label_y=35
temp2_value_x=temp2_label_x
temp2_value_y=temp2_label_y+15
--temp3
temp3_label_x=520
temp3_label_y=35
temp3_value_x=temp3_label_x
temp3_value_y=temp3_label_y+15
--temp4
temp4_label_x=548
temp4_label_y=135
temp4_value_x=temp4_label_x
temp4_value_y=temp4_label_y+15
--mem
mem_label_x=182
mem_label_y=62
mem_perc_text_x=227
mem_perc_text_y=63
mem_used_x=195
mem_used_y=85
mem_max_x=130
mem_max_y=30
--swap
swap_label_x=605
swap_label_y=62
swap_perc_text_x=563
swap_perc_text_y=63
swap_used_x=575
swap_used_y=85
swap_max_x=630
swap_max_y=30
--system
system_label_x=720
system_label_y=125
system_label2_x=600
system_label2_y=175
--home
home_label_x=775
home_label_y=120
home_label2_x=system_label2_x
home_label2_y=system_label2_y+12
--down
down_label_x=40
down_label_y=117
down_label2_x=panel_point3_x
down_label2_y=panel_point2_y
down_scale_x=35
down_scale_y=50
--up
up_label_x=95
up_label_y=110
up_label2_x=down_label2_x
up_label2_y=down_label2_y+12
up_scale_x=72
up_scale_y=50
--######################################################################
-- Main Body Backgound, Alert and Labels Sections
--######################################################################
-- panel fill
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,panel_start_x,panel_start_y)
cairo_line_to(cr,panel_point2_x,panel_point2_y)
cairo_line_to(cr,panel_point3_x,panel_point3_y)
cairo_line_to(cr,panel_point4_x,panel_point4_y)
cairo_line_to(cr,panel_point5_x,panel_point5_y)
cairo_line_to(cr,panel_point6_x,panel_point6_y)
cairo_line_to(cr,panel_point7_x,panel_point7_y)
cairo_line_to(cr,panel_point8_x,panel_point8_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,d_fill_color_red,d_fill_color_green,d_fill_color_blue,d_fill_color_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,panel_border_color_red,panel_border_color_green,panel_border_color_blue,panel_border_color_alpha)
cairo_stroke(cr)
--seperator 1
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,seperator1_start_x,seperator1_start_y)
cairo_line_to(cr,seperator1_point1_x,seperator1_point1_y)
cairo_line_to(cr,seperator1_end_x,seperator1_end_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,seperator_fill_color_red,seperator_fill_color_green,seperator_fill_color_blue,seperator_fill_color_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_stroke(cr)
--seperator 2
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,seperator2_start_x,seperator2_start_y)
cairo_line_to(cr,seperator2_point1_x,seperator2_point1_y)
cairo_line_to(cr,seperator2_end_x,seperator2_end_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,seperator_fill_color_red,seperator_fill_color_green,seperator_fill_color_blue,seperator_fill_color_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_stroke(cr)
--panel border
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,panel_start_x,panel_start_y)
cairo_line_to(cr,panel_point2_x,panel_point2_y)
cairo_line_to(cr,panel_point3_x,panel_point3_y)
cairo_line_to(cr,panel_point4_x,panel_point4_y)
cairo_line_to(cr,panel_point5_x,panel_point5_y)
cairo_line_to(cr,panel_point6_x,panel_point6_y)
cairo_line_to(cr,panel_point7_x,panel_point7_y)
cairo_line_to(cr,panel_point8_x,panel_point8_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,panel_border_color_red,panel_border_color_green,panel_border_color_blue,panel_border_color_alpha)
cairo_stroke(cr)
--alert system##########################################################
--master alert
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,m_a_size)
if alert_level >= 2 then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_save(cr)
cairo_translate(cr,m_a_t1_x,m_a_t1_y)
cairo_rotate(cr,m_a_t1_rad)
cairo_show_text(cr,m_a_t1)
cairo_stroke(cr)
cairo_restore(cr)
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,m_a_size)
if alert_level >= 1 then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_save(cr)
cairo_translate(cr,m_a_t2_x,m_a_t2_y)
cairo_rotate(cr,m_a_t2_rad)
cairo_show_text(cr,m_a_t2)
cairo_stroke(cr)
cairo_restore(cr)
--alert panel 1
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,a_panel1_p1_x,a_panel1_p1_y)
cairo_line_to(cr,a_panel1_p2_x,a_panel1_p2_y)
cairo_line_to(cr,a_panel1_p3_x,a_panel1_p3_y)
cairo_line_to(cr,a_panel1_p4_x,a_panel1_p4_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,seperator_fill_color_red,seperator_fill_color_green,seperator_fill_color_blue,seperator_fill_color_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_stroke(cr)
--alert panel 2
cairo_set_line_width(cr,d_line_width)
cairo_move_to(cr,a_panel2_p1_x,a_panel2_p1_y)
cairo_line_to(cr,a_panel2_p2_x,a_panel2_p2_y)
cairo_line_to(cr,a_panel2_p3_x,a_panel2_p3_y)
cairo_line_to(cr,a_panel2_p4_x,a_panel2_p4_y)
cairo_close_path(cr)
cairo_set_source_rgba(cr,seperator_fill_color_red,seperator_fill_color_green,seperator_fill_color_blue,seperator_fill_color_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_stroke(cr)
--network alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if network_status == 1 then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,network_a_x,network_a_y)
cairo_show_text (cr,network_a_t)
cairo_stroke (cr)
--mem alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if mem_perc >= alert_value then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,mem_a_x,mem_a_y)
cairo_show_text (cr,mem_label)
cairo_stroke (cr)
--cpu alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if (cpu_core_avg) >= (alert_value) then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,cpu_a_x,cpu_a_y)
cairo_show_text (cr,cpu_label)
cairo_stroke (cr)
--swap alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if (swap_perc) >= (alert_value) then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,swap_a_x,swap_a_y)
cairo_show_text (cr,swap_a_t)
cairo_stroke (cr)
--system alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if (system_perc) >= (alert_value) then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,system_a_x,system_a_y)
cairo_show_text (cr,system_a_t)
cairo_stroke (cr)
--home alert icon
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
if (home_perc) >= (alert_value) then
cairo_set_source_rgba (cr,alert_color2_red,alert_color2_green,alert_color2_blue,alert_color2_alpha)
else
cairo_set_source_rgba (cr,alert_color1_red,alert_color1_green,alert_color1_blue,alert_color1_alpha)
end
cairo_move_to (cr,home_a_x,home_a_y)
cairo_show_text (cr,home_label)
cairo_stroke (cr)
--labels################################################################
--cpu label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_label_x,cpu_label_y)
cairo_show_text (cr,cpu_label)
cairo_stroke (cr)
--cpu average label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_avg_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_avg_label_x,cpu_avg_label_y)
cairo_show_text (cr,cpu_avg_label)
cairo_stroke (cr)
--cpu average
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_avg_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_avg_x,cpu_avg_y)
cairo_show_text (cr,cpu_avg)
cairo_stroke (cr)
--cpu core 1
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_value_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_value1_x,cpu_value1_y)
cairo_show_text (cr,cpu_core_1_label)
cairo_show_text (cr,cpu_value1)
cairo_stroke (cr)
--cpu core 2
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_value_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_value2_x,cpu_value2_y)
cairo_show_text (cr,cpu_core_2_label)
cairo_show_text (cr,cpu_value2)
cairo_stroke (cr)
--cpu core 3
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_value_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_value3_x,cpu_value3_y)
cairo_show_text (cr,cpu_core_3_label)
cairo_show_text (cr,cpu_value3)
cairo_stroke (cr)
--cpu core 4
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,cpu_value_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,cpu_value4_x,cpu_value4_y)
cairo_show_text (cr,cpu_core_4_label)
cairo_show_text (cr,cpu_value4)
cairo_stroke (cr)
--temp 1 label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp1_label_x,temp1_label_y)
cairo_show_text (cr,temp1_label)
cairo_stroke (cr)
--temp 1 value
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp1_value_x,temp1_value_y)
cairo_show_text (cr,temp1_value)
cairo_stroke (cr)
--temp 2 label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp2_label_x,temp2_label_y)
cairo_show_text (cr,temp2_label)
cairo_stroke (cr)
--temp 2 value
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp2_value_x,temp2_value_y)
cairo_show_text (cr,temp2_value)
cairo_stroke (cr)
--temp 3 label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp3_label_x,temp3_label_y)
cairo_show_text (cr,temp3_label)
cairo_stroke (cr)
--temp 3 value
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp3_value_x,temp3_value_y)
cairo_show_text (cr,temp3_value)
cairo_stroke (cr)
--temp 4 label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp4_label_x,temp4_label_y)
cairo_show_text (cr,temp4_label)
cairo_stroke (cr)
--temp 4 value
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,temp4_value_x,temp4_value_y)
cairo_show_text (cr,temp4_value)
cairo_stroke (cr)
--mem_label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,mem_label_x,mem_label_y)
cairo_show_text (cr,mem_label)
cairo_stroke (cr)
--mem_perc
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,mem_perc_text_x,mem_perc_text_y)
cairo_show_text (cr,mem_perc_text)
cairo_stroke (cr)
--mem_used
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,mem_used_x,mem_used_y)
cairo_show_text (cr,mem_used)
cairo_stroke (cr)
--mem_max
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,mem_max_x,mem_max_y)
cairo_show_text (cr,mem_max)
cairo_stroke (cr)
--swap_label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,swap_label_x,swap_label_y)
cairo_show_text (cr,swap_label)
cairo_stroke (cr)
--swap_perc
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,swap_perc_text_x,swap_perc_text_y)
cairo_show_text (cr,swap_perc_text)
cairo_stroke (cr)
--swap_used
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,swap_used_x,swap_used_y)
cairo_show_text (cr,swap_used)
cairo_stroke (cr)
--swap_max
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,swap_max_x,swap_max_y)
cairo_show_text (cr,swap_max)
cairo_stroke (cr)
--system label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_save(cr)
cairo_translate (cr,system_label_x,system_label_y)
cairo_rotate(cr,rotate_r)
cairo_show_text (cr,system_label)
cairo_stroke (cr)
cairo_restore(cr)
--system label 2
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,system_label2_x,system_label2_y)
cairo_show_text (cr,system_label2)
cairo_stroke (cr)
--home label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_save(cr)
cairo_translate (cr,home_label_x,home_label_y)
cairo_rotate(cr,rotate_r)
cairo_show_text (cr,home_label)
cairo_stroke (cr)
cairo_restore(cr)
--home label 2
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,home_label2_x,home_label2_y)
cairo_show_text (cr,home_label2)
cairo_stroke (cr)
--down label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_save(cr)
cairo_translate (cr,down_label_x,down_label_y)
cairo_rotate(cr,rotate_r)
cairo_show_text (cr,down_label)
cairo_stroke (cr)
cairo_restore(cr)
--down label 2
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,down_label2_x,down_label2_y)
cairo_show_text (cr,down_label2)
cairo_stroke (cr)
--down scale
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,network_scale_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,down_scale_x,down_scale_y)
cairo_show_text (cr,down_scale)
cairo_stroke (cr)
--up label
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_save(cr)
cairo_translate (cr,up_label_x,up_label_y)
cairo_rotate(cr,rotate_r)
cairo_show_text (cr,up_label)
cairo_stroke (cr)
cairo_restore(cr)
--up label 2
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,d_font_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,up_label2_x,up_label2_y)
cairo_show_text (cr,up_label2)
cairo_stroke (cr)
--up scale
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,network_scale_size)
cairo_set_source_rgba (cr,d_font_color_red,d_font_color_green,d_font_color_blue,d_font_color_alpha)
cairo_move_to (cr,up_scale_x,up_scale_y)
cairo_show_text (cr,up_scale)
cairo_stroke (cr)
--######################################################################
-- Main Body Gauge Section
--######################################################################
--cpu###################################################################
--cpu arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc(cr,cpu_arc_center_x,cpu_arc_center_y,cpu_arc_radius,cpu_arc_start_angle,cpu_arc_end_angle)
--cpu needle
cairo_line_to(cr,cpu_inner_arc_center_x,cpu_inner_arc_center_y)
cairo_stroke(cr)
--cpu_foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,cpu_foreground_arc_center_x,cpu_foreground_arc_center_y,cpu_foreground_arc_radius,cpu_foreground_arc_start_angle,cpu_foreground_arc_end_angle)
cairo_stroke(cr)
--cpu inner arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_inner_arc_color_red,d_inner_arc_color_green,d_inner_arc_color_blue,d_inner_arc_color_alpha)
cairo_arc(cr,cpu_inner_arc_center_x,cpu_inner_arc_center_y,cpu_inner_arc_radius,cpu_inner_arc_start_rad,cpu_inner_arc_end_rad)
cairo_stroke(cr)
--temp##################################################################
--backgound1
cairo_set_line_width(cr,tempbg_br_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,tempbg1_start,tempbg1_end)
cairo_stroke(cr)
--temp 1 background
cairo_set_line_width(cr,tempbg_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,tempbg_red,tempbg_green,tempbg_blue,tempbg_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,temp1_start,temp1_end_rad)
cairo_stroke(cr)
--temp 2 background
cairo_set_line_width(cr,tempbg_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,tempbg_red,tempbg_green,tempbg_blue,tempbg_alpha)
cairo_arc_negative(cr,cpu_center_x,cpu_center_y,temp_radius,temp2_start,temp2_end_rad)
cairo_stroke(cr)
--background2
cairo_set_line_width(cr,tempbg_br_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,tempbg2_start,tempbg2_end)
cairo_stroke(cr)
--temp 3 background
cairo_set_line_width(cr,tempbg_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,tempbg_red,tempbg_green,tempbg_blue,tempbg_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,temp3_start,temp3_end_rad)
cairo_stroke(cr)
--temp 4 background
cairo_set_line_width(cr,tempbg_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,tempbg_red,tempbg_green,tempbg_blue,tempbg_alpha)
cairo_arc_negative(cr,cpu_center_x,cpu_center_y,temp_radius,temp4_start,temp4_end_rad)
cairo_stroke(cr)
--temp 1
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,temp1_start,temp1_end)
cairo_stroke(cr)
--temp 2
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc_negative(cr,cpu_center_x,cpu_center_y,temp_radius,temp2_start,temp2_end)
cairo_stroke(cr)
--temp 3
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,cpu_center_x,cpu_center_y,temp_radius,temp3_start,temp3_end)
cairo_stroke(cr)
--temp 4
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc_negative(cr,cpu_center_x,cpu_center_y,temp_radius,temp4_start,temp4_end)
cairo_stroke(cr)
--mem###################################################################
--mem arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc_negative(cr,mem_arc_center_x,mem_arc_center_y,mem_arc_radius,mem_arc_start_angle,mem_arc_end_angle)
--mem needle
cairo_line_to(cr,mem_arc_center_x,mem_arc_center_y)
cairo_stroke(cr)
--mem_foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc_negative(cr,mem_foreground_arc_center_x,mem_foreground_arc_center_y,mem_foreground_arc_radius,mem_foreground_arc_start_angle,mem_foreground_arc_end_angle)
cairo_stroke(cr)
--mem inner arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_inner_arc_color_red,d_inner_arc_color_green,d_inner_arc_color_blue,d_inner_arc_color_alpha)
cairo_arc(cr,mem_inner_arc_center_x,mem_inner_arc_center_y,mem_inner_arc_radius,mem_inner_arc_start_rad,mem_inner_arc_end_rad)
cairo_stroke(cr)
--swap##################################################################
--swap arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc(cr,swap_arc_center_x,swap_arc_center_y,swap_arc_radius,swap_arc_start_angle,swap_arc_end_angle)
--swap needle
cairo_line_to(cr,swap_arc_center_x,swap_arc_center_y)
cairo_stroke(cr)
--swap_foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,swap_foreground_arc_center_x,swap_foreground_arc_center_y,swap_foreground_arc_radius,swap_foreground_arc_start_angle,swap_foreground_arc_end_angle)
cairo_stroke(cr)
--swap inner arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_inner_arc_color_red,d_inner_arc_color_green,d_inner_arc_color_blue,d_inner_arc_color_alpha)
cairo_arc(cr,swap_inner_arc_center_x,swap_inner_arc_center_y,swap_inner_arc_radius,swap_inner_arc_start_rad,swap_inner_arc_end_rad)
cairo_stroke(cr)
--file system###########################################################
--system indicator arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc(cr,file_system_center_x,file_system_center_y,file_system_radius,system_arc_start_angle,system_arc_end_angle)
--system needle
cairo_line_to(cr,file_system_center_x,file_system_center_y)
cairo_stroke(cr)
--system foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,file_system_center_x,file_system_center_y,file_system_radius,system_arc_start_angle,system_arc_end_rad)
cairo_stroke(cr)
--home indicator arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc_negative(cr,file_system_center_x,file_system_center_y,file_system_radius,home_arc_start_angle,home_arc_end_angle)
--home needle
cairo_line_to(cr,file_system_center_x,file_system_center_y)
cairo_stroke(cr)
--home foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc_negative(cr,file_system_center_x,file_system_center_y,file_system_radius,home_arc_start_angle,home_arc_end_rad)
cairo_stroke(cr)
--inner arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_inner_arc_color_red,d_inner_arc_color_green,d_inner_arc_color_blue,d_inner_arc_color_alpha)
cairo_arc(cr,file_system_center_x,file_system_center_y,file_system_inner_radius,file_system_inner_arc_start_angle,file_system_inner_arc_end_angle)
cairo_stroke(cr)
--network###############################################################
--down indicator arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc(cr,network_center_x,network_center_y,network_radius,down_arc_start_angle,down_arc_end_angle)
--down needle
cairo_line_to(cr,network_center_x,network_center_y)
cairo_stroke(cr)
--down foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc(cr,network_center_x,network_center_y,network_radius,down_arc_start_angle,down_arc_end_rad)
cairo_stroke(cr)
--up indicator arc
cairo_set_line_width(cr,d_line_width)
cairo_set_source_rgba(cr,d_gauge_color_red,d_gauge_color_green,d_gauge_color_blue,d_gauge_color_alpha)
cairo_arc_negative(cr,network_center_x,network_center_y,network_radius,up_arc_start_angle,up_arc_end_angle)
--up needle
cairo_line_to(cr,network_center_x,network_center_y)
cairo_stroke(cr)
--up foreground arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_foreground_color_red,d_foreground_color_green,d_foreground_color_blue,d_foreground_color_alpha)
cairo_arc_negative(cr,network_center_x,network_center_y,network_radius,up_arc_start_angle,up_arc_end_rad)
cairo_stroke(cr)
--inner arc
cairo_set_line_width(cr,d_foreground_width)
cairo_set_source_rgba(cr,d_inner_arc_color_red,d_inner_arc_color_green,d_inner_arc_color_blue,d_inner_arc_color_alpha)
cairo_arc(cr,network_center_x,network_center_y,network_inner_radius,network_inner_arc_start_angle,network_inner_arc_end_angle)
cairo_stroke(cr)
--######################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

@sector11 I was wondering what you mean by "I find it really heavy on memory usage though.", mine doesn't seem heavy. Of course I don't know what heavy is really as I have just started.
mine:    mem: 4.60MB (0.1%) command: conky pid: 30115


You can find my work here

Make everything ok button

Offline

#3878 2012-11-19 23:21:56

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: The New Monster Conky Thread

Can your guys help this post?

http://crunchbang.org/forums/viewtopic.php?id=23166

I can't reproduce the posters problem, and know nothing

Last edited by dura (2012-11-19 23:28:00)

Offline

#3879 2012-11-20 02:24:49

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

ansem_of_nexus wrote:

@sector11 I was wondering what you mean by "I find it really heavy on memory usage though.", mine doesn't seem heavy. Of course I don't know what heavy is really as I have just started.
mine:    mem: 4.60MB (0.1%) command: conky pid: 30115

My image of the working code, look at the memory usage:
http://t.imgbox.com/acm3TSJI.jpg
I have an AMD64 X3 with 6GB RAM

This is me running 8 conkys.  My CPU usage sits at a comfortable 5% using 214MB RAM or 3%
8-conkys

Going to take me a while to figure out your new code you went from 2 CPUs to 4 CPUs (one more than I have) and temp codes from 3 to 4 ${hwmon} calls but didn't label what they are and I don't have that many:

cpu_core_avg=tonumber(conky_parse("${cpu cpu0}"))
cpu_core_1=tonumber(conky_parse("${cpu cpu1}"))
cpu_core_2=tonumber(conky_parse("${cpu cpu2}"))
cpu_core_3=tonumber(conky_parse("${cpu cpu3}"))
--cpu_core_4=tonumber(conky_parse("${cpu cpu4}"))
temp1=conky_parse("${hwmon temp 1}")
temp2=conky_parse("${hwmon temp 2}")
temp3=conky_parse("${hwmon temp 3}")
temp4=conky_parse("${hwmon temp 4}")

I'm looking forward to the challenge.

Offline

#3880 2012-11-20 03:12:24

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

dura wrote:

Can your guys help this post?

http://crunchbang.org/forums/viewtopic.php?id=23166

I can't reproduce the posters problem, and know nothing

Thank you!

Offline

#3881 2012-11-20 03:24:59

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

@sector11 I added the 4 cores and 4 temps so that it was easier to configure to each pc, I have only 2 cores and 3 temps. I comment out 2 cores and 2 temps so that mine shows only my CPU and mobo. Sensors and inxi -s in terminal gave me the names so I change the "temp#" to the correct name. Once I am done, all that is left is changing the ends of the temp outline to only go as far as the 2 temps and adjust the core perc labels from 295 to 355, so they are centered under the average.

yours will be a little different cause of the 3 core and however many temps you want. I can look up all the line numbers and post what to change to get 3 cores, but your temps will be a little hard as I thought I saw multiple arrays with multiple temps


You can find my work here

Make everything ok button

Offline

#3882 2012-11-20 03:57:36

McLovin
#! CrunchBanger
From: my computer chair
Registered: 2009-02-28
Posts: 105
Website

Re: The New Monster Conky Thread

Great, now I have to steal this dashboard conky, edit the crap out of it, make my own, and be up for days on end.  hmm


monkey Got /? | The first GUI, and "on-line" system was created in 1968 by Douglas Engelbart, the system included modern day innovations such as video conferencing, and on-line file sharing.

Offline

#3883 2012-11-20 04:07:27

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

McLovin wrote:

Great, now I have to steal this dashboard conky, edit the crap out of it, make my own, and be up for days on end.  hmm

And what is wrong with staying up for days on end?


You can find my work here

Make everything ok button

Offline

#3884 2012-11-20 04:10:55

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

ansem_of_nexus wrote:

@sector11
yours will be a little different cause of the 3 core and however many temps you want. I can look up all the line numbers and post what to change to get 3 cores, but your temps will be a little hard as I thought I saw multiple arrays with multiple temps

Thank you ... but no thank you.  Like I said: I'm looking forward to the challenge. and LUA is a brain teaser for me ... if I don't get it and start pulling my last 6 hairs out I'll come back crawling and asking.  big_smile

I have 4 temps but only 2 are from sensors: CPU and Mobo, the other two are:

SDA: ${execi 15 hddtemp -n /dev/sda}°, and
GPU: ${nvidia temp}°

Unfortunately I can't seem to get LUA to recognize my CPU and Mobo temps:

CPU: ${platform f71882fg.2560 temp 1}°
MB: ${platform f71882fg.2560 temp 2}°

so I have to convert them to ${hwmon}

Offline

#3885 2012-11-20 04:13:20

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

McLovin wrote:

Great, now I have to steal this dashboard conky, edit the crap out of it, make my own, and be up for days on end.  hmm

glasses  <<-- conky addict eyes!

Now that you're here where is your kit car?  I saw it in passing but had a lot going on and lost touch with it.

Just a link if you have it handy, please.

Offline

#3886 2012-11-20 04:14:16

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

Sector11 wrote:
ansem_of_nexus wrote:

@sector11
yours will be a little different cause of the 3 core and however many temps you want. I can look up all the line numbers and post what to change to get 3 cores, but your temps will be a little hard as I thought I saw multiple arrays with multiple temps

Thank you ... but no thank you.  Like I said: I'm looking forward to the challenge. and LUA is a brain teaser for me ... if I don't get it and start pulling my last 6 hairs out I'll come back crawling and asking.  big_smile

I have 4 temps but only 2 are from sensors: CPU and Mobo, the other two are:

SDA: ${execi 15 hddtemp -n /dev/sda}°, and
GPU: ${nvidia temp}°

Unfortunately I can't seem to get LUA to recognize my CPU and Mobo temps:

CPU: ${platform f71882fg.2560 temp 1}°
MB: ${platform f71882fg.2560 temp 2}°

so I have to convert them to ${hwmon}

I see, good luck. Can't wait to see what you get, I would also like to know if you continue to have to deal with it being heavy on your ram.


You can find my work here

Make everything ok button

Offline

#3887 2012-11-20 05:09:27

McLovin
#! CrunchBanger
From: my computer chair
Registered: 2009-02-28
Posts: 105
Website

Re: The New Monster Conky Thread

Sector11 wrote:

Didier-T over in the Ubuntu-fr forums is a genius!

I saw his "Chronograph" work and thought I would have to reconfigure the lua script to get the 24 hours back yet again!

Not even close he made it simple!  Look at the options:

require 'cairo'
-- Position et taille horloge (Clock position and size) - Configure The Chronograph
local init={
center_x=175,
center_y=175,
radius=170, -- do not touch
lang="English", --English or Spanish or French
hour=24, --12 or 24
second=true, --true or false
line=true, --hand secondes true or false
handday=false, --hand day true or false
handdaynum=false, --hand day number true or false
handmonth=false, --hand month true or false
color=0xFF0000, --color for day, day number and month if no hand
alpha=1 --alpha for day, day number and month if no hand
}

I have a feeling there will be a few more people over on #! using this version.  I know I will be using it now.

If he falls: He's food!
http://t.imgbox.com/acc51SgT.jpg
Excellent work Didier!

This is: chronograph-Didier-T.lua with a change to the fonts used: monofur and Liquid Crystal

--[[ 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
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={
center_x=175,
center_y=175,
radius=170, -- do not touch
lang="English", --English or Spanish or French
hour=24, --12 or 24
second=true, --true or false
line=true, --hand secondes true or false
handday=false, --hand day true or false
handdaynum=false, --hand day number true or false
handmonth=false, --hand month true or false
color=0xFF0000, --color for day, day number and month if no hand
alpha=1 --alpha for day, day number and month if no hand
}

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

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}")

local clock_type_A=init.hour -- Large Main 24 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=init.center_x
local center_y=init.center_y-85
local radius=50
-- 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,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",}	end	-- English
if init.lang == "Spanish" then text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}	end	-- Spanish
if init.lang == "French" then text_days={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam",}	end	-- French
local day_number=tonumber(os.date("%w"))
if init.handday == true then
  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
  local radius=35
  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
  local hand_length=30
  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)
else
  for i=1,7 do
    -- work out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    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
  local radius=35
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    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

end
-- ### END DIAL B #########################################

-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x+85
local center_y=init.center_y
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,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end -- English
if init.lang == "Spanish" then text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} end -- Spanish
if init.lang == "French" then text_days={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc",} end -- French
local this_month=tonumber(os.date("%m"))

if init.handmonth == true then
  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
  -- DRAW HAND -- snaps to current month
  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)
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    -- 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
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    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
-- ### 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});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- 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=init.center_x-85
local center_y=init.center_y
local radius=50
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
local this_day=tonumber(os.date("%d"))
if init.handdaynum == true then
  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, 2) == 0 then
      --set text when even
      text=string.format("%02d",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
  local radius=40
  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
  local hand_length=35--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)
else
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    -- 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, 2) == 0 then
      --set text when even
      text=string.format("%02d",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
  local radius=40
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,1)
    end
    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
end
-- ### 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=init.center_x
clock_centery=init.center_y+85
-- 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
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- 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=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,.5-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- 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,1,1,.5-- 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=init.center_x
clock_centery=init.center_y
-- 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)
]]
-- ####################################################################
local center_x=init.center_x
local center_y=init.center_y
local radius=init.radius-5
cairo_select_font_face (cr, "Liquid Crystal", 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
if init.hour == 12 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11",}
  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=150
  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
if init.hour == 24 then
  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
end

-- part of a second hand
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=140
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=158
  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)
end
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
--affiche secondes
  if init.hour == 12 and init.second == true then
    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","",}
    -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,1)
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=150
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,1)
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,1,1,1,1)
        else
          cairo_set_source_rgba (cr,0,1,1,1)
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    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
      if seconds == tonumber(text) then
        cairo_set_source_rgba (cr,0,0,1,1)
      else
        cairo_set_source_rgba (cr,0,1,1,1)
      end
      --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
  end
-- Fin affiche secondes
-- FONT

-- ########################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function rgb_to_r_g_b(col,alp) -- ONLY NEED ONE COPY OF THIS FUNCTION
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

Here it is running clean:
http://t.imgbox.com/acuON5tf.jpg http://t.imgbox.com/adqEmEmd.jpg
I have some circle tweaking to do  big_smile

For some reason I can't get this clock to work at all, not sure where the issue on my system, gonna have to work on it and see what is going on


monkey Got /? | The first GUI, and "on-line" system was created in 1968 by Douglas Engelbart, the system included modern day innovations such as video conferencing, and on-line file sharing.

Offline

#3888 2012-11-20 07:49:09

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: The New Monster Conky Thread

A new one Im working on

tZ2RsdA

Last edited by lwfitz (2012-11-20 07:51:21)

Offline

#3889 2012-11-20 07:58:40

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

lwfitz wrote:

A new one Im working on

http://ompldr.org/tZ2RsdA

How do you make those gauges?


You can find my work here

Make everything ok button

Offline

#3890 2012-11-20 08:13:05

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: The New Monster Conky Thread

ansem_of_nexus wrote:

How do you make those gauges?

Which ones do you mean?

On the left its being pulled from mrpeachys

allcombined.lua

--[[ by mrpeachy - 
combines background bar and calendar functions
]]
require 'cairo'
require 'imlib2'

function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end

function conky_gradbar(bartab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--convert to table
local bartab=loadstring("return" .. bartab)()
local bar_startx=bartab[1]
local bar_starty=bartab[2]
local number=bartab[3]
local number=conky_parse(number)
local number_max=bartab[4]
local divisions=bartab[5]
local div_width=bartab[6]
local div_height=bartab[7]
local div_gap=bartab[8]
local bg_col=bartab[9]
local bg_alpha=bartab[10]
local st_col=bartab[11]
local st_alpha=bartab[12]
local mid_col=bartab[13]
local mid_alpha=bartab[14]
local end_col=bartab[15]
local end_alpha=bartab[16]
--color conversion
local br,bg,bb,ba=rgb_to_r_g_b({bg_col,bg_alpha})
local sr,sg,sb,sa=rgb_to_r_g_b({st_col,st_alpha})
local mr,mg,mb,ma=rgb_to_r_g_b({mid_col,mid_alpha})
local er,eg,eb,ea=rgb_to_r_g_b({end_col,end_alpha})
if number==nil then number=0 end
local number_divs=(number/number_max)*divisions
cairo_set_line_width (cr,div_width)
--gradient calculations
for i=1,divisions do
if i<(divisions/2) and i<=number_divs then
colr=((mr-sr)*(i/(divisions/2)))+sr
colg=((mg-sg)*(i/(divisions/2)))+sg
colb=((mb-sb)*(i/(divisions/2)))+sb
cola=((ma-sa)*(i/(divisions/2)))+sa
elseif i>=(divisions/2) and i<=number_divs then
colr=((er-mr)*((i-(divisions/2))/(divisions/2)))+mr
colg=((eg-mg)*((i-(divisions/2))/(divisions/2)))+mg
colb=((eb-mb)*((i-(divisions/2))/(divisions/2)))+mb
cola=((ea-ma)*((i-(divisions/2))/(divisions/2)))+ma
else
colr=br
colg=bg
colb=bb
cola=ba
end
cairo_set_source_rgba (cr,colr,colg,colb,cola)
cairo_move_to (cr,bar_startx+((div_width+div_gap)*i-1),bar_starty)
cairo_rel_line_to (cr,0,div_height)
cairo_stroke (cr)
end
--#########################################################################################################
end-- if updates>5
bartab=nil
colr=nil
colg=nil
colb=nil
cola=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function conky_draw_bg(bgtab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--#########################################################################################################
--convert to table
local bgtab=loadstring("return" .. bgtab)()
local r=bgtab[1]
local x=bgtab[2]
local y=bgtab[3]
local w=bgtab[4]
local h=bgtab[5]
local color=bgtab[6]
local alpha=bgtab[7]
if w==0 then 
w=tonumber(conky_window.width)
end
if h==0 then
h=tonumber(conky_window.height)
end
cairo_set_source_rgba (cr,rgb_to_r_g_b({color,alpha}))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
--the drawing part---------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
--#########################################################################################################
bgtab=nil
w=nil
h=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function conky_luacal(caltab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--####################################################################################################
local caltab=loadstring("return" .. caltab)()
local cal_x=caltab[1]
local cal_y=caltab[2]
local tfont=caltab[3]
local tfontsize=caltab[4]
local tc=caltab[5]
local ta=caltab[6]
local bfont=caltab[7]
local bfontsize=caltab[8]
local bc=caltab[9]
local ba=caltab[10]
local hfont=caltab[11]
local hfontsize=caltab[12]
local hc=caltab[13]
local ha=caltab[14]
local spacer=caltab[15]
local gaph=caltab[16]
local gapt=caltab[17]
local gapl=caltab[18]
local sday=caltab[19]
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b({tc,ta})
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b({bc,ba})
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b({hc,ha})
--###################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end     
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then 
dlen=35
plen=29 
else 
dlen=42 
plen=36
end
for i=1,dlen do
	if i<=start_day then 
	dnum[i]="  " 
	else 
	dn=i-start_day
		if dn=="nil" then dn=0 end
		if dn<=9 then dn=(spacer .. dn) end
		if i>x then dn="" end
		dnum[i]=dn
		dnumh[i]=dn
		if dn==(spacer .. today) or dn==today then
		dnum[i]=""
		end 
		if dn==(spacer .. today) or dn==today then
		dnumh[i]=dn
		place=i 
		else dnumh[i]="  " 
		end 
	end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
if tonumber(sday)==0 then
dys={"SU","MO","TU","WE","TH","FR","SA"}
else
dys={"MO","TU","WE","TH","FR","SA","SU"}
end
--draw calendar titles
for i=1,7 do
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
	for i=fn,fn+6 do
	cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
	cairo_show_text (cr, dnum[i])
	cairo_stroke (cr)
	end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
	for i=fn,fn+6 do
	cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
	cairo_show_text (cr, dnumh[i])
	cairo_stroke (cr)
	end
end
--#########################################################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function conky_luaimage(imtab)
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--#########################################################################################################
local imtab=loadstring("return" .. imtab)()
local im_x=imtab[1]
local im_y=imtab[2]
local im_w=imtab[3]
local im_h=imtab[4]
local file=imtab[5]
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(im_w)==0 then 
width=imlib_image_get_width() 
else
width=tonumber(im_w)
end
if tonumber(im_h)==0 then 
height=imlib_image_get_height() 
else
height=tonumber(im_h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(im_x, im_y)
imlib_free_image()
show=nil
--#########################################################################################################
imtab=nil
height=nil
width=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function conky_tex_bg(textab)
local textab=loadstring("return" .. textab)()
local tex_file=textab[6]
local surface = cairo_image_surface_create_from_png(tostring(tex_file))
local cw,ch = conky_window.width, conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw,ch)
local cr=cairo_create(cs)
--#########################################################################################################
--convert to table
local r=textab[1]
local x=textab[2]
local y=textab[3]
local w=textab[4]
local h=textab[5]
if w=="0" then
w=cw
end
if h=="0" then
h=ch
end
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
--the drawing part---------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_clip (cr)
cairo_new_path (cr);
--image part
cairo_set_source_surface (cr, surface, 0, 0)
cairo_paint (cr)
--#########################################################################################################
textab=nil
w=nil
h=nil
cairo_destroy(cr)
cairo_surface_destroy (cs)
cairo_surface_destroy (surface)
cr=nil
return ""
end-- end main function

function conky_luatext(txttab)--x,y,c,a,f,fs,txt,j ##################################################
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--#########################################################################################################
--convert to table
local txttab=loadstring("return" .. txttab)()
local x=txttab[1]
local y=txttab[2]
local c=txttab[3]
local a=txttab[4]
local f=txttab[5]
local fs=txttab[6]
local j=txttab[7]
local txt=txttab[8]
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,txt,extents)
local wx=extents.x_advance
cairo_set_source_rgba (cr,rgb_to_r_g_b({c,a}))
if j=="l" then
cairo_move_to (cr,x,y)
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
end
cairo_show_text (cr,txt)
cairo_stroke (cr)
--#########################################################################################################
txttab=nil
cairo_destroy(cr)
cairo_surface_destroy (cs)
cr=nil
return ""
end-- end main function

to use the allcombined.lua you call the function you want with these

lua_load /home/luke/Conky/allcombined_2.lua

## lua funcions
## background ##################################################################
#${lua draw_bg {corner_radius,x_position,y_position,width,height,color,alpha,draw_type,line_width,outline_color,outline_alpha}}
#note for background: set width=0 - width will be conky window width, set height=0 - height will be conky window height
# draw_type: 1=fill, 2=outline(must specify line_width), 3=outline and fill (must specify line_width, outline_color and outline_alpha)
## gradient bars ###############################################################
#${lua gradbar {x_position,y_position,"conky_object",object_max_value,number_of_divisions,division_width,division_height,division_gap,bg_color,bg_alpha,start_color,start_alpha,mid_color,mid_alpha,end_color,end_alpha}}
## calendar ###############################################################
#${lua luacal {x_position,y_position,"title_font",title_fontsize,title_color,title_alpha,"dates_font",dates_fontsize,dates_color,dates_alpha,"highlight_font",highlight_fontsize,highlight_color,highlight_alpha,"spacer",colum_gap,title_gap,row_gap,start_day}
#note for calendar: start day... 0=sunday, 1=monday ... "spacer" can help align calendar with non fix width fonts
## textured background ###############################################################
#${lua tex_bg {corner_radius,x_position,y_position,width,height,"/path/to/texture.png"}}
## lua draw images ###############################################################
#${lua luaimage {x_position,y_position,width,height,"/path/to/image"}}
#note for images: set width=0 - width will be image width, set height=0 - height will be image height
## lua draw text ###############################################################
#${lua luatext {x_position,y_position,color,alpha,"font",fontsize,"justify"}}
#note for text: justify can be "r" = right, "c" = center, "l" = left
#${lua draw_bg {10,0,0,0,0,0x000000,0.3}}

And the clock on the right is an edit of the

chronograph.lua

--[[ 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
 04 Nov 2012 - mclovin rehash - 12 hours with minutes

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=185
local center_y=95
local radius=50
-- FONT
cairo_select_font_face (cr, "Shock Shimmy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 19)
cairo_set_source_rgba (cr,0,0,0,1)  -- (cr,1/255,1/255,1/255,1)	 -- (cr,0,0,0,1)
-- TABLE OF TEXT -- in order
text_days={"SUN","MON","TUE","WED","THR","FRI","SAT",}
--text_days={"Sun","Mon","Tue","Wed","Thu","Fri","Sat",}
-- text_days={"DOM","LUN","MAR","MIE","JUE","VIE","SAB",}
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
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=35
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
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=220
local radius=45
-- FONT
cairo_select_font_face (cr, "Shock Shimmy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 19)
cairo_set_source_rgba (cr,0,0,0,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",}
--text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",}
-- text_days={"ENE","FEB","MAR","ABR","MAY","JUN","JUL","AGO","SEP","OCT","NOV","DIC",}
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
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
]]
-- DRAW HAND -- snaps to current month
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=115
local center_y=225
local radius=50
cairo_select_font_face (cr, "Shock Shimmy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 19)
cairo_set_source_rgba (cr,0,0,0,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, 2) == 0 then
--set text when even
text=string.format("%02d",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
local radius=40
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
local this_day=tonumber(os.date("%d"))
local hand_length=35--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,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_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
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_NORMAL);
cairo_set_font_size (cr, 12)
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
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=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- 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,1,1,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,1,1,1-- fully opaque red
-- CLOCK A ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=185
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_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_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))
-- 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)
]]
-- ####################################################################
-- PART OF SECOND HAND
--position
local center_x=185
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=130
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=156
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,255/255,255/255,1)
cairo_stroke (cr)

-- ####################################################################

-- POSITION FOR TEXT HOUR NUMBERS
local center_x=185
local center_y=175
local radius=165
-- FONT
cairo_select_font_face (cr, "Shock Shimmy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 28)
cairo_set_source_rgba (cr,0/255,0/255,0/255,1) -- 255 255 255	White
-- TABLE OF TEXT -- in order
text_days={"12","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,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
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 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_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,119/255,136/255,153/255,1)	-- 119 136 153	LightSlateGray  --(cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"","01","02","03","04","","06","07","08","09","","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
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,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

That mrpeachy wrote and Sector11 and McLovin edited.

Ill post the full config tomorrow or wednesday depending how busy work is tomorrow  big_smile

Last edited by lwfitz (2012-11-20 08:14:10)

Offline

#3891 2012-11-20 08:55:44

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: The New Monster Conky Thread

So was thinking that I would just give it an once over before bed, sees mrpeachy's name and 3 code boxes.... In the morning.... With coffee


You can find my work here

Make everything ok button

Offline

#3892 2012-11-20 13:10:03

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

McLovin wrote:

For some reason I can't get this clock to work at all, not sure where the issue on my system, gonna have to work on it and see what is going on

ops  ops  That's weird!  Worked out of the box for me I even tweaked it to dim out the inactive seconds, day names, day numbers and month names.
abiTmDsH.jpg

I'm starting the LUA's like this:

###  LUA Settings  ###########################################################
## draw-bg.lua - Above and After TEXT - requires a composite manager.
##
lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
#
# ----------------------------------------------------------------------------
## OR Both above TEXT - No composite manager required.
#
#lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.3
#
# TEXT
################### Chronograph ##############################################
#lua_load /media/5/Conky/LUA/Chronograph_full.lua
#lua_load /media/5/Conky/LUA/Chronograph-Didier-T.lua
lua_load /media/5/Conky/LUA/Chronograph-Didier-T-2.lua
lua_draw_hook_post main

################### Weather ##################################################
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /media/5/Conky/LUA/crono_full_2.template.lua

### mount.lua #### mrpeachy #####################################################
lua_load /media/5/Conky/LUA/mounted.lua

##instructions
##load script
##lua_load ~/path_to/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number.  This starts data gathering
## to get output:
## ${lua mount partition_number data_type}, where partition number is a number
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint
#######################################################  End LUA Settings  ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1

TEXT
${lua get_mounted_data 3}${lua conky_draw_bg 12 0 0 0 0 0x000000 0.5}
${lua conky_draw_bg 175 0 0 350 350 0x000000 0.3}
${lua conky_draw_bg 60 115 31 120 120 0x000000 0.3}
${lua conky_draw_bg 58 32 118 116 116 0x000000 0.3}
${lua conky_draw_bg 58 202 118 116 116 0x000000 0.3}
${lua conky_draw_bg 60 115 200 120 120 0x000000 0.3}

And the revised Chronograph:

--[[ 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
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)

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'
--Position et taille horloge
local init={
center_x=175,
center_y=175,
radius=170, -- do not touch
lang="English", --English or Spanish or French
hour=24, --12 or 24
second=true, --true or false - Seconds: dots and numbers
line=true, -- part second hand true or false
handday=false, -- DAY NAME hand - true or false
handdaynum=false, -- DAY NUMBER hand - true or false
handmonth=false, -- MONTH NAME hand - true or false
color=0xFF0000, --color for day, day number and month if no hand
alpha=1 --alpha for day, day number and month if no hand
}

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

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}")

local clock_type_A=init.hour -- Large Main 24 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=init.center_x
local center_y=init.center_y-85
local radius=50
-- 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,1,1,1,0) --doesn't work - setting changed location
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",}	end	-- English
if init.lang == "Spanish" then text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}	end	-- Spanish
if init.lang == "French" then text_days={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam",}		end	-- French
local day_number=tonumber(os.date("%w"))
if init.handday == true then
  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
  local radius=35
  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
  local hand_length=30
  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)
else
  for i=1,7 do
    -- work out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day names
    end
    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
  local radius=35
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active day name
    end
    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

end
-- ### END DIAL B #########################################

-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=init.center_x+85
local center_y=init.center_y
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,1,1,1,0) -- doesn't work setting moved
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end -- English
if init.lang == "Spanish" then text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} end -- Spanish
if init.lang == "French" then text_days={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc",} end -- French
local this_month=tonumber(os.date("%m"))

if init.handmonth == true then
  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
  -- DRAW HAND -- snaps to current month
  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)
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active month names
    end
    -- 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
    if this_month == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots for non-active month names
    end
    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
-- ### 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});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- 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=init.center_x-85
local center_y=init.center_y
local radius=50
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 12)
cairo_set_source_rgba (cr,1,1,1,0) -- does not work - settings relocated
local this_day=tonumber(os.date("%d"))
if init.handdaynum == true then
  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, 2) == 0 then
      --set text when even
      text=string.format("%02d",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
  local radius=40
  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
  local hand_length=35--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)
else
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- non-active day numbers
    end
    -- 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, 2) == 0 then
      --set text when even
      text=string.format("%02d",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
  local radius=40
  for i=1,number_days do
    if this_day == i then
      cairo_set_source_rgba (cr,colr, colg, colb, cola)
    else
      cairo_set_source_rgba (cr,1,1,1,0.3) -- dots non-active day numbers
    end
    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
end
-- ### 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=init.center_x
clock_centery=init.center_y+85
-- 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
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- 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=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,.5-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- 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,1,1,.5-- 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=init.center_x
clock_centery=init.center_y
-- 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)
]]
-- ####################################################################
local center_x=init.center_x
local center_y=init.center_y
local radius=init.radius-5
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 15)
cairo_set_source_rgba (cr,1,1,1,1) -- 12 HR Clock numbers
-- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11",}
  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=150
  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
if init.hour == 24 then
  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
end

-- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=140
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=155
  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) -- PART SECOND HAND
  cairo_stroke (cr)
end
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
--affiche secondes
  if init.hour == 12 and init.second == true then
    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","",}
    -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,0.3) -- does not work -- settings moved
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=150 -- dots for seconds A Clock
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0.3) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,0,1,1,1) --??
        else
          cairo_set_source_rgba (cr,0,1,1,0.3) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    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
      if seconds == tonumber(text) then
        cairo_set_source_rgba (cr,1,0,0,1) -- ??
      else
        cairo_set_source_rgba (cr,1,1,1,0.3) -- seconds numbers
      end
      --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
  end
-- Fin affiche secondes
-- FONT

-- ########################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

function rgb_to_r_g_b(col,alp) -- ONLY NEED ONE COPY OF THIS FUNCTION
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

Offline

#3893 2012-11-20 13:18:31

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

lwfitz wrote:

A new one Im working on

http://ompldr.org/tZ2RsdA

OH MY!!!!!!!!!!   What fonts are those?

Elmer Fudd wrote:

That's mar... mar... mar... wonderful!

Offline

#3894 2012-11-20 13:26:12

jed
#! CrunchBanger
From: Detachment 7
Registered: 2012-08-28
Posts: 197
Website

Re: The New Monster Conky Thread

McLovin wrote:

For some reason I can't get this clock to work at all, not sure where the issue on my system, gonna have to work on it and see what is going on

Same here S11.  I get an immediate error in terminal at line 57 in the lua which is

local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

Not sure whats up.  (obviously, since my skills are limited to cut/paste!)  I've tried commenting (--) it out, which ends up showing me Sun, and Mon weekdays on the screen where they would be if the clock was running, but no clock, and nothing else...  My feeble mind is not at the level where I'm able to grasp all the "if init.**** then" stuff he calls to make the snippet of code at the top do all the 'special' things graphically to the clock.  At my age a lot of the "weaker" brain cells have unfortunately died off!  I believe they might probably be the ones I needed to really understand this stuff.

Guess I'll stick with what I have.  At least I can 'kind-of' understand what I'm doing, and get it to work!  ops

Has anyone ever tried with the chrono's we're all playing with, to get the second hand to "Sweep" instead of "Tick"?  Like the Rolex watch does.  I think that would add a little more coolness to it!  Just me though, and I'm not known for my creativity.  (actually, I'd have to say I'm not really known for anything! glasses )  I mostly steal all my creative thoughts from all of you guys here.  Sometimes it's so brilliant in here I can barely keep my eyes open!!!  I would be really interested to see the "Sweep" effect though, if it can be done...

Jed

Last edited by jed (2012-11-20 13:47:08)

Offline

#3895 2012-11-20 14:06:13

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

@ McLovin & Jed

Now this is twilight zone.
I just turned off the other LUA scripts in that conky:

 20 Nov 12 | 10:58:52 ~
         $ conky -c /media/5/Conky/S11_Chronograph_Full_3.conky &
[1] 23846

 20 Nov 12 | 10:58:56 ~
         $ Conky: llua_load: /media/5/Conky/LUA/Chronograph-Didier-T-2.lua:57: attempt to call global 'rgb_to_r_g_b' (a nil value)
Conky: forked to background, pid is 23851

Conky: desktop window (322) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
--2012-11-20 10:58:56--  http://themoneyconverter.com/rss-feed/CAD/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26802 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[======================================>] 26,802      48.0KB/s   in 0.5s   

2012-11-20 10:58:57 (48.0 KB/s) - written to stdout [26802/26802]

--2012-11-20 10:58:57--  http://themoneyconverter.com/rss-feed/ARS/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26675 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[======================================>] 26,675      49.3KB/s   in 0.5s   

2012-11-20 10:58:58 (49.3 KB/s) - written to stdout [26675/26675]

Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
         $ Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!

Consensus: One of the other LUA scripts I'm running is filling in for that error and that's why I never saw it.

It has to be one of my edits - I'll grab the original Didier-T script again and see what happens.

Last edited by Sector11 (2012-11-20 14:06:33)

Offline

#3896 2012-11-20 14:28:14

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

Just grabbed the Didier-T version of the Chronograph and get the same results with ALL other LUA scripts "OFF"

 20 Nov 12 | 11:13:04 ~
         $ conky -c /media/5/Conky/S11_Chronograph_Full_3.conky &
[1] 27544

 20 Nov 12 | 11:13:06 ~
         $ Conky: llua_load: /media/5/Conky/LUA/Chronograph-Didier-T.lua:32: attempt to call global 'rgb_to_r_g_b' (a nil value)
Conky: forked to background, pid is 27549

Conky: desktop window (322) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
--2012-11-20 11:13:06--  http://themoneyconverter.com/rss-feed/CAD/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26802 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[=====================================================================>] 26,802      50.5KB/s   in 0.5s   

2012-11-20 11:13:07 (50.5 KB/s) - written to stdout [26802/26802]

--2012-11-20 11:13:07--  http://themoneyconverter.com/rss-feed/ARS/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26675 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[=====================================================================>] 26,675      47.5KB/s   in 0.5s   

2012-11-20 11:13:08 (47.5 KB/s) - written to stdout [26675/26675]

Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!

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

 20 Nov 12 | 11:22:02 ~
         $ conky -c /media/5/Conky/S11_Chronograph_Full_3.conky &
[1] 27691

 20 Nov 12 | 11:22:04 ~
         $ Conky: forked to background, pid is 27696

Conky: desktop window (322) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
--2012-11-20 11:22:04--  http://themoneyconverter.com/rss-feed/CAD/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26802 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[=====================================================================>] 26,802      49.3KB/s   in 0.5s   

2012-11-20 11:22:05 (49.3 KB/s) - written to stdout [26802/26802]

--2012-11-20 11:22:05--  http://themoneyconverter.com/rss-feed/ARS/rss.xml
Resolving themoneyconverter.com (themoneyconverter.com)... 174.120.229.20
Connecting to themoneyconverter.com (themoneyconverter.com)|174.120.229.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26675 (26K) [text/xml]
Saving to: ‘STDOUT’

100%[=====================================================================>] 26,675      49.8KB/s   in 0.5s   

2012-11-20 11:22:06 (49.8 KB/s) - written to stdout [26675/26675]

         $ 

However see the last part . I turned on draw-bk.lua
abgAiMsj.jpg

This is just strange!!!!

If no one comes up with a fix here, I'll ask Didier-T

Offline

#3897 2012-11-20 14:49:30

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: The New Monster Conky Thread

jed wrote:

Has anyone ever tried with the chrono's we're all playing with, to get the second hand to "Sweep" instead of "Tick"?  Like the Rolex watch does.  I think that would add a little more coolness to it!

Fairly easy, instead of 60 ticks do 600 ticks and update Conky every 0.1 second instead every 1s = CPU usage will double or triple but who cares...


Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#3898 2012-11-20 15:47:37

hozza
Member
From: /dev/null
Registered: 2012-11-20
Posts: 45
Website

Re: The New Monster Conky Thread

There's my Conky, simple and beautiful!

I slightly modified corenominal's Conky.

ZmhNKl.png

and here's the code:

# conky configuration
# Enjoy! :)
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Liberation Sans:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
##############################################
# Compositing tips:

## cairo-compmgr
own_window_type desktop
own_window_argb_visual yes
##############################################
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 300
maximum_width 300
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color 656667
default_shade_color 000000
default_outline_color 828282
alignment top_right
gap_x 12
gap_y 56
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
#  Output
##############################################

TEXT
${font sans-serif:bold:size=8}S Y S T E M
${hr}
${font sans-serif:bold:size=8}IP: $alignr ${addr eth1}
${font sans-serif:bold:size=8}HOST:$alignr$nodename.local
${font sans-serif:bold:size=8}UPTIME:$alignr$uptime_short


${font sans-serif:bold:size=8}P R O C E S S O R S
${hr}
${font sans-serif:normal:size=8}${cpugraph cpu0}
CPU0: ${cpu cpu0}% ${cpubar cpu0}
CPU1: ${cpu cpu1}% ${cpubar cpu1}
CPU2: ${cpu cpu2}% ${cpubar cpu2}


${font sans-serif:bold:size=8}M E M O R Y
${hr}
${font sans-serif:normal:size=8}RAM $alignc $mem / $memmax $alignr $memperc%
$membar
SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${swapbar}


${font sans-serif:bold:size=8}S T O R A G E
${hr}
${font sans-serif:normal:size=8}root $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
${font sans-serif:normal:size=8}1TB $alignc ${fs_used /media/sdb1} / ${fs_size /media/sdb1} $alignr ${fs_used_perc /media/sdb1}%
${fs_bar /media/sdb1}


${font sans-serif:bold:size=8}T O P  P R O C E S S E S
${hr}
${font sans-serif:normal:size=8}${top_mem name 1}${alignr}${top mem 1} %
${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %


${font sans-serif:bold:size=8}N E T W O R K
${hr}
${downspeedgraph eth1}
Download: ${downspeed eth1} $alignr Total: ${totaldown eth1}
${upspeedgraph eth1}
Upload: ${upspeed eth1} $alignr Total: ${totalup eth1}

facere aut mori conatur

Offline

#3899 2012-11-20 17:26:33

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: The New Monster Conky Thread

Sector11 wrote:
lwfitz wrote:

A new one Im working on

http://ompldr.org/tZ2RsdA

OH MY!!!!!!!!!!   What fonts are those?

The Font is called Shock Shimmy

http://www.dafont.com/search.php?q=Shock+Shimmy  big_smile

Offline

Be excellent to each other!

#3900 2012-11-20 20:22:03

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 14,926
Website

Re: The New Monster Conky Thread

lwfitz wrote:
Sector11 wrote:
lwfitz wrote:

A new one Im working on

http://ompldr.org/tZ2RsdA

OH MY!!!!!!!!!!   What fonts are those?

The Font is called Shock Shimmy

http://www.dafont.com/search.php?q=Shock+Shimmy  big_smile

Got it ... beautiful font for B&W backgrounds - OH Elder!

Thank you.

Offline

Board footer

Powered by FluxBB

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

Debian Logo