SEARCH

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

You are not logged in.

#4751 2013-02-09 20:12:49

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

Offline

Help fund CrunchBang, donate to the project!

#4752 2013-02-10 06:44:42

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep "Sunrise" | sed -n 2p | tr -d [a-z][A-Z] | awk '{print $1,$3}'

Offline

#4753 2013-02-10 08:42:05

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

New code for sunset and sunrise for today and tomorrow :

wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -n '/Solar /,/Moon/p' | sed '1d' | sed '$d' | sed 's/,//g' |  sed '/^$/d' | sed "s/\s\+/\n/g" | sed '/./!d' | sed '{:a;$!N;s_\n_ _;ta}' | sed 's/&nbsp/ /g' |  awk '{print $13$14,$11,$17,$12,$18,$19$20,$11,$23,$12,$24}'

Output :

SunRise Today 06:31:40 Tomorrow 06:32:39 SunSet Today 20:01:18 Tomorrow 20:00:24

Offline

#4754 2013-02-10 11:02:05

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

because of the reason i want to display the result of this operation in lua. how can i realize this in lua?

i started with this:

local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, 30) == 0) then
os.execute("wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep \"Sunrise\" | sed -n 2p | tr -d [a-z][A-Z] | awk '{print $1,$3}'")
end

because i only need the daily information about sunrise/sunset i use this command smile can i save the result within a variable?

i asked the owner where he got the information from.

Last edited by lionhead (2013-02-10 15:43:28)

Offline

#4755 2013-02-10 12:17:53

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

Re: Conky v1.9 Thread

wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -n '/Solar /,/Moon/p' | sed '1d' | sed '$d' | sed 's/,//g' |  sed '/^$/d' | sed "s/\s\+/\n/g" | sed '/./!d' | sed '{:a;$!N;s_\n_ _;ta}' | sed 's/&nbsp/ /g' |  awk '{print $13$14,$11,$17,$12,$18,$19$20,$11,$23,$12,$24}'

Offline

#4756 2013-02-10 15:55:42

chepioq
#! Member
Registered: 2013-01-09
Posts: 79

Re: Conky v1.9 Thread

wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -n '/Solar /,/Moon/p' | sed '1d' | sed '$d' | sed 's/,//g' |  sed '/^$/d' | sed "s/\s\+/\n/g" | sed '/./!d' | sed '{:a;$!N;s_\n_ _;ta}' | sed 's/&nbsp/ /g' |  awk '{print $13$14,$11,$17,$12,$18,$19$20,$11,$23,$12,$24}'

Offline

#4757 2013-02-10 18:55:21

I-sty
New Member
Registered: 2013-01-28
Posts: 7

Re: Conky v1.9 Thread

# — Conky settings — #

background yes

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0


# — Window specifications — #

#own_window_class Conky
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 300 300
maximum_width 300

alignment bottom_right

gap_x 5
gap_y 5


# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont hooge 05_53:size=6
xftalpha 0.5

default_color FFFFFF

uppercase no
use_spacer right


# — Lua Load — #

lua_load $HOME/.Conky/cronograph/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings
lua_load $HOME/.Conky/cronograph/scripts/multi_rings.lua
lua_draw_hook_post main

TEXT
#${execi 500 bash $HOME/.Conky/cronograph/accuweather/accuw_script}
${voffset 35}${alignc}BAT: ${battery_percent BAT1}% - ${battery_time BAT1}
${voffset 16}${goto 65}${font hooge 05_53:size=12}${time %H:%M}${font}${goto 140}${execi 1 nc localhost 7634 | cut -c 34-35;}°C${goto 185}UPTIME:
${voffset 2}${goto 65}${time %d %b %Y}${goto 185}${uptime}
${voffset 3}${goto 65}${time %A}
${voffset -7}${alignc}HDD
${voffset 14}${alignc}${fs_free}/${fs_size} 
${voffset 23}${goto 74}${freq}${goto 200}${mem}
${voffset 7}${goto 69}${cpu cpu0}%${goto 91}${cpu cpu1}%${goto 221}${memperc}%
${voffset 4}${goto 75}CPU${goto 205}RAM
${voffset 31}${alignc}${wireless_link_qual_perc wlp2s0}%
${voffset 1}${alignc}${wireless_bitrate wlp2s0}
#${voffset 15}${alignc}WLAN
${voffset 6}${alignc}${addr wlp2s0}
#${voffset -8}${goto 15}${font ConkyWeather:style=Bold:size=10}${execi 600 conkyForecast --location=FIXX0020 --datatype=WF}${font}
#${voffset -52}${goto 100}${font Weather:size=10}y${font}   ${voffset -38}${font Trebuchet MS:size=6}${execi 600 conkyForecast --location=FIXX0020 --datatype=HT}${font}


#${voffset 20}${goto 90}${font hooge 05_53:size=12}${execpi 600 sed -n '1285p' $HOME/.Conky/cronograph/accuweather/curr_cond_raw | cut -c 31-31}°
#${voffset -32}${goto 125}${font conkyweather:size=40}${execpi 600 sed -n '1285p' $HOME/.Conky/cronograph/accuweather/curr_cond_raw | cut -c 31-32}${font}
#${voffset -12}${goto 185}${execpi 600 sed -n '3p' $HOME/.Conky/cronograph/accuweather/curr_cond_raw}${voffset 12}${goto 185}${font conkyweather:size=20}
#${voffset 7}${goto 80}${execpi 600 sed -n '7p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}${goto 135}${execpi 600 sed -n '12p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}${goto 185}${execpi 600 sed -n '17p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}${font}
#${voffset 6}${goto 84}${execpi 600 sed -n '9p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°/${execpi 600 sed -n '10p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°${goto 140}${execpi 600 sed -n '14p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°/${execpi 600 sed -n '15p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°${goto 190}${execpi 600 sed -n '19p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°/${execpi 600 sed -n '20p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}°
#${voffset 7}${goto 85}${execpi 600 sed -n '6p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}${goto 140}${execpi 600 sed -n '11p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}${goto 190}${execpi 600 sed -n '16p' $HOME/.Conky/cronograph/accuweather/tod_ton_raw}
#${execpi 1 cat $HOME/.Conky/cronograph/scripts/blinkingLED}

Offline

#4758 2013-02-10 20:05:52

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

Re: Conky v1.9 Thread

local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, 30) == 0) then
os.execute("wget -q http://www.gco.org.au/weather/weather.html -O weather.html -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep \"Sunrise\" | sed -n 2p | tr -d [a-z][A-Z] | awk '{print $1,$3}'")
end

Offline

#4759 2013-02-10 20:53:46

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i want to save the content of the file 'weather.html' (only the necessary datas) within a variable. then i want to display it as text in lua.

Offline

#4760 2013-02-10 21:05:23

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

Re: Conky v1.9 Thread

weather.html is saved into fTab table.
I've parsed it in parse_table() function to take Sunrise and Sunset time.
You could change parse_table() to fetch whatever information you want.

Offline

#4761 2013-02-10 23:29:58

VDP76
#! Bean Roaster
Registered: 2012-04-12
Posts: 840

Re: Conky v1.9 Thread

(sleep 5s && conky_fix) &

Last edited by VDP76 (2013-02-11 15:51:59)

Offline

#4762 2013-02-11 16:18:52

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

i have a problem with quotes (again)

local grab_file = io.popen("curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/\".*$//'`")

can u please help me?

Offline

#4763 2013-02-11 17:23:01

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

Re: Conky v1.9 Thread

local grab_file = io.popen("curl -s http://www.nasa.gov/rss/image_of_the_day.rss | grep 'url=' | sed 's/^.*url="//' | sed 's/\".*$//'`")

Offline

#4764 2013-02-11 17:46:59

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

it works fine. i have an extra function to display external images (like the image of the day):

function extern_img(wb)
-- define variables
img_x=(wb.posx or 0)
img_y=(wb.posy or 0)
img_w=(wb.imgw or 200)
img_h=(wb.imgh or 200)
s=wb.imgurl -- url of the webcam
img_nw=(wb.imghdd or "external_img.jpg")
img_file='/home/'..username.."/"..img_nw
img_intervall=(wb.imgiv or 60)
-- grab external image from url and save it to hdd
local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, img_intervall) == 0) then
os.execute("wget  -q -O "..img_file..' "'..s..'"')
end
-- load and display image from harddisk
if img_file==nil then print("set image file") end
image({x=img_x,y=img_y,w=img_w,h=img_h,file=img_file})
end--of function to display external images 

i call the both functions like this:

local nasa_url=get_image('http://www.nasa.gov/rss/image_of_the_day.rss')
extern_img({posx=205,posy=0,imgw=200,imgh=200,imgurl=nasa_url,imghdd="nasa.jpg",imgiv=60})

Offline

#4765 2013-02-15 20:03:12

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

@lionhead, check your PM

Offline

#4766 2013-02-15 21:01:04

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

Re: Conky v1.9 Thread

(sleep 5s && conky_fix) &

Offline

#4767 2013-02-16 10:48:05

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

-- ##################################################################################
-- ## display local images from hdd #################################################
-- ##################################################################################
function image(im)
x=nil
x=(im.x or 0)
y=nil
y=(im.y or 0)
w=nil
w=(im.w or default_image_width)
h=nil
h=(im.h or default_image_height)
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then 
width=imlib_image_get_width() 
else
width=tonumber(w)
end
if tonumber(h)==0 then 
height=imlib_image_get_height() 
else
height=tonumber(h)
end
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_and_decache()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image_and_decache()
show=nil
end--function image 

-- ###############################################################################
-- ## display external images ####################################################
-- ###############################################################################
function extern_img(wb)
-- define variables
img_x=(wb.posx or 0)
img_y=(wb.posy or 0)
img_w=(wb.imgw or 200)
img_h=(wb.imgh or 200)
s=wb.imgurl -- url of the webcam
img_nw=(wb.imghdd or "external_img.jpg")
img_file='/home/'..username.."/"..img_nw
img_intervall=(wb.imgiv or 60)
img_hubble=(wb.img_hubble or 'no')
-- grab external image from url and save it to hdd
local updates = tonumber(conky_parse('${updates}'))
if (math.mod(updates, img_intervall) == 0) then
os.execute("wget  -q -O "..img_file..' "'..s..'"')
end

if img_hubble=="yes" then
	local show = imlib_load_image(img_nw)
	if show == nil then return end
	imlib_context_set_image(show)
	width=imlib_image_get_width() 
	height=imlib_image_get_height() 
	-- load and display image from harddisk
	if img_file==nil then print("set image file") end
	image({x=0,y=img_y,w=width,h=height,file=img_file})
else
	-- load and display image from harddisk
	if img_file==nil then print("set image file") end
	image({x=img_x,y=img_y,w=img_w,h=img_h,file=img_file})
end -- of if

end--of function 

Offline

#4768 2013-02-16 19:21:52

arclance
#! Die Hard
Registered: 2012-03-29
Posts: 987

Re: Conky v1.9 Thread

^ Use

local image_width = imlib_image_get_width()

to get the width of the image in pixels.
If you resize the image use the width of your resized image for "image_width" instead.

Then get the width of the conky window.

local conkyWidth = conky_window.width - conky_window.text_start_x - conky_window.border_width

This calculation works best for the way I have my .conkyrc setup but you might need to change it to work well with yours.
I may also not be quite right for imlib2, I have only used it with cairo.

Now you can calculate where to place the left side of the image to center it like this.

local image_leftx = (conkyWidth - image_width)/2

You use that number like this to center the image

imlib_render_image_on_drawable(image_leftx, y)

You can do the same thing for the "y" position using "imlib_image_get_height()" and "conky_window.height".

Last edited by arclance (2013-02-16 19:30:51)

Offline

#4769 2013-02-18 08:35:25

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

Re: Conky v1.9 Thread

### Thanks to everyone at the VSIDO Forums #####
### Thanks to TeoBigusGeekus for the accuweather script #####
### Accuweather images edited by lwfitz ####
### allcombined.lua written by mrpeachy ####
### clock background image by Doruletz ####
max_specials 10000
max_user_text 15000
background no
use_xft yes
xftfont sans:size=9
xftalpha 1
total_run_times 0
own_window yes
own_window_argb_visual yes
own_window_transparent yes
own_window_type normal
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 375 1020
maximum_width 375
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color black
default_outline_color white
alignment top_left
gap_x 15
gap_y 20
no_buffers yes
uppercase no
cpu_avg_samples 6
override_utf8_locale yes
text_buffer_size 100000
top_name_width 5
update_interval 1
default_color FFFFFF
temperature_unit fahrenheit
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
format_human_readable yes
short_units yes
update_interval 1
imlib_cache_size 0

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
temperature_unit Fahrenheit

----------------------------

################### LUA #######################################

lua_load ~/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}}

##############################  End LUA  ###
TEXT
${image $HOME/Conky/Clock-Flip.png -p 85,-5 -s 100x110}${image $HOME/Conky/Clock-Flip.png -p 185,-5 -s 100x110}
#########################################################################################################
	# (RO) TIME
${font Helvetica LT Std :style=bold:size=58}${color 737373}${goto 100}${time %H}${goto 175}${goto 200}${color 737373}${time %M}${font}${color}
#########################################################################################################
	
	# LOCATION (CITY NAMES) #

${voffset -10}${goto 85}${font Bitstream Vera Sans Mono:style=Bold:size=24:locale=ro}Monrovia,CA${font}${color}

#${lua tex_bg {20,4,20,365,540,"/home/luke/Conky/brushed.png"}}
${lua draw_bg {20,8,23,365,1020,0x737373,.15,2,8}}${voffset -10}${font WhiteRabbit:size=15}${goto 30}Temp ${goto 288}Feels${voffset 10}
${font WhiteRabbit:size=20}${goto 25}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F ${goto 286}${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/curr_cond}°F
${font WhiteRabbit:size=11}${texeci 500 bash $HOME/Accuweather_Conky_USA_Images/acc_usa_images}${image $HOME/Accuweather_Conky_USA_Images/cc.png -p 75,118 -s 240x225}




${font WhiteRabbit:size=15}${goto 30}Dawn ${goto 285}Dusk
${voffset 10}${font WhiteRabbit:size=17}${goto 15}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/curr_cond}${goto 262}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/curr_cond}${voffset -10}

${font WhiteRabbit:size=13}${goto 30}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 145}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 265}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/tod_ton}

${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '19p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F
${voffset 5}${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 330}${execpi 600 sed -n '20p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${image $HOME/Accuweather_Conky_USA_Images/7.png -p 20,318 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/12.png -p 138,318 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/17.png -p 256,318 -s 80x67}${voffset -5}



${font WhiteRabbit:size=13}${goto 30}${execpi 600 sed -n '21p' $HOME/Accuweather_Conky_USA_Images/tod_ton}${goto 145}${execpi 600 sed -n '1p' $HOME/Accuweather_Conky_USA_Images/last_days}${goto 265}${execpi 600 sed -n '6p' $HOME/Accuweather_Conky_USA_Images/last_days}

${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '24p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '4p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '9p' $HOME/Accuweather_Conky_USA_Images/last_days}°F
${voffset 5}${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '25p' $HOME/Accuweather_Conky_USA_Images/tod_ton}°F${goto 215}${execpi 600 sed -n '5p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '10p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${image $HOME/Accuweather_Conky_USA_Images/22.png -p 20,405 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N2.png -p 138,405 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N7.png -p 256,405 -s 80x67}${voffset -5}
#
#
#
#${font WhiteRabbit:size=13}${goto 30}${execpi 600 sed -n '11p' $HOME/Accuweather_Conky_USA_Images/last_days}${goto 145}${execpi 600 sed -n '16p' $HOME/Accuweather_Conky_USA_Images/last_days}${goto 265}${execpi 600 sed -n '21p' $HOME/Accuweather_Conky_USA_Images/last_days}
#
#${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '14p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 215}${execpi 600 sed -n '19p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '24p' $HOME/Accuweather_Conky_USA_Images/last_days}°F
#${voffset 5}${font WhiteRabbit:size=10}${goto 100}${execpi 600 sed -n '15p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 215}${execpi 600 sed -n '20p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${goto 330}${execpi 600 sed -n '25p' $HOME/Accuweather_Conky_USA_Images/last_days}°F${image $HOME/Accuweather_Conky_USA_Images/N12.png -p 20,492 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N17.png -p 138,492 -s 80x67}${image $HOME/Accuweather_Conky_USA_Images/N22.png -p 256,492 -s 80x67}${voffset -5}


${color 737373}${goto 15}${cpubar 1,350 cpu0}${color}

${font WhiteRabbit:size=25}${goto 80}Now Playing





${color 737373}${goto 15}${cpubar 1,350 cpu0}${color}
${image ~/Conky/grey_bar2.png -s 50x90 -p 168,660}
${voffset -30}${goto 15}${font WhiteRabbit:size=13}CPU1${goto 65}${cpu cpu1}%${goto 110}CPU2 ${cpu cpu2}%${goto 207}${font WhiteRabbit:size=20}Memory ${alignr 22}${memperc}%
${goto 15}${font WhiteRabbit:size=13}CPU3${goto 65}${cpu cpu3}%${goto 110}CPU4 ${cpu cpu4}%${voffset 20}${goto 207}${font WhiteRabbit:size=20}Swap ${alignr 22}${swapperc}%${voffset -20}
${goto 15}${font WhiteRabbit:size=13}CPU5${goto 65}${cpu cpu5}%${goto 110}CPU6 ${cpu cpu6}%

${color 737373}${goto 15}${cpubar 1,350 cpu0}${color}

#${font WhiteRabbit:size=25}${goto 125}Storage
${goto 15}${font WhiteRabbit:size=13}/Root${goto 130}${fs_used /}${goto 180} / ${fs_size /} ${alignr 25}${fs_used_perc /}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}/Home${goto 130}${fs_used /home}${goto 180} / ${fs_size /home} ${alignr 25}${fs_used_perc /home}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}Backup${goto 130}${fs_used /media/storage}${goto 180} / ${fs_size /media/storage} ${alignr 25}${fs_used_perc /media/storage}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}Music${goto 130}${fs_used /media/sde6}${goto 180} / ${fs_size /media/sde6} ${alignr 25}${fs_used_perc /media/sde6}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}External${goto 130}${fs_used /media/sde5}${goto 180} / ${fs_size /media/sde5} ${alignr 25}${fs_used_perc /media/sde5}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}Videos${goto 130}${fs_used /media/sdc1}${goto 180} / ${fs_size /media/sdc1} ${alignr 25}${fs_used_perc /media/sdc1}%
${voffset 8}${goto 15}${font WhiteRabbit:size=13}Software${goto 130}${fs_used /media/sdb1}${goto 180} / ${fs_size /media/sdb1} ${alignr 25}${fs_used_perc /media/sdb1}%
#${voffset 8}${goto 15}${font WhiteRabbit:size=13}/Home${goto 130}${fs_used /home}${goto 180} / ${fs_size /home} ${alignr 25}${fs_used_perc /home}%

${color 737373}${goto 15}${cpubar 1,350 cpu0}${color}

${goto 15}${voffset -3}Down Speed${goto 175}${downspeed eth0} ${goto 275}${voffset -8}${downspeedgraph eth0 20,75 99CCFF 000099}${color} 
${goto 15}${voffset 8}Up Speed${goto 175}${upspeed eth0} ${goto 275}${voffset -8}${upspeedgraph eth0 20,75 99CCFF 000099}${color}

Offline

#4770 2013-02-19 11:15:36

timius1
New Member
Registered: 2013-02-19
Posts: 4

Re: Conky v1.9 Thread

--this lua script for use in conky
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_clock()
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
--######################################################################
-- Settings ############################################################
--######################################################################
center_x=110
center_y=110
--style set 0 for none or 1, 2, 3, 4, or mine
style_set=1
--clock face 1 or 2
clock_face=2
--hours on the clock 12 or 24
hours=12
--visiblity 1 or 0
hands=1
lights=0
digital=0
chrono=0
gears=0
texts=1
--the second interval displayed 5, 10, or 15
seconds=15
-- Colors
d_font_red=.8
d_font_green=.8
d_font_blue=.8
d_font_alpha=1
br_red=.5
br_green=.5
br_blue=.5
br_alpha=1
bg_red=.05
bg_green=.05
bg_blue=.05
bg_alpha=1
lights_red=.2
lights_green=.2
lights_blue=1
lights_alpha=.75
hands_red=.5
hands_green=.5
hands_blue=.5
hands_ired=.25
hands_igreen=.25
hands_iblue=.25
hands_alpha=1
--######################################################################
-- Style Sets ##########################################################
--######################################################################
if style_set == 1 then
clock_face=1
hours=12
hands=0
lights=1
digital=1
chrono=0
gears=0
texts=1
seconds=5
end
if style_set == 2 then
clock_face=2
hours=12
hands=1
lights=0
digital=0
chrono=0
gears=0
texts=1
seconds=5
end
if style_set == 3 then
clock_face=1
hours=24
hands=0
lights=1
digital=0
chrono=1
gears=1
texts=1
seconds=10
end
if style_set == 4 then
clock_face=2
hours=24
hands=1
lights=0
digital=0
chrono=1
gears=1
texts=1
seconds=10
end
if style_set == mine then
clock_face=2
hours=24
hands=1
lights=1
digital=0
chrono=1
gears=1
texts=1
seconds=5
end
--######################################################################
-- Strings #############################################################
--######################################################################
d_line_width=1
d_math=math.pi/180
d_font="mono"
d_font_size=11
d_font_slant=CAIRO_FONT_SLANT_NORMAL
d_font_face=CAIRO_FONT_WEIGHT_NORMAL
outer_radius=100
year=conky_parse("${time %y}")
month_number=tonumber(conky_parse("${time %m}"))
weekday=conky_parse("${time %u}")
day=conky_parse("${time %a}")
abbr_month=conky_parse("${time %b}")
day_number=conky_parse("${time %d}")
ampm=conky_parse("${time %p}")
second=tonumber(conky_parse("${time %S}"))
minute=tonumber(conky_parse("${time %M}"))
if hours ~= 12 then hours=24 end
if hours == 12 then
hour=tonumber(conky_parse("${time %I}"))
time_hms=conky_parse("${time %r}")
i_start=1
i_end=12
else
hour=tonumber(conky_parse("${time %H}"))
time_hms=conky_parse("${time %T}")
i_start=0
i_end=hours-1
end
--######################################################################
-- Gears ###############################################################
--######################################################################
if gears == 1 then
gear((center_x+45),(center_y+45),25,25,6,second,60,1,.75)
gear((center_x-45),(center_y+45),25,20,6,((minute*60)+second),(60*60),0,.75)
gear((center_x+45),(center_y-45),25,15,6,((hour*60)+(minute*60)+second),(60*60*60),1,.75)
gear((center_x-45),(center_y-45),25,10,6,((day_number*24)+(hour*60)+(minute*60)+second),(60*60*60*24),1,.75)
end
--######################################################################
-- Chrono ##############################################################
--######################################################################
if chrono == 1 then
--left weekday
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,(center_x-35),center_y,12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x-35),center_y,12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,7 do
weekdays={"S","M","T","W","T","F","S"}
	x,y=pt((center_x-35),center_y,18.5,((360/7)*(i-1)))
	text({y=y,x=x,t=(weekdays[i]),hj="c",vj="m"})
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
weekday_position=(-90*d_math)+(((360/7)*weekday)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,(center_x-35),center_y)
cairo_arc(cr,(center_x-35),center_y,20,weekday_position,weekday_position)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--up month day
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,center_x,(center_y-35),12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y-35),12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
month_days={31,28,31,30,31,30,31,31,30,31,30,31}
month_set=month_days[(month_number)]
for i=1,(month_set) do
month_day_marker=(-90*d_math)+(((360/month_set)*i)*d_math)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,(center_y-35),25,month_day_marker,month_day_marker)
cairo_arc(cr,center_x,(center_y-35),20,month_day_marker,month_day_marker)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--for
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_set_font_size (cr,8)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,(month_set) do
	if i == 5 or i == 10 or i == 15 or i == 20 or i == 25 or i == month_set then
	x,y=pt(center_x,(center_y-35),18.5,((360/month_set)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
day_indicator=(-90*d_math)+(((360/month_set)*day_number)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,(center_y-35))
cairo_arc(cr,center_x,(center_y-35),20,day_indicator,day_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--right year
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,(center_x+35),center_y,12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,(center_x+35),center_y,12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--when the year needs updated replace the start_year with the current year
start_year=13
cairo_set_font_size(cr,9)
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,4 do
	x,y=pt((center_x+35),center_y,18.5,((360/4)*i))
	text({y=y,x=x,t=(start_year+(i-1)),hj="c",vj="m"})
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
cairo_set_font_size (cr,d_font_size)
year_indicator=(-90*d_math)+(((360/4)*(year-(start_year-1)))*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,(center_x+35),center_y)
cairo_arc(cr,(center_x+35),center_y,20,year_indicator,year_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
--down month
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),25,(0*d_math),(360*d_math))
cairo_arc_negative(cr,center_x,(center_y+35),12,(360*d_math),(0*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),25,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,(center_y+35),12,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
for i=1,12 do
month_indicator_marks=((360/12)*d_math)*i
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,(center_y+35),25,month_indicator_marks,month_indicator_marks)
cairo_arc(cr,center_x,(center_y+35),20,month_indicator_marks,month_indicator_marks)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--for
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
for i=1,12 do
	if i == 3 or i == 6 or i == 9 or i == 12 then
	x,y=pt(center_x,(center_y+35),18,((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
cairo_stroke(cr)
month_indicator=(-90*d_math)+(((360/12)*month_number)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,(center_y+35))
cairo_arc(cr,center_x,(center_y+35),20,month_indicator,month_indicator)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
end--chrono
--######################################################################
-- Face one ############################################################
--######################################################################
if clock_face == 1 then
--background
cairo_set_line_width(cr,5)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_arc_negative(cr,center_x,center_y,(outer_radius-35),(270*d_math),(-90*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--seconds
second_radius1=outer_radius-2.5
second_radius2=second_radius1-10
for i=0,59 do
second_start=((i*(360/60))*d_math)
second_end=second_start+((360/60)*d_math)
second_start_math=(second_end-second_start)/2
second_start1=second_start-second_start_math-(90*d_math)
second_end1=second_start1+((360/60)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,second_radius1,second_start1,second_end1)
cairo_arc_negative(cr,center_x,center_y,second_radius2,second_end1,second_start1)
cairo_close_path(cr)
if lights == 1 then
if i == second then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for seconds end
--minutes
for i=0,59 do
minute_radius=second_radius2-10
minute_start=((i*(360/60))*d_math)
minute_end=minute_start+((360/60)*d_math)
minute_start_math=(minute_end-minute_start)/2
minute_start1=minute_start-minute_start_math-(90*d_math)
minute_end1=minute_start1+((360/60)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,second_radius2,minute_start1,minute_end1)
cairo_arc_negative(cr,center_x,center_y,minute_radius,minute_end1,minute_start1)
cairo_close_path(cr)
if lights == 1 then
if i == minute then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for minutes end
--hours
for i=i_start,i_end do
hour_radius=minute_radius-10
hour_start=((i*(360/hours))*d_math)
hour_end=hour_start+((360/hours)*d_math)
hour_start_math=((hour_end-hour_start)/2)
hour_start1=hour_start-hour_start_math-(90*d_math)
hour_end1=hour_start1+((360/hours)*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,minute_radius,hour_start1,hour_end1)
cairo_arc_negative(cr,center_x,center_y,hour_radius,hour_end1,hour_start1)
cairo_close_path(cr)
if lights == 1 then
if i == hour then
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_fill_preserve(cr)
end
end--lights
cairo_set_source_rgba(cr,.25,.25,.25,1)
cairo_stroke(cr)
end--for hours end
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
if texts==1 then
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
if hours==24 then
for i=0,23 do
	if i==0 or i==2 or i==4 or i==6 or i==8 or i==10 or i==12 or i==14 or i==16 or i==18 or i==20 or i==22 then
	x,y=pt(center_x,center_y,(hour_radius+5),((360/24)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif hours==12 then
for i=1,12 do
	x,y=pt(center_x,center_y,(hour_radius+5),((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
end--for
end--hours
if seconds==5 then
for i=0,59 do
	if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==10 then
for i=0,59 do
	if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==15 then
for i=0,59 do
	if i==0 or i==15 or i==30 or i==45 then
	x,y=pt(center_x,center_y,(second_radius2),((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
end--second
cairo_stroke(cr)
end--texts
--######################################################################
-- mrpeacy code end ####################################################
--######################################################################
end--clock face one
--######################################################################
-- Face two ############################################################
--######################################################################
if clock_face == 2 then
hour_markers_radius=outer_radius-20
second_markers_radius=outer_radius-10
--background
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_arc_negative(cr,center_x,center_y,(hour_markers_radius-13),(270*d_math),(-90*d_math))
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill(cr)
cairo_set_line_width(cr,5)
cairo_arc(cr,center_x,center_y,outer_radius,(-90*d_math),(270*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,(hour_markers_radius-13),(-90*d_math),(270*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
if texts==1 then
cairo_set_source_rgba(cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
if hours==24 then
for i=0,23 do
	if i==0 or i==2 or i==4 or i==6 or i==8 or i==10 or i==12 or i==14 or i==16 or i==18 or i==20 or i==22 then
	x,y=pt(center_x,center_y,(hour_markers_radius-5),((360/24)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif hours==12 then
for i=1,12 do
	x,y=pt(center_x,center_y,(hour_markers_radius-5),((360/12)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
end--for
end--hours
if seconds==5 then
for i=0,59 do
	if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==10 then
for i=0,59 do
	if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
elseif seconds==15 then
for i=0,59 do
	if i==0 or i==15 or i==30 or i==45 then
	x,y=pt(center_x,center_y,second_markers_radius,((360/60)*i))
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
end--for
end--seconds
cairo_stroke(cr)
end--texts
--######################################################################
-- mrpeacy code end ####################################################
--######################################################################
--second lights
sl_math1=(-90*d_math)+(((360/60)*second)*d_math)
if lights ==1 then
cairo_set_line_width(cr,3)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,hour_markers_radius,(-90*d_math),sl_math1)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--lights
--minute
for i=1,60 do
second_markers_position=(-90*d_math)+((i*(360/60))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
cairo_arc(cr,center_x,center_y,outer_radius,second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,second_markers_radius,second_markers_position,second_markers_position)
cairo_set_source_rgba(cr,.75,.75,.75,1)
cairo_stroke(cr)
if lights == 1 then
if i == minute then
cairo_set_line_width(cr,6)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,(outer_radius-2),second_markers_position,second_markers_position)
cairo_arc(cr,center_x,center_y,(second_markers_radius-5),second_markers_position,second_markers_position)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--minute
end--lights
end--for
--hour
for i=i_start,i_end do
hour_markers_position=(-90*d_math)+(i*(360/hours))*d_math
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,outer_radius,hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,hour_markers_radius,hour_markers_position,hour_markers_position)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
if lights == 1 then
if i == hour then
cairo_set_line_width(cr,6)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_arc(cr,center_x,center_y,(outer_radius-2),hour_markers_position,hour_markers_position)
cairo_arc(cr,center_x,center_y,(hour_markers_radius-5),hour_markers_position,hour_markers_position)
cairo_set_source_rgba(cr,lights_red,lights_green,lights_blue,lights_alpha)
cairo_stroke(cr)
end--hour
end--lights
end--for hour
--outer ring
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,outer_radius,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,1,1,1,1)
cairo_stroke(cr)
end--clock face two
--######################################################################
-- Hands ###############################################################
--######################################################################
if hands == 1 then
hour_hand_radius1=outer_radius-30
hour_hand_radius2=outer_radius-50
hour_position=(-90*d_math)+(((360/(hours*60*60))*((hour*60*60)+(minute*60)+second))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,10,(hour_position-(20*d_math)),(hour_position+(20*d_math)))
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position+(5*d_math)),(hour_position+(5*d_math)))
cairo_arc(cr,center_x,center_y,hour_hand_radius1,hour_position,hour_position)
cairo_arc(cr,center_x,center_y,hour_hand_radius2,(hour_position-(5*d_math)),(hour_position-(5*d_math)))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
minute_hand_radius1=outer_radius-15
minute_hand_radius2=outer_radius-35
minute_position=(-90*d_math)+(((360/(60*60))*((minute*60)+second))*d_math)
cairo_set_line_width(cr,d_line_width)
cairo_arc(cr,center_x,center_y,10,(minute_position-(20*d_math)),(minute_position+(20*d_math)))
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position+(5*d_math)),(minute_position+(5*d_math)))
cairo_arc(cr,center_x,center_y,minute_hand_radius1,minute_position,minute_position)
cairo_arc(cr,center_x,center_y,minute_hand_radius2,(minute_position-(5*d_math)),(minute_position-(5*d_math)))
cairo_close_path(cr)
cairo_set_source_rgba(cr,hands_ired,hands_igreen,hands_iblue,hands_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
second_hand_radius=outer_radius-5
second_position=(-90*d_math)+(((360/60)*second)*d_math)
cairo_set_line_width(cr,2)
cairo_move_to(cr,center_x,center_y)
cairo_arc(cr,center_x,center_y,second_hand_radius,second_position,second_position)
cairo_set_source_rgba(cr,hands_red,hands_green,hands_blue,hands_alpha)
cairo_stroke(cr)
cairo_set_line_width(cr,1)
cairo_arc(cr,center_x,center_y,10,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,0,0,0,1)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,.5,.5,.5,1)
cairo_stroke(cr)
--am & pm
if hours == 12 then
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,10)
cairo_set_source_rgba (cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_move_to (cr,(center_x-6.25),(center_y+3.25))
cairo_show_text (cr,ampm)
cairo_stroke (cr)
else
cairo_set_line_width(cr,2)
cairo_arc(cr,center_x,center_y,5,(0*d_math),(360*d_math))
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_fill(cr)
end--am & pm
end-- hands
--######################################################################
-- Digital #############################################################
--######################################################################
if digital == 1 then
ph=15
pw=40
p1x=center_x-pw
p1y=center_y-ph
p2x=center_x+pw
p2y=center_y+ph
pr=10
cairo_set_line_width(cr,2)
cairo_arc(cr,p1x,p1y,pr,(180*d_math),(270*d_math))
cairo_arc(cr,p2x,p1y,pr,(270*d_math),0)
cairo_arc(cr,p2x,p2y,pr,0,(90*d_math))
cairo_arc(cr,p1x,p2y,pr,(90*d_math),(180*d_math))
cairo_close_path(cr)
cairo_set_source_rgba(cr,bg_red,bg_green,bg_blue,bg_alpha)
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,br_red,br_green,br_blue,br_alpha)
cairo_stroke(cr)
for i=1,4 do
line=6
x1=center_x-40
y1=center_y-line
x2=center_x
y2=center_y-line
x3=center_x+25
y3=center_y-line
x4=center_x-45
y4=center_y+15
if hours == 12 then time_s=14 else time_s=18 end
s={16,d_font_size,d_font_size,time_s}
x={x1,x2,x3,x4}
y={y1,y2,y3,y4}
t={day,abbr_month,day_number,time_hms}
cairo_select_font_face (cr,d_font,d_font_slant,d_font_face);
cairo_set_font_size (cr,s[i])
cairo_set_source_rgba (cr,d_font_red,d_font_green,d_font_blue,d_font_alpha)
cairo_move_to (cr,x[i],y[i])
cairo_show_text (cr,t[i])
cairo_stroke (cr)
end--for
end--digital
--######################################################################
--######################################################################
--######################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
--######################################################################
--Functions ############################################################
--######################################################################
function gear(position_x,position_y,radius,outer_teeth,inner_teeth,speed,speed_scale,direction,visibility)
gear_red=.75
gear_green=.75
gear_blue=.75
gear_line_width=4
gear_math=(math.pi/180)
gear_start=0
gear_end=360*gear_math
outer_teeth_radius=(radius)+gear_line_width
inner_radius=10
inner_teeth_radius=inner_radius+gear_line_width
--outer gear
cairo_set_line_width(cr,gear_line_width)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_arc(cr,(position_x),(position_y),(radius),gear_start,gear_end)
cairo_stroke(cr)
--outer gear teeth
for i=1,(outer_teeth) do
tooth_size=(360/(outer_teeth))/3
tooth_space=(360/(outer_teeth))
tooth_math=(((i-1)*tooth_space)+tooth_size)*gear_math
tooth_math2=(((360/(speed_scale))*(speed))*gear_math)
if (direction) == 1 then tooth=tooth_math+tooth_math2 else tooth=tooth_math-tooth_math2 end
teeth_s=tooth-((tooth_size/2)*gear_math)
teeth_e=tooth+((tooth_size/2)*gear_math)
cairo_set_line_width(cr,gear_line_width)
cairo_arc(cr,(position_x),(position_y),outer_teeth_radius,teeth_s,teeth_e)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_stroke(cr)
end--for loop
--inner gear
cairo_set_line_width(cr,gear_line_width)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_arc(cr,(position_x),(position_y),inner_radius,gear_start,gear_end)
cairo_stroke(cr)
--inner gear teeth
for i=1,(inner_teeth) do
tooth_size=(360/(inner_teeth))/3
tooth_space=(360/(inner_teeth))
tooth_math=(((i-1)*tooth_space)+tooth_size)*gear_math
tooth_math2=(((360/(speed_scale))*(speed))*gear_math)
if (direction) == 1 then tooth=tooth_math+tooth_math2 else tooth=tooth_math-tooth_math2 end
teeth_s=tooth-((tooth_size/2)*gear_math)
teeth_e=tooth+((tooth_size/2)*gear_math)
cairo_set_line_width(cr,gear_line_width)
cairo_arc(cr,(position_x),(position_y),inner_teeth_radius,teeth_s,teeth_e)
cairo_set_source_rgba(cr,gear_red,gear_green,gear_blue,(visibility))
cairo_stroke(cr)
end--for loop
end
--######################################################################
-- mrpeacy code ########################################################
--######################################################################
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f	or default_font_name	or "mono"
local size=fontt.fs	or default_font_size	or 12
local face=fontt.ff	or default_font_face	or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c	or default_hex_color	or 0xffffff
local a=hexcolort.a	or default_alpha	or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x 		or 100
local y=textt.y 		or 100
local t=textt.t 		or "set txt"
local hj=textt.hj 		or default_horizontal_justify		or "l"
local vj=textt.vj 		or default_vertical_justify		or "n"
local r=textt.r			or default_rotation			or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text #####################################################

Offline

#4771 2013-02-19 15:55:57

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

Offline

#4772 2013-02-19 16:10:23

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

Re: Conky v1.9 Thread

### AoN Clock ################################################################
lua_load /media/5/Conky/LUA/AoN_Clock.lua
lua_draw_hook_pre clock
#lua_draw_hook_post clock
################################################################## End LUA ###
minimum_size 210 210     ## width, height
maximum_width 210       ## width
update_interval 1

### A minimum of one blank line after TEXT is required
TEXT
1
2
3
4
5
6
7
8
9
0
1
2 more code here line 12

Last edited by Sector11 (2013-02-19 16:11:28)

Offline

#4773 2013-02-19 19:45:03

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

Re: Conky v1.9 Thread

@Sector11 Thank you for taking care of that question

Offline

#4774 2013-02-19 21:08:54

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Last edited by ragamatrix (2013-02-19 21:21:05)

Offline

Help fund CrunchBang, donate to the project!

#4775 2013-02-19 23:00:51

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

Re: Conky v1.9 Thread

Offline

Board footer

Powered by FluxBB

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

Debian Logo