You are not logged in.
here is a conky project ive been working on inspired by a conky posted on "another" conky thread
the poster was using a faded/eroded font which looked great but what stood out as not fitting in were the perfectly straight, perfectly rectangular bars drawn by conky
so i thought, hmm there must be a way to make come crusty looking bars to match
so i had a go and this is the current results
this is a different font, one i like called 321 impact http://www.dafont.com/321impact.font
and the script
--[[rough bars by mrpeachy April 2011
in conkyrc
lua_load /path/roughbar.lua
lua_draw_hook_post draw_fig
when setting up bars, and changes should be followed by killall conky and relaunch
the shape of the bars is set only once at the start of the conky
launched in a terminal you may see the following "errors"
Conky: llua_do_call: function conky_draw_fig execution failed: /home/mcdowall/lua/rough.lua:221: attempt to index local 'xt' (a nil value)
this will repeat 4 times until the display starts
set "if updates==10" then to 6 to get rid of the error, i just like to give my script some extra time :)
note-- currently l must be in multiples of 100
to be implemented
set colors of bars
set colors of outlines
allow any length to be set
]]
require 'cairo'
function conky_draw_fig()
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 for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar1={
--position
x=50,
y=50,
--radius and angles - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu0}"),
--end settings
}--end of table
--calculations
if updates==10 then
nx=0
ny=0
x=set_bar1.x
y=set_bar1.y
xt_bar1={}
yt_bar1={}
for i=1,set_bar1.l do
arc=((2*math.pi)/360)*(math.random(set_bar1.a1,set_bar1.a2))
nx=0+set_bar1.r*(math.sin(arc))
ny=0-set_bar1.r*(math.cos(arc))
x=x+nx
xt_bar1[i]=x
y=y+ny
if y>(set_bar1.y+3) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar1.y-3) and ny<0 then y=y-ny else y=y+ny end
yt_bar1[i]=y
end--for
end--if updates
drawbar (set_bar1,xt_bar1,yt_bar1)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar2={
--position
x=50,
y=100,
--radius and angles - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu1}"),
--end settings
}--end of table
--calculations
if updates==10 then
nx=0
ny=0
x=set_bar2.x
y=set_bar2.y
xt_bar2={}
yt_bar2={}
for i=1,set_bar2.l do
arc=((2*math.pi)/360)*(math.random(set_bar2.a1,set_bar2.a2))
nx=0+set_bar2.r*(math.sin(arc))
ny=0-set_bar2.r*(math.cos(arc))
x=x+nx
xt_bar2[i]=x
y=y+ny
if y>(set_bar2.y+3) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar2.y-3) and ny<0 then y=y-ny else y=y+ny end
yt_bar2[i]=y
end--for
end--if updates
drawbar (set_bar2,xt_bar2,yt_bar2)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar3={
--position
x=50,
y=150,
--radius and angles - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu2}"),
--end settings
}--end of table
--calculations
if updates==10 then
nx=0
ny=0
x=set_bar3.x
y=set_bar3.y
xt_bar3={}
yt_bar3={}
for i=1,set_bar3.l do
arc=((2*math.pi)/360)*(math.random(set_bar3.a1,set_bar3.a2))
nx=0+set_bar3.r*(math.sin(arc))
ny=0-set_bar3.r*(math.cos(arc))
x=x+nx
xt_bar3[i]=x
y=y+ny
if y>(set_bar3.y+3) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar3.y-3) and ny<0 then y=y-ny else y=y+ny end
yt_bar3[i]=y
end--for
end--if updates
drawbar (set_bar3,xt_bar3,yt_bar3)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar4={
--position
x=50,
y=200,
--radius and angles - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu3}"),
--end settings
}--end of table
--calculations
if updates==10 then
nx=0
ny=0
x=set_bar4.x
y=set_bar4.y
xt_bar4={}
yt_bar4={}
for i=1,set_bar4.l do
arc=((2*math.pi)/360)*(math.random(set_bar4.a1,set_bar4.a2))
nx=0+set_bar4.r*(math.sin(arc))
ny=0-set_bar4.r*(math.cos(arc))
x=x+nx
xt_bar4[i]=x
y=y+ny
if y>(set_bar4.y+3) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar4.y-3) and ny<0 then y=y-ny else y=y+ny end
yt_bar4[i]=y
end--for
end--if updates
drawbar (set_bar4,xt_bar4,yt_bar4)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
cairo_select_font_face (cr, "321 impact", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 18);
cairo_move_to (cr,set_bar1.x,set_bar1.y-6)
cairo_show_text (cr, "AVERAGE CPU")
cairo_stroke (cr)
cairo_move_to (cr,set_bar2.x,set_bar2.y-6)
cairo_show_text (cr, "CORE 1")
cairo_stroke (cr)
cairo_move_to (cr,set_bar3.x,set_bar3.y-6)
cairo_show_text (cr, "CORE 2")
cairo_stroke (cr)
cairo_move_to (cr,set_bar4.x,set_bar4.y-6)
cairo_show_text (cr, "CORE 3")
cairo_stroke (cr)
end-- if updates>5
end-- end main function
--#########################################################################################################
function drawbar(set,xt,yt)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
for i=1,(set.l*2)+1 do
if i<(set.l+1) then
cairo_move_to (cr,xt[i],yt[i])
if xt[i+1]==nil then xt[i+1]=xt[i] end
if yt[i+1]==nil then yt[i+1]=yt[i] end
cairo_line_to (cr,xt[i+1],yt[i+1])
elseif i==set.l+1 then
cairo_move_to (cr,xt[set.l],yt[set.l])
cairo_line_to (cr,xt[set.l],yt[set.l]+set.w)
elseif i>set.l+1 and i<(set.l*2)+1 then
cairo_move_to (cr,xt[set.l-(i-(set.l+2))],yt[set.l-(i-(set.l+2))]+set.w)
if xt[set.l-((i+1)-(set.l+2))]==nil then xt[set.l-((i+1)-(set.l+2))]=xt[set.l-((i)-(set.l+2))] end
if yt[set.l-((i+1)-(set.l+2))]==nil then yt[set.l-((i+1)-(set.l+2))]=yt[set.l-((i)-(set.l+2))] end
cairo_line_to (cr,xt[set.l-((i+1)-(set.l+2))],yt[set.l-((i+1)-(set.l+2))]+set.w)
elseif i==(set.l*2)+1 then
cairo_move_to (cr,xt[1],yt[1]+set.w)
cairo_line_to (cr,xt[1],yt[1])
end
cairo_stroke (cr)
end
for i=1,(set.l/100)*(tonumber(set.value)) do
cairo_move_to (cr,xt[i],yt[i])
cairo_rel_line_to (cr,0,set.w)
cairo_set_line_width (cr,set.lw)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_stroke (cr)
end
end--of functionits a bit fiddly to put in extra bars, and you need to kill and restart conky when you make changes
but with a nice crusty font i think the effect looks good 
you also get a new set of unique bars every time you start your conky
Last edited by mrpeachy (2011-04-07 02:56:33)
Offline
here is a conky project ive been working on inspired by a conky posted on "another" conky thread
the poster was using a faded/eroded font which looked great but what stood out as not fitting in were the perfectly straight, perfectly rectangular bars drawn by conkyso i thought, hmm there must be a way to make come crusty looking bars to match
so i had a go and this is the current resultsthis is a different font, one i like called 321 impact http://www.dafont.com/321impact.font
and the script
very nice MrPeachy ! thanks for sharing this idea
I like it
Offline
very nice MrPeachy ! thanks for sharing this idea
I like it
thanks 
Last edited by mrpeachy (2011-04-07 04:50:27)
Offline
How do you align the calendar made by gcal? It seems the standard alignment commands don't work (except for voffset).
Offline
How do you align the calendar made by gcal? It seems the standard alignment commands don't work (except for voffset).
With ${goto xx} my preferred method:
${execp gcal --starting-day=Monday | sed -e 's/^./${goto 150}/g' -e 's/</${color yellow} /' -e 's/>/${color white} /'}with spaces (mrpeachy mentioned this) - have no idea if it is his preferred method:
${execp gcal --starting-day=Sunday | sed -e 's/^./ /g' -e 's/</${color yellow} /' -e 's/>/${color white} /'}You can use the short form: -s1 = start Mon 0 = Sunday 3 = Wednesday
and use ${colorX} command as well
${execp gcal -s1 | sed -e 's/^./${goto 150}/g' -e 's/</${color6} /' -e 's/>/${color0} /'}Offline
OK, that's great, thanks a lot.
Another question, for the few things that connect to internet, how do I make sure they don't hog the whole thing and prevent it from loading on startup, etc?
For instance I've got the line (that I found here):
${execi 3600 wget -O - http://ip.tupeux.com | tail}
and also something similar to get the gmail count. What's a proper way to include these?
Offline
OK, that's great, thanks a lot.
Another question, for the few things that connect to internet, how do I make sure they don't hog the whole thing and prevent it from loading on startup, etc?
For instance I've got the line (that I found here):
${execi 3600 wget -O - http://ip.tupeux.com | tail}and also something similar to get the gmail count. What's a proper way to include these?
try texeci
"Runs a command at an interval inside a thread and displays the output. Same as $execi, except the command is run inside a thread. Use this if you have a slow script to keep Conky updating. You should make the interval slightly longer then the time it takes your script to execute. For example, if you have a script that take 5 seconds to execute, you should make the interval at least 6 seconds. See also $execi. This object will clean up the thread when it is destroyed, so it can safely be used in a nested fashion, though it may not produce the desired behaviour if used this way."
from http://conky.sourceforge.net/variables.html
Offline
OK, so here goes my Conky config. Very simple!
Here's the code. Thanks to everyone here for providing most of it! It's mostly standard. Network and music appear differently depending on the setup.
## sheaf's Conky Config for CrunchBang Linux
## http://crunchbang.org/projects/linux/
# set to yes if you want Conky to be forked in the background
background yes
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
#xftfont Trebuchet MS:size=10
xftfont Sans:size=8
# Text alpha when using Xft
xftalpha 1
# Update interval in seconds
update_interval 1.0
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_type override
own_window_type desktop
#own_window_type normal #use this if you want a nice shadow to appear around conky
# If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 200 200
# Maximum width
maximum_width 200
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Draw borders around graphs
draw_graph_borders no
# Stippled borders?
# stippled_borders 8
# border margins
# border_margin 2
# border width
# border_width 1
# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment none
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 12
gap_y 12
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale no
##############################################
##############################################
TEXT
${font sans:size=12:bold}${alignc}sheaf${font}
${font sans:size=8:bold}TIME AND DATE${font} ${hr 2}
${alignc}${time %a %d %b %Y}
${font sans:size=12:bold}${alignc}${time %H:%M:%S}${font}
${font mono:size=8}${execp gcal -s1 | sed -e 's/^./${goto 45}/g' -e 's/</${color red} /' -e 's/>/${color} /'}${font}
${font sans:size=8:bold}SYSTEM INFO${font} ${hr 2}
Host:$alignr$nodename
Uptime:$alignr$uptime
RAM:$alignr$mem/$memmax
Swap usage:$alignr$swap/$swapmax
Disk usage:$alignr${fs_used /}/${fs_size /}
Processor:$alignr${cpu cpu1}%
Battery:$alignr${battery_percent BAT0}%
${font sans:size=8:bold}NETWORK${font} ${hr 2}
${if_up wlan0}${alignc}${wireless_essid wlan0} [${wireless_link_qual wlan0}%]
${alignc}${texeci 60 wget -O - http://ip.tupeux.com | tail}
Download:$alignr${downspeed wlan0}
Upload:$alignr${upspeed wlan0}
${else}${if_up eth0}${alignc}Ethernet
${alignc}${texeci 60 wget -O - http://ip.tupeux.com | tail}
Download:$alignr${downspeed eth0}
Upload:$alignr${upspeed eth0}${endif}
${else}${alignc}Network unavailable${endif}
${font sans:size=8:bold}GMAIL${font} ${hr 2}
${if_match "${texeci 60 perl ~/.gmail.pl n}" == "1"}${alignc}${font sans:size=8:bold}1${font} unread email.${else}${alignc}${font sans:size=8:bold}${texeci 60 perl ~/.gmail.pl n}${font} unread emails.${endif}
${if_match "${exec rhythmbox-client --no-start --print-playing-format %ta}" == "Not playing"}
${font sans:size=8:bold}MUSIC${font} ${hr 2}
${alignc}Not playing.
${else}${if_match "${exec rhythmbox-client --no-start --print-playing-format %ta}" == ""}${else}
${font sans:size=8:bold}MUSIC${font} ${hr 2}
${alignc}${exec rhythmbox-client --no-start --print-playing-format %ta}
${alignc}${exec rhythmbox-client --no-start --print-playing-format %tt}
${alignc}${exec rhythmbox-client --no-start --print-playing-format %at}
${alignc}${exec rhythmbox-client --no-start --print-playing-format %te}/${exec rhythmbox-client --no-start --print-playing-format %td}
${endif}${endif}
${font sans:size=8:bold}SHORTCUT KEYS${font} ${hr 2}
Alt+F2$alignr Run Dialog
Win+t$alignr Terminal
Win+f$alignr File manager
Win+e$alignr Gedit
Win+m$alignr Rhythmbox
Win+w$alignr Chromium
Win+i$alignr Inkscape
Win+p$alignr Pinta
Win+l$alignr Lock screen
Win+d$alignr Show desktop
Win+v$alignr Volume control
PrtSc$alignr ScreenshotLast edited by sheaf (2011-04-07 19:55:49)
Offline
Offline
It works here
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github
I am a #! forum moderator. Feel free to send me a PM with any question you have!
Offline
It works here
{grumble grumble}
Imageshack hates me!
I know it, and I'm not paranoid either...
I'm not paranoid!
I am not paranoid!!
I'm not!!
I'm not!
I am NOT! 
==================
I wonder why that happens?
Something with my ISP maybe?
Offline
some updates - now the hand drawn bar script 
you can now set a background and its color
set different colors for background, indicator and outline
use any number for length of bar
use a number that isnt a percentage as long as you can set the max for that value
the entry in my to do section is indeed proving tricky 
also i have a setting that will "unfreeze" the bar allowing you to change other settings without having to kill and restart conky
when you are happy with the bar just freeze it again.. or you can just let it wiggle around 
--[[hand drawn bars by mrpeachy April 2011
in conkyrc
lua_load /path/filename.lua
lua_draw_hook_post draw_fig
when setting up bars, and changes should be followed by killall conky and relaunch
the shape of the bars is set only once at the start of the conky
launched in a terminal you may see the following "errors"
Conky: llua_do_call: function conky_draw_fig execution failed: /home/username/lua/filename.lua:298: attempt to index local 'xt' (a nil value)
this will repeat 2 times and is expected
changes
allow setting of non percentages with max variables - done
set colors of bars -done
set colors of outlines -done
allow any length to be set -done
to do
send the initial bar coordinate generating code to its own function - proving tricky :)
]]
require 'cairo'
function conky_draw_fig()
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 for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar1={
--position
x=50,
y=50,
--radius,angles and range - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
range=3,
--width and length, final length will also depend on r
w=10,
l=112,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu0}"),
max=100,
--background 1=on or 0=off
bg=1,
--colors
--outline color r g b a
lcr=1,
lcg=1,
lcb=1,
lca=1,
--indicator color r g b a
icr=1,
icg=1,
icb=1,
ica=1,
--background color r g b a
bcr=0,
bcg=0,
bcb=0,
bca=1,
}--end of settings table
--freeze and unfreeze the bar for editing
freeze_bar=1 -- when set to 0 bars will be redrawn every cycle, set to 1 bars will be freeze in place
--end settings
--calculations
if freeze_bar==1 and updates>10 then run=0 elseif freeze_bar==1 and updates==8 then run=1 elseif freeze_bar==0 then run=1 end
if run==1 then
nx=0
ny=0
x=set_bar1.x
y=set_bar1.y
xt_bar1={}
yt_bar1={}
for i=1,set_bar1.l do
arc=((2*math.pi)/360)*(math.random(set_bar1.a1,set_bar1.a2))
nx=0+set_bar1.r*(math.sin(arc))
ny=0-set_bar1.r*(math.cos(arc))
x=x+nx
xt_bar1[i]=x
y=y+ny
if y>(set_bar1.y+set_bar1.range) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar1.y-set_bar1.range) and ny<0 then y=y-ny else y=y+ny end
yt_bar1[i]=y
end--for
end--if run
drawbar (set_bar1,xt_bar1,yt_bar1)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar2={
--position
x=75,
y=90,
--radius,angles and range - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
range=3,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu1}"),
max=100,
--background 1=on or 0=off
bg=1,
--colors
--outline color r g b a
lcr=1,
lcg=1,
lcb=1,
lca=1,
--indicator color r g b a
icr=1,
icg=1,
icb=1,
ica=1,
--background color r g b a
bcr=0,
bcg=0,
bcb=0,
bca=1,
}--end of settings table
--freeze and unfreeze the bar for editing
freeze_bar=1 -- when set to 0 bars will be redrawn every cycle, set to 1 bars will be freeze in place
--end settings
--calculations
if freeze_bar==1 and updates>10 then run=0 elseif freeze_bar==1 and updates==8 then run=1 elseif freeze_bar==0 then run=1 end
if run==1 then
nx=0;ny=0;x=set_bar2.x;y=set_bar2.y;xt_bar2={};yt_bar2={}
for i=1,set_bar2.l do
arc=((2*math.pi)/360)*(math.random(set_bar2.a1,set_bar2.a2))
nx=0+set_bar2.r*(math.sin(arc))
ny=0-set_bar2.r*(math.cos(arc))
x=x+nx;xt_bar2[i]=x;y=y+ny
if y>(set_bar2.y+set_bar2.range) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar2.y-set_bar2.range) and ny<0 then y=y-ny else y=y+ny end
yt_bar2[i]=y
end--for
end--if run
drawbar (set_bar2,xt_bar2,yt_bar2)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar3={
--position
x=75,
y=130,
--radius,angles and range - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
range=3,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu2}"),
max=100,
--background 1=on or 0=off
bg=1,
--colors
--outline color r g b a
lcr=1,
lcg=1,
lcb=1,
lca=1,
--indicator color r g b a
icr=1,
icg=1,
icb=1,
ica=1,
--background color r g b a
bcr=0,
bcg=0,
bcb=0,
bca=1,
}--end of settings table
--freeze and unfreeze the bar for editing
freeze_bar=1 -- when set to 0 bars will be redrawn every cycle, set to 1 bars will be freeze in place
--end settings
--calculations
if freeze_bar==1 and updates>10 then run=0 elseif freeze_bar==1 and updates==8 then run=1 elseif freeze_bar==0 then run=1 end
if run==1 then
nx=0;ny=0;x=set_bar3.x;y=set_bar3.y;xt_bar3={};yt_bar3={}
for i=1,set_bar3.l do
arc=((2*math.pi)/360)*(math.random(set_bar3.a1,set_bar3.a2))
nx=0+set_bar3.r*(math.sin(arc))
ny=0-set_bar3.r*(math.cos(arc))
x=x+nx;xt_bar3[i]=x;y=y+ny
if y>(set_bar3.y+set_bar3.range) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar3.y-set_bar3.range) and ny<0 then y=y-ny else y=y+ny end
yt_bar3[i]=y
end--for
end--if run
drawbar (set_bar3,xt_bar3,yt_bar3)
--end of calculations
--end of settings -- copy and paste this section for a new bar
--#########################################################################################################
--#########################################################################################################
--settings for bar copy and paste this section for more bars
--you need to copy this section into a blank text file and replace all instances of bar1 with bar2 etc
set_bar4={
--position
x=75,
y=170,
--radius,angles and range - adjust to make bar more jagged or smooth
r=2,
a1=80,
a2=100,
range=3,
--width and length, final length will also depend on r
w=10,
l=100,
--line width for indicator
lw=2.5,
--value to feed bar
value=conky_parse("${cpu cpu3}"),
max=100,
--background 1=on or 0=off
bg=1,
--colors
--outline color r g b a
lcr=1,
lcg=1,
lcb=1,
lca=1,
--indicator color r g b a
icr=1,
icg=1,
icb=1,
ica=1,
--background color r g b a
bcr=0,
bcg=0,
bcb=0,
bca=1,
}--end of settings table
--freeze and unfreeze the bar for editing
freeze_bar=1 -- when set to 0 bars will be redrawn every cycle, set to 1 bars will be freeze in place
--end settings
--calculations
if freeze_bar==1 and updates>10 then run=0 elseif freeze_bar==1 and updates==8 then run=1 elseif freeze_bar==0 then run=1 end
if run==1 then
nx=0;ny=0;x=set_bar4.x;y=set_bar4.y;xt_bar4={};yt_bar4={}
for i=1,set_bar4.l do
arc=((2*math.pi)/360)*(math.random(set_bar4.a1,set_bar4.a2))
nx=0+set_bar4.r*(math.sin(arc))
ny=0-set_bar4.r*(math.cos(arc))
x=x+nx;xt_bar4[i]=x;y=y+ny
if y>(set_bar4.y+set_bar4.range) and ny<0 then y=y+ny else y=y-ny end
if y<(set_bar4.y-set_bar4.range) and ny<0 then y=y-ny else y=y+ny end
yt_bar4[i]=y
end--for
end--if run
drawbar (set_bar4,xt_bar4,yt_bar4)
--end of calculations
--end of set up -- copy and paste this section for a new bar
--#########################################################################################################
cairo_select_font_face (cr, "Illuminate by Brittney Murphy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14);
cairo_move_to (cr,set_bar1.x,set_bar1.y-8)
cairo_show_text (cr, "average cpu " .. set_bar1.value .. "%")
cairo_stroke (cr)
cairo_move_to (cr,set_bar2.x,set_bar2.y-8)
cairo_show_text (cr, "core one " .. set_bar2.value .. "%")
cairo_stroke (cr)
cairo_move_to (cr,set_bar3.x,set_bar3.y-8)
cairo_show_text (cr, "core two " .. set_bar3.value .. "%")
cairo_stroke (cr)
cairo_move_to (cr,set_bar4.x,set_bar4.y-8)
cairo_show_text (cr, "core three " .. set_bar4.value .. "%")
cairo_stroke (cr)
end-- if updates>5
end-- end main function
--#########################################################################################################
function drawbar(set,xt,yt)
--background
if set.bg==nil then bg=0 else bg=set.bg end
if bg==1 then
cairo_set_line_width (cr,set.lw)
cairo_set_source_rgba (cr,set.bcr,set.bcg,set.bcb,set.bca)
for i=2,(tonumber(set.l))-1 do
cairo_move_to (cr,xt[i],yt[i])
cairo_rel_line_to (cr,0,set.w)
cairo_stroke (cr)
end
end
--outline
cairo_set_source_rgba (cr,set.lcr,set.lcg,set.lcb,set.lca)
cairo_set_line_width (cr,1)
for i=1,(set.l*2)+1 do
if i<(set.l+1) then
cairo_move_to (cr,xt[i],yt[i])
if xt[i+1]==nil then xt[i+1]=xt[i] end
if yt[i+1]==nil then yt[i+1]=yt[i] end
cairo_line_to (cr,xt[i+1],yt[i+1])
elseif i==set.l+1 then
cairo_move_to (cr,xt[set.l],yt[set.l])
cairo_line_to (cr,xt[set.l],yt[set.l]+set.w)
elseif i>set.l+1 and i<(set.l*2)+1 then
cairo_move_to (cr,xt[set.l-(i-(set.l+2))],yt[set.l-(i-(set.l+2))]+set.w)
if xt[set.l-((i+1)-(set.l+2))]==nil then xt[set.l-((i+1)-(set.l+2))]=xt[set.l-((i)-(set.l+2))] end
if yt[set.l-((i+1)-(set.l+2))]==nil then yt[set.l-((i+1)-(set.l+2))]=yt[set.l-((i)-(set.l+2))] end
cairo_line_to (cr,xt[set.l-((i+1)-(set.l+2))],yt[set.l-((i+1)-(set.l+2))]+set.w)
elseif i==(set.l*2)+1 then
cairo_move_to (cr,xt[1],yt[1]+set.w)
cairo_line_to (cr,xt[1],yt[1])
end
cairo_stroke (cr)
end
local function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
--indicator
--calculate percentage
local value=set.value/set.max
--calculate length
local value=round(value*set.l,0)
cairo_set_source_rgba (cr,set.icr,set.icg,set.icb,set.ica)
cairo_set_line_width (cr,set.lw)
for i=1,(tonumber(value)) do
cairo_move_to (cr,xt[i],yt[i])
cairo_rel_line_to (cr,0,set.w)
cairo_stroke (cr)
end
end--of functionthe setup for each bar is a little lengthy, but nothing too difficult
the only thing you need to do is replace the bar name for each variable...
so copy and paste the setup chunk into a blank file and replace for example "bar1" with "bar2"
then put it back into the lua script and edit settings
Last edited by mrpeachy (2011-04-07 21:48:58)
Offline
Requires
1. ConkyForecast v2.18 with: conkyForecast-SunsetSunriseCountdown
2. images: ~/Conky/images/Moon.png & ~/Conky/images/Sun.png --> sun-moon.tar.gz
After "sunrise" when it says: Sunset in: XX:XX:XX it displays a sun, after sundown it displays a moon until the next sunrise.
Conky - French
# To use #! in a conky use: ${exec echo '#!'}
# CBL Weather by Sector11
background no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints below,skip_taskbar,skip_pager
own_window_title CBL Weather
own_window_class CBL Weather
# Graphics
double_buffer yes
use_spacer right # yes is NOT an option - left right or none
override_utf8_locale yes
use_xft yes
xftfont monospace:size=8
xftalpha 1.0 #0.2
update_interval 1
uppercase no # set to yes if you want all text to be in uppercase
stippled_borders 0
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_graph_borders no
draw_outline no # amplifies text if yes
draw_shades no # shadecolor black
# Colors
default_color DCDCDC #Gainsboro
color0 7FFF00 #Chartreuse
color1 FFA07A #LightSalmon
color2 FF8C00 #Darkorange
color3 778899 #LightSlateGrey
color4 FFD700 #Gold
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
# colours below used by colorize script
color7 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
no_buffers yes
short_units yes
pad_percents 2
#max_specials 1024
#max_user_text 10000
# Layout
alignment tl
gap_x 5 # left-right
gap_y 10 # up-down
imlib_cache_size 0
minimum_size 230 0
maximum_width 230
text_buffer_size 5120
TEXT
${execpi 1800 conkyForecast --location=ARDF0127 --template=$HOME/CBL/weather/French.template}In: ~/conkyForecast.config:
LOCALE = frFrench.template - peut avoir besoin de quelques ajustages de langue.
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=0]${font}${goto 175} ST: ${color}[--datatype=LT --hideunits]${image [--datatype=WI] -p 10,20 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--datatype=HT --startday=0 --hideunits]
${goto 175}${color3}Min: ${color}[--datatype=LT --startday=0 --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits]${goto 175}${color3}RP: ${color}[--datatype=PC]
${goto 100}${color3}Vis:${color} [--datatype=VI]${goto 175}${color3}PR: ${color}[--datatype=DP --hideunits]
${goto 100}${color3}UV: ${color}[--datatype=UI] - ${color}[--datatype=UT]
${goto 40}${color3}P: ${color}[--datatype=BR] - [--datatype=BD]${color}
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC]${font}${color}
${color4}${hr 1}${color}${if_match "${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t}"=="Sunrise"}${image ~/Conky/images/Moon.png -p 150,140 -s 60x60}${else}${image ~/Conky/images/Sun.png -p 150,140 -s 60x60}${endif}
${voffset 5}${goto 22}${color3}Sunrise:${goto 90}${color}[--datatype=SR]
${goto 28}${color3}Sunset:${goto 90}${color}[--datatype=SS]
${goto 16}${color3}Daylight:${goto 90}${color}[--datatype=DL]
${goto 10}${color3}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t} in:${goto 90}${color}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009}
${color4}${hr 1}${color}
${goto 5}${voffset 0}${color3}[--datatype=MP]${image [--datatype=MI] -p 15,225 -s 50x50}${image [--datatype=BI] -p 85,225 -s 50x50}
${voffset 8}${goto 140}Vent: [--datatype=WA]° ([--datatype=WD])
${goto 140}Vit: [--datatype=WS]
${goto 140}CdeV: [--datatype=WG]
${voffset 8}${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=1]${goto 175}${font} ST: ${color}[--datatype=LT --startday=1 --hideunits]${image [--datatype=WI --startday=1] -p 15,295 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=1]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=1 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=1 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=1]${goto 175}${color3}RP: ${color}[--datatype=PC --startday=1]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=1]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=1] ${color3}Sunset: ${color}[--datatype=SS --startday=1]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=1]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=2]${goto 175}${font} ST: ${color}[--datatype=LT --startday=2 --hideunits]${image [--datatype=WI --startday=2] -p 15,425 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=2]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=2 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=2 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=2]${goto 175}${color3}RP: ${color}[--datatype=PC --startday=2]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=2]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=2] ${color3}Sunset: ${color}[--datatype=SS --startday=2]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=2]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=3]${goto 175}${font} ST: ${color}[--datatype=LT --startday=3 --hideunits]${image [--datatype=WI --startday=3] -p 15,550 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=3]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=3 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=3 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=3]${goto 175}${color3}RP: ${color}[--datatype=PC --startday=3]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=3]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=3] ${color3}Sunset: ${color}[--datatype=SS --startday=3]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=3]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=4]${goto 175}${font} ST: ${color}[--datatype=LT --startday=4 --hideunits]${image [--datatype=WI --startday=4] -p 15,670 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=4]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=4 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=4 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=4]${goto 175}${color3}RP: ${color}[--datatype=PC --startday=4]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=4]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=4] ${color3}Sunset: ${color}[--datatype=SS --startday=4]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=4]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=5]${goto 175}${font} ST: ${color}[--datatype=LT --startday=5 --hideunits]${image [--datatype=WI --startday=5] -p 15,797 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=5]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=5 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=5 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=5]${goto 175}${color3}RP: ${color}[--datatype=PC --startday=5]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=5]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=5] ${color3}Sunset: ${color}[--datatype=SS --startday=5]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=5]
${color4}${hr 1}${color}English
TEXT
${execpi 1800 conkyForecast --location=ARDF0127 --template=$HOME/CBL/weather/English.template}In: ~/conkyForecast.config:
LOCALE = enEnglish.template
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=0]${font}${goto 175} FL: ${color}[--datatype=LT --hideunits]${image [--datatype=WI] -p 10,20 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--datatype=HT --startday=0 --hideunits]
${goto 175}${color3}Min: ${color}[--datatype=LT --startday=0 --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits]${goto 175}${color3}Rain: ${color}[--datatype=PC]
${goto 100}${color3}Vis:${color} [--datatype=VI]${goto 175}${color3}DP: ${color}[--datatype=DP --hideunits]
${goto 100}${color3}UV: ${color}[--datatype=UI] - ${color}[--datatype=UT]
${goto 40}${color3}P: ${color}[--datatype=BR] - [--datatype=BD]${color}
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC]${font}${color}
${color4}${hr 1}${color}${if_match "${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t}"=="Sunrise"}${image ~/Conky/images/Moon.png -p 150,140 -s 60x60}${else}${image ~/Conky/images/Sun.png -p 150,140 -s 60x60}${endif}
${voffset 5}${goto 22}${color3}Sunrise:${goto 90}${color}[--datatype=SR]
${goto 28}${color3}Sunset:${goto 90}${color}[--datatype=SS]
${goto 16}${color3}Daylight:${goto 90}${color}[--datatype=DL]
${goto 10}${color3}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t} in:${goto 90}${color}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009}
${color4}${hr 1}${color}
${goto 5}${voffset 0}${color3}[--datatype=MP]${color}${image [--datatype=MI] -p 15,225 -s 50x50}${image [--datatype=BI] -p 85,225 -s 50x50}
${voffset 8}${goto 140}${color3}Wind: ${color}[--datatype=WA]°([--datatype=WD])
${goto 140}${color3}Speed: ${color}[--datatype=WS]
${goto 140}${color3}Gusts: ${color}[--datatype=WG]
${voffset 8}${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=1]${goto 175}${font} FL: ${color}[--datatype=LT --startday=1 --hideunits]${image [--datatype=WI --startday=1] -p 15,295 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=1]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=1 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=1 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=1]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=1]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=1]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=1] ${color3}Sunset: ${color}[--datatype=SS --startday=1]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=1]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=2]${goto 175}${font} FL: ${color}[--datatype=LT --startday=2 --hideunits]${image [--datatype=WI --startday=2] -p 15,425 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=2]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=2 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=2 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=2]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=2]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=2]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=2] ${color3}Sunset: ${color}[--datatype=SS --startday=2]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=2]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=3]${goto 175}${font} FL: ${color}[--datatype=LT --startday=3 --hideunits]${image [--datatype=WI --startday=3] -p 15,550 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=3]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=3 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=3 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=3]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=3]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=3]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=3] ${color3}Sunset: ${color}[--datatype=SS --startday=3]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=3]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=4]${goto 175}${font} FL: ${color}[--datatype=LT --startday=4 --hideunits]${image [--datatype=WI --startday=4] -p 15,670 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=4]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=4 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=4 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=4]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=4]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=4]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=4] ${color3}Sunset: ${color}[--datatype=SS --startday=4]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=4]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=5]${goto 175}${font} FL: ${color}[--datatype=LT --startday=5 --hideunits]${image [--datatype=WI --startday=5] -p 15,797 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=5]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=5 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=5 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=5]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=5]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=5]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=5] ${color3}Sunset: ${color}[--datatype=SS --startday=5]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=5]
${color4}${hr 1}${color}Spanish
TEXT
${execpi 1800 conkyForecast --location=ARDF0127 --template=$HOME/CBL/weather/Spanish.template}In: ~/conkyForecast.config:
LOCALE = esSpanish.template
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=0]${font}${goto 175} ST: ${color}[--datatype=LT --hideunits]${image [--datatype=WI] -p 10,20 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--datatype=HT --startday=0 --hideunits]
${goto 175}${color3}Mín: ${color}[--datatype=LT --startday=0 --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits]${goto 175}${color3}PP: ${color}[--datatype=PC]
${goto 100}${color3}Vis:${color} [--datatype=VI]${goto 175}${color3}PR: ${color}[--datatype=DP --hideunits]
${goto 100}${color3}UV: ${color}[--datatype=UI] - ${color}[--datatype=UT]
${goto 40}${color3}P: ${color}[--datatype=BR] - [--datatype=BD]${color}
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC]${font}${color}
${color4}${hr 1}${color}${if_match "${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t}"=="Sunrise"}${image ~/Conky/images/Moon.png -p 150,140 -s 60x60}${else}${image ~/Conky/images/Sun.png -p 150,140 -s 60x60}${endif}
${voffset 5}${goto 22}${color3}Sunrise:${goto 90}${color}[--datatype=SR]
${goto 28}${color3}Sunset:${goto 90}${color}[--datatype=SS]
${goto 16}${color3}Daylight:${goto 90}${color}[--datatype=DL]
${goto 10}${color3}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009 -t} in:${goto 90}${color}${execi 1 conkyForecast-SunsetSunriseCountdown --location=ARBA0009}
${color4}${hr 1}${color}
${goto 5}${voffset 0}${color3}[--datatype=MP]${image [--datatype=MI] -p 15,225 -s 50x50}${image [--datatype=BI] -p 85,225 -s 50x50}
${voffset 8}${goto 140}Vie: [--datatype=WA]° ([--datatype=WD])
${goto 140}Vel: [--datatype=WS]
${goto 140}Ráf: [--datatype=WG]
${voffset 8}${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=1]${goto 175}${font} ST: ${color}[--datatype=LT --startday=1 --hideunits]${image [--datatype=WI --startday=1] -p 15,295 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=1]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--startday=1 --datatype=HT --hideunits]
${goto 175}${color3}Mín: ${color}[--startday=1 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits --startday=1]${goto 175}${color3}PP: ${color}[--datatype=PC --startday=1]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=1]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=1] ${color3}Sunset: ${color}[--datatype=SS --startday=1]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=1]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=2]${goto 175}${font} ST: ${color}[--datatype=LT --startday=2 --hideunits]${image [--datatype=WI --startday=2] -p 15,425 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=2]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--startday=2 --datatype=HT --hideunits]
${goto 175}${color3}Mín: ${color}[--startday=2 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits --startday=2]${goto 175}${color3}PP: ${color}[--datatype=PC --startday=2]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=2]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=2] ${color3}Sunset: ${color}[--datatype=SS --startday=2]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=2]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=3]${goto 175}${font} ST: ${color}[--datatype=LT --startday=3 --hideunits]${image [--datatype=WI --startday=3] -p 15,550 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=3]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--startday=3 --datatype=HT --hideunits]
${goto 175}${color3}Mín: ${color}[--startday=3 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits --startday=3]${goto 175}${color3}PP: ${color}[--datatype=PC --startday=3]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=3]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=3] ${color3}Sunset: ${color}[--datatype=SS --startday=3]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=3]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=4]${goto 175}${font} ST: ${color}[--datatype=LT --startday=4 --hideunits]${image [--datatype=WI --startday=4] -p 15,670 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=4]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--startday=4 --datatype=HT --hideunits]
${goto 175}${color3}Mín: ${color}[--startday=4 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits --startday=4]${goto 175}${color3}PP: ${color}[--datatype=PC --startday=4]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=4]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=4] ${color3}Sunset: ${color}[--datatype=SS --startday=4]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=4]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=5]${goto 175}${font} ST: ${color}[--datatype=LT --startday=5 --hideunits]${image [--datatype=WI --startday=5] -p 15,797 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=5]${font}${voffset -15}${goto 175}${color3}Máx: ${color}[--startday=5 --datatype=HT --hideunits]
${goto 175}${color3}Mín: ${color}[--startday=5 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hr: ${color}[--datatype=HM --hideunits --startday=5]${goto 175}${color3}PP: ${color}[--datatype=PC --startday=5]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=5]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=5] ${color3}Sunset: ${color}[--datatype=SS --startday=5]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=5]
${color4}${hr 1}${color}Offline
I haven't posted my conky in a while. the mayan calendar is Mr.Peachy's other than that I pretty much patched the thing together myself.
here is the config for the conky on the right:
# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! :)
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 2.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 240
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
alignment top_right
gap_x 20
gap_y 20
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
# Output
##############################################
TEXT
$alignc${exec TD=`date +%_d`;TM=`date +%_m`;TY=`date +%_y`;echo "$TM/$TD/20$TY" | sed 's/ //g'}
$sysname $kernel${hr}
Host:$alignr$nodename
Uptime:$alignr$uptime
Updates: ${execi 3600 aptitude search "~U" | wc -l | tail}
CPU usage:${hr}
${cpu cpu0}%
${cpubar cpu0}
#${cpugraph cpu0}
disk usage${hr}
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
home
${font sans-serif:normal:size=8}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_used_perc /home}%
${fs_bar /home}
ram${hr}
MEM $alignc $mem / $memmax $alignr $memperc%
$membar
internet:$alignr${wireless_link_qual_perc wlan0}%
${wireless_essid wlan0}
${wireless_link_bar wlan0}
battery:$alignr ${battery_percent}%
${battery_bar}
PROCESSES ${hr}
NAME $alignr PID CPU
1 ${top name 1} $alignr ${top pid 1} ${top cpu 1}
2 ${top name 2} $alignr ${top pid 2} ${top cpu 2}
3 ${top name 3} $alignr ${top pid 3} ${top cpu 3}
4 ${top name 4} $alignr ${top pid 4} ${top cpu 4}
5 ${top name 5} $alignr ${top pid 5} ${top cpu 5}
WEATHER ${hr}
${execi 300 /home/jared/shel/airtemp.sh}$alignr temp
${execi 300 /home/jared/shel/press.sh}$alignr press
${execi 300 /home/jared/shel/wind.sh}$alignr wind
#${execi 300 /home/jared/shel/weather.sh}$alignr weather
#$alignc${exec echo '*its the #' }${exec TD=`date +%_d`;echo $TD}${exec echo ' day*'}
#$alignc${exec echo '*of the #'}${exec TM=`date +%_m`;echo $TM}${exec echo ' month*'}
#$alignc${exec echo '*of the year 20'}${exec TY=`date +%_y`;echo $TY}${exec echo '*'}
recent ufo sightings:
${execi 3600 ~/.ufo}
${execi 1800 /home/jared/.word.pl}
${execi 5 /home/jared/mayan_calendar.lua}here is the config how to put the calendar in:
lua_load /home/jared/.mayan_calendar.lua
lua_draw_hook_post draw_fig
TEXT(in a separate file of course)
and finally here is the code for the mayan calendar (this is Mr.Peachy's I didn't make this)
--yearclock by mrpeachy 2010 version3, fixed 17 bug
require 'cairo'
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
range=finish
deg=(finish-start)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start+(deg*(i-1))))+var1
interval2=degrads*(start+(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
--########################################--
-------------red on 12/21/2012--------------
nowdate=os.date("%d%m%Y") --days,month,year
changedate=05032011
if tonumber(nowdate)==changedate then
cairo_set_source_rgba (cr,1,0,0,1)--red
else
cairo_set_source_rgba (cr,1,0,0,1)--white
end
--########################################--
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval2)
end
end
function date_to_words()------------------------------------------------------------------------------------------
date=os.date("%d")
datecut=string.gsub(date, ".", "%1|")
datetable=string.split(datecut, "|")
if datetable[1]=="1" then
datetens=""
datespacer=""
if datetable[2]=="0" then
dateunit="tenth"
elseif datetable[2]=="1" then
dateunit="eleventh"
elseif datetable[2]=="2" then
dateunit="twelfth"
elseif datetable[2]=="3" then
dateunit="thirteenth"
elseif datetable[2]=="4" then
dateunit="fourteenth"
elseif datetable[2]=="5" then
dateunit="fifteenth"
elseif datetable[2]=="6" then
dateunit="sixteenth"
elseif datetable[2]=="7" then
fisrtdigit="seventeenth"
elseif datetable[2]=="8" then
dateunit="eighteenth"
elseif datetable[2]=="9" then
dateunit="nineteenth"
end
end
if datetable[1]=="0" or datetable[1]>"1" then
datespacer=" "
if datetable[1]=="2" then
datetens="twenty"
elseif datetable[1]=="3" then
datetens="thirty"
elseif datetable[1]=="0" then
datetens=""
end
if datetable[2]=="1" then
dateunit="first"
elseif datetable[2]=="2" then
dateunit="second"
elseif datetable[2]=="3" then
dateunit="third"
elseif datetable[2]=="4" then
dateunit="fourth"
elseif datetable[2]=="5" then
dateunit="fifth"
elseif datetable[2]=="6" then
dateunit="sixth"
elseif datetable[2]=="7" then
dateunit="seventh"
elseif datetable[2]=="8" then
dateunit="eighth"
elseif datetable[2]=="9" then
dateunit="nineth"
elseif datetable[2]=="0" then
dateunit=""
datespacer=""
end
end
if datetable[2]=="0" then
datetens=""
datespacer=""
if datetable[1]=="2" then
dateunit="twentieth"
elseif datetable[1]=="3" then
dateunit="thirtieth"
end
end
return ((datetens) .. (datespacer) .. (dateunit))
end--end of function--------------------------------------------------------------------------------------
function number_to_words(text)
text=tonumber(text)
textlength=tonumber(string.len(text))
textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
--for NUMBERS from 1 to 999
--for 1 digit number----------
if textlength==1 then
if tonumber(texttable[1])==1 then
firstdigit="one"
elseif tonumber(texttable[1])==2 then
firstdigit="two"
elseif tonumber(texttable[1])==3 then
firstdigit="three"
elseif tonumber(texttable[1])==4 then
firstdigit="four"
elseif tonumber(texttable[1])==5 then
firstdigit="five"
elseif tonumber(texttable[1])==6 then
firstdigit="six"
elseif tonumber(texttable[1])==7 then
firstdigit="seven"
elseif tonumber(texttable[1])==8 then
firstdigit="eight"
elseif tonumber(texttable[1])==9 then
firstdigit="nine"
elseif tonumber(texttable[1])==0 then
firstdigit="zero"
end
return (firstdigit)
end
--for 2 digit number------------------
if textlength==2 then
if tonumber(texttable[1])==1 then
seconddigit=""
spacer=""
if tonumber(texttable[2])==0 then
firstdigit="ten"
elseif tonumber(texttable[2])==1 then
firstdigit="eleven"
elseif tonumber(texttable[2])==2 then
firstdigit="twelve"
elseif tonumber(texttable[2])==3 then
firstdigit="thirteen"
elseif tonumber(texttable[2])==4 then
firstdigit="fourteen"
elseif tonumber(texttable[2])==5 then
firstdigit="fifteen"
elseif tonumber(texttable[2])==6 then
firstdigit="sixteen"
elseif tonumber(texttable[2])==7 then
fisrtdigit="seventeen"
elseif tonumber(texttable[2])==8 then
firstdigit="eighteen"
elseif tonumber(texttable[2])==9 then
firstdigit="nineteen"
end
end
if tonumber(texttable[1])>1 then
spacer=" "
if tonumber(texttable[1])==2 then
seconddigit="twenty"
elseif tonumber(texttable[1])==3 then
seconddigit="thirty"
elseif tonumber(texttable[1])==4 then
seconddigit="fourty"
elseif tonumber(texttable[1])==5 then
seconddigit="fifty"
elseif tonumber(texttable[1])==6 then
seconddigit="sixty"
elseif tonumber(texttable[1])==7 then
seconddigit="seventy"
elseif tonumber(texttable[1])==8 then
seconddigit="eighty"
elseif tonumber(texttable[1])==9 then
seconddigit="ninety"
end
if tonumber(texttable[2])==1 then
firstdigit="one"
elseif tonumber(texttable[2])==2 then
firstdigit="two"
elseif tonumber(texttable[2])==3 then
firstdigit="three"
elseif tonumber(texttable[2])==4 then
firstdigit="four"
elseif tonumber(texttable[2])==5 then
firstdigit="five"
elseif tonumber(texttable[2])==6 then
firstdigit="six"
elseif tonumber(texttable[2])==7 then
firstdigit="seven"
elseif tonumber(texttable[2])==8 then
firstdigit="eight"
elseif tonumber(texttable[2])==9 then
firstdigit="nine"
elseif tonumber(texttable[2])==0 then
firstdigit=""
spacer=""
end
end
return ((seconddigit) .. (spacer) .. (firstdigit))
end
--for 3 digit numbers-----------------------------
if textlength==3 then
if tonumber(texttable[2])==0 and tonumber(texttable[3])==0 then space="" end
if tonumber(texttable[2])>0 or tonumber(texttable[3])>0 then space=" and " end
if tonumber(texttable[2])==0 and tonumber(texttable[3])>0 then spacer="" end
if tonumber(texttable[1])==1 then
thirddigit="one hundred"
elseif tonumber(texttable[1])==2 then
thirddigit="two hundred"
elseif tonumber(texttable[1])==3 then
thirddigit="three hundred"
elseif tonumber(texttable[1])==4 then
thirddigit="four hundred"
elseif tonumber(texttable[1])==5 then
thirddigit="five hundred"
elseif tonumber(texttable[1])==6 then
thirddigit="six hundred"
elseif tonumber(texttable[1])==7 then
thirddigit="seven hundred"
elseif tonumber(texttable[1])==8 then
thirddigit="eight hundred"
elseif tonumber(texttable[1])==9 then
thirddigit="nine hundred"
end
if tonumber(texttable[2])==0 or tonumber(texttable[2])>1 then
if tonumber(texttable[3])==1 then
firstdigit="one"
elseif tonumber(texttable[3])==2 then
firstdigit="two"
elseif tonumber(texttable[3])==3 then
firstdigit="three"
elseif tonumber(texttable[3])==4 then
firstdigit="four"
elseif tonumber(texttable[3])==5 then
firstdigit="five"
elseif tonumber(texttable[3])==6 then
firstdigit="six"
elseif tonumber(texttable[3])==7 then
firstdigit="seven"
elseif tonumber(texttable[3])==8 then
firstdigit="eight"
elseif tonumber(texttable[3])==9 then
firstdigit="nine"
elseif tonumber(texttable[3])==0 then
firstdigit=""
spacer=""
end
end
if tonumber(texttable[2])==1 then
seconddigit=""
spacer=""
if tonumber(texttable[3])==0 then
firstdigit="ten"
elseif tonumber(texttable[3])==1 then
firstdigit="eleven"
elseif tonumber(texttable[3])==2 then
firstdigit="twelve"
elseif tonumber(texttable[3])==3 then
firstdigit="thirteen"
elseif tonumber(texttable[3])==4 then
firstdigit="fourteen"
elseif tonumber(texttable[3])==5 then
firstdigit="fifteen"
elseif tonumber(texttable[3])==6 then
firstdigit="sixteen"
elseif tonumber(texttable[3])==7 then
firstdigit="seventeen"
elseif tonumber(texttable[3])==8 then
firstdigit="eighteen"
elseif tonumber(texttable[3])==9 then
firstdigit="nineteen"
end
end
if tonumber(texttable[2])>1 then
spacer=" "
if tonumber(texttable[2])==2 then
seconddigit="twenty"
elseif tonumber(texttable[2])==3 then
seconddigit="thirty"
elseif tonumber(texttable[2])==4 then
seconddigit="fourty"
elseif tonumber(texttable[2])==5 then
seconddigit="fifty"
elseif tonumber(texttable[2])==6 then
seconddigit="sixty"
elseif tonumber(texttable[2])==7 then
seconddigit="seventy"
elseif tonumber(texttable[2])==8 then
seconddigit="eighty"
elseif tonumber(texttable[2])==9 then
seconddigit="ninety"
elseif tonumber(texttable[2])==0 then
seconddigit=""
end
end
return ((thirddigit) .. (space) .. (seconddigit) .. (spacer) .. (firstdigit))
end
end--of function
function conky_draw_fig()
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
--##########################################
cairo_set_line_width (cr,1)
hx0=200
hy0=200
radius=40
--############################################
--months of the year---------------------------------------------------------------------------------------------------
mnrad1=radius
mnrad2=mnrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
--draw circles
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
--calculations
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))
yeardays=31+febdaynum+31+30+31+30+31+31+30+31+30+31
yearsec=(yeardays*24*60*60)
jan=31*24*60*60
feb=jan+(febdaynum*24*60*60)
mar=feb+(31*24*60*60)
apr=mar+(30*24*60*60)
may=apr+(31*24*60*60)
jun=may+(30*24*60*60)
jul=jun+(31*24*60*60)
aug=jul+(31*24*60*60)
sep=aug+(30*24*60*60)
oct=sep+(31*24*60*60)
nov=oct+(30*24*60*60)
dec=nov+(31*24*60*60)
secdays = { jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec }
--circle indicator lines
for i=1,12 do
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
--indicator
doy=tonumber(os.date("%j"))
yrsecs=((doy-1)*24*60*60)+(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
mnrad3=mnrad2+10
arc=(2*math.pi/360)*((360/yearsec)*(yrsecs))
mnx1=0+mnrad2*(math.sin(arc))
mny1=0-mnrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))+4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))-4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
--circlewriting
--######################################################################--
--------------------patch for 17 bug--------------------------------------
year2d=os.date('%y')
if year2d==17 then
text1=((string.upper(os.date('%B'))) .. " TWO THOUSAND AND SEVENTEEN")
else
text1=((string.upper(os.date('%B'))) .. " TWO THOUSAND AND " .. string.upper(number_to_words(year2d)))
end
--######################################################################
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=mnrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=((360/yearsec)*((yrsecs))+4)
slen2=string.len(text)
finish=start+270
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--end of months around year-------------------------------------------------------------------------------------------------------------------------------
--##########################################################################################
--days around month----------------------------------------------------------------------
drad1=mnrad3
drad2=drad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
--draw circles
cairo_arc (cr,hx0,hy0,drad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,drad2,0,2*math.pi)
cairo_stroke (cr)
--calculations
monthnum=(tonumber(os.date('%m')))
monthdays = { 31, febdaynum, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
--drawin circle indicator lines
for i=1,monthdays[monthnum] do
arc=((2*math.pi/360)*((360/monthdays[monthnum])*(i)))
dx1=0+drad1*(math.sin(arc))
dy1=0-drad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/monthdays[monthnum])*(i)))
dx2=0+drad2*(math.sin(arc))
dy2=0-drad2*(math.cos(arc))
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx2,hy0+dy2)
cairo_stroke (cr)
end
--indicator
daynumsec=(tonumber(os.date('%d'))*24*60*60)+(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
monthnumsec=(monthdays[monthnum])*24*60*60
drad3=drad2+10
arc=(2*math.pi/360)*((360/monthnumsec)*(daynumsec))
dx1=0+drad2*(math.sin(arc))
dy1=0-drad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthnumsec)*((daynumsec))+4)
dx2=0+drad3*(math.sin(arc))
dy2=0-drad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthnumsec)*((daynumsec))-4)
dx3=0+drad3*(math.sin(arc))
dy3=0-drad3*(math.cos(arc))
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx2,hy0+dy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx3,hy0+dy3)
cairo_stroke (cr)
--circlewriting
--########################################--
-------------patch for 17 bug---------------
days=os.date("%d")
if days==17 then text1=((string.upper(os.date('%A'))) .. " THE SEVENTEENTH")
else
text1=((string.upper(os.date('%A'))) .. " THE " .. string.upper(date_to_words()))
end
--########################################--
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=drad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=((360/monthnumsec)*(daynumsec)+4)
slen1=string.len(text)
finish=start+(7.5*slen1)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--end of days around month-------------------------------------------------------------------------------------------------------
--####################################################################################################################################
--hours around day ---------------------------------------------------------------------------------------------------------------------
hrad1=drad3
hrad2=hrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
--draw eings
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
--draw ring indicator lines
for i=1,24 do
arc=((2*math.pi/360)*((360/24)*i))
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/24)*i))
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
--indicator
hrsec=(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
--mns=mn+sc
hrad3=hrad2+10
arc=((2*math.pi/360)*((360/(24*60*60)*hrsec)))
hx1=0+hrad2*(math.sin(arc))
hy1=0-hrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrsec)-4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrsec)+4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)
--circlewriting
hrnum=tonumber(os.date('%H'))
if hrnum==1 then hour="HOUR"
else hour="HOURS" end
--########################################--
-------------patch for 17 bug---------------
if hrnum==17 then text4="SEVENTEEN HOURS"
else
text4=((string.upper(number_to_words(hrnum))) .. " " .. hour)
end
--########################################--
--text must be in quotes
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=hrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=((360/(24*60*60))*(hrsec)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--end of hours around day----------------------------------------------------------------------------------------------------
--##############################################################################################################################
--minutes around hour--------------------------------------------------------------------------------------------------------------
mrad1=hrad3
mrad2=mrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
--draw circles
cairo_arc (cr,hx0,hy0,mrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mrad2,0,2*math.pi)
cairo_stroke (cr)
--draw circle indicator lines
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
mx1=0+mrad1*(math.sin(arc))
my1=0-mrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
mx2=0+mrad2*(math.sin(arc))
my2=0-mrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
--indicator
minsec=(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
mrad3=mrad2+10
arc=((2*math.pi/360)*((360/(60*60)*minsec)))
mx1=0+mrad2*(math.sin(arc))
my1=0-mrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(minsec)-4)
mx2=0+mrad3*(math.sin(arc))
my2=0-mrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(minsec)+4)
mx3=0+mrad3*(math.sin(arc))
my3=0-mrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)
--circlewriting
min=tonumber(os.date('%M'))
if min==1 then minute="MINUTE"
else minute="MINUTES" end
--########################################--
-------------patch for 17 bug---------------
if min==17 then text4="SEVENTEEN MINUTES"
else
text4=((string.upper(number_to_words(min))) .. " " .. minute)
end
--########################################--
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=mrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=((360/(60*60))*(minsec)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--end minutes around hour--------------------------------------------------------------------------------------
--seconds of minute-------------------------------------------------------------------------------------------
srad1=mrad3
srad2=srad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
--draw circles
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
--draw circle indicator lines
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
--indicator
sec=(tonumber(os.date('%S')))
srad3=srad2+10
arc=((2*math.pi/360)*((360/(60)*sec)))
sx1=0+srad2*(math.sin(arc))
sy1=0-srad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sec))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sec))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad3,0,2*math.pi)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
sec=tonumber(os.date('%S'))
if sec==1 then second="SECOND"
else second="SECONDS" end
--########################################--
-------------patch for 17 bug---------------
if sec==17 then text3="SEVENTEEN SECONDS"
else
text3=(string.upper(number_to_words(sec)) .. " " .. second)
end
--########################################--
--text must be in quotes
text=text3
--font name must be in quotes
font="mono"
fontsize=10
radius=srad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=((360/60)*((sec))+4)
slen3=string.len(text)
finish=start+(slen3*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--end seconds of minute-----------------------------------------------------------------------------------------------------------------------------
--end of calendar---------------------------------------------------------------------------------------------------
end--of if updates>5
end--of main functionregistered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!
Offline
I haven't posted my conky in a while. the mayan calendar is Mr.Peachy's other than that I pretty much patched the thing together myself.
Would you be so kind as to post:
airtemp.sh, press.sh, wind.sh & /weather.sh
That is one very nice simple informative conky.
Offline
since I'm in alaska I'm not sure if you can adapt these scripts for the weather in Buenos Aires was it?
anyways here it goes:
first you need to put this in a cronjob:
#! /bin/bash
# simple script to grab metar data from NOAA website
cd /home/jared/shel
#wget http://weather.noaa.gov/pub/data/observations/metar/stations/PAJN.TXT
rm PAJN.TXT
rm JNEA2.txt
wget -q http://weather.noaa.gov/pub/data/observations/metar/decoded/PAJN.TXT
wget -q http://www.ndbc.noaa.gov/data/realtime2/JNEA2.txtthen put these in the same directory would be the easiest:
weather.sh
#! /bin/bash
# simple script to parse metar data from NOAA website to conky output
#Weather
grep Weather /home/jared/shel/PAJN.TXT|cut -d ":" -f2|cut -d ")" -f1airtemp.sh
#! /bin/bash
# simple script to parse metar data from NOAA website to conky output
#Air Temp
grep Temp /home/jared/shel/PAJN.TXT|cut -d "(" -f2|cut -d ")" -f1press.sh
#! /bin/bash
# simple script to parse metar data from NOAA website to conky output
#Air Pressure
grep Hg /home/jared/shel/PAJN.TXT|cut -d "(" -f3|cut -d " " -f1wind.sh
#! /bin/bash
# simple script to parse metar data from NOAA website to conky output
#Wind
grep ob /home/jared/shel/PAJN.TXT|cut -d " " -f4my dad origionally made these I now know more about bash to put these all into one to maybe cut-down my cpu. hhmm . . 
I hope that somebody can figure out how to adapt these to where-ever that person lives. (talking to anybody who wants weather in their conky)
EDIT: if anybody wants my word of the day script and my ufo thing here they are:
word of the day:
#!/usr/bin/perl
use LWP::Simple;
use strict;
use warnings;
use Text::Wrap;
$Text::Wrap::columns=35;
my $html2 = get("http://www.wordthink.com/") or die "! Try again later !\n";
if ($html2=~m{<p>\n*<b>(.*?)</b>}i) {
print wrap("","","$1\n");
}
if ($html2=~m{</i>( )(.*?)( )(.*?)\n</p>}i) {
# $ $2 's/<i>//g';
print wrap("","","$2 $4\n");
}not perfect still shows italics an bod signs if they are in the website.
the ufo is midnightriders (I THINK) it's very far back though. IT ISN'T MINE!
#!/usr/bin/perl
use LWP::Simple;
use strict;
use Text::Wrap;
$Text::Wrap::columns=35;
my $location = "ak"; # <--- Enter your two letter state code here
my $country = "us";
# Don't change the stuff down there unless you know what you're doing.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print "Nothing found...\n" unless get_UFO_reports($location);
sub get_UFO_reports {
my (%a, $found);
my $html = get("http://mufoncms.com/cgi-bin/manage_sighting_reports.pl?mode=latest_reports") or die "! Could not access MUFON CMS !\n";
while ($html=~m{<tr>\s*<td nowrap>(.*?)</td>\s*<td nowrap>.*?</td>\s*<td>(.*?)</td>\s*<td align=center>$location, $country</td>}gi) {
print wrap("","","On $1: $2\n");
$found++;
}
return $found;
}Last edited by crunchy (2011-04-12 02:41:52)
registered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!
Offline
since I'm in alaska I'm not sure if you can adapt these scripts for the weather in Buenos Aires was it?
anyways here it goes:
Sure I can, you use:
http://weather.noaa.gov/weather/current/PAJN.html
I need:
http://weather.noaa.gov/weather/current/SABE.html
Too easy 
Check this out too: http://www.airnav.com/airport/PAJN
it seems to be concerned with US and territories only though.
THANK YOU!!!!!!
Last edited by Sector11 (2011-04-12 13:33:40)
Offline
i added some color
but now im afraid its too colorful!![]()
ive also improved the script
now i have 2 gaps to fill
the gap to the left of the calendar and the gap to the left of my up/downspeed barsi'm also working on putting a weather icon down the bottom...
im using a curl based system to get weather and ive got the forecast font installed... does anyone have a list of which font means what?
so for "partly cloudy" which letter produces the partly cloudy icon?
Stupid question. How did you do the barcode on the side? I really like that
Offline
mrpeachy wrote:i added some color
but now im afraid its too colorful!![]()
ive also improved the script
now i have 2 gaps to fill
the gap to the left of the calendar and the gap to the left of my up/downspeed barsi'm also working on putting a weather icon down the bottom...
im using a curl based system to get weather and ive got the forecast font installed... does anyone have a list of which font means what?
so for "partly cloudy" which letter produces the partly cloudy icon?
Stupid question. How did you do the barcode on the side? I really like that
the barcode is a font
http://www.dafont.com/theme.php?cat=711
i went with barcode 128
its sideways thanks to the rotate command in lua
i dont think i posted my code for the above setup... even though its not going to work on anyone elses system without major modifications
--conky setup by mrpeachy April 2011
--[[
call in conky rc (above text)
top_name_width 5 --needed for processes to fit
lua_load /path to file/display.lua
lua_draw_hook_pre draw_fig
]]
require 'cairo'
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
function max(a)
if a==nil then a=0 end
local mi = 1 --index of max value
local m = a[mi] --max value
for i, val in ipairs(a) do --can use pairs() as well, ipairs() indicates an array-like table
if val > m then
mi = i
m = val
end
end
return m, mi --neat feature of lua, can return multiple values
end
function dnumg(s)
str=string.gsub(s,"[ /%a]","")
return str
end
function dunit(s)
str=string.gsub(s,"[%d%p ]","")
return str
end
--------------------------------------------------------------------------------
function conky_draw_fig()
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==3 then
ctt={}
cttl=300
end
--####################################################################################################
if updates>5 then -- starts the display
--####################################################################################################
--####################################################################################################
--cpu average calculations
--CALCULATIONS OVER 5 MINUTES---------------------------------------------------
for i = 1, tonumber(cttl) do
if ctt[i+1]==nil then ctt[i+1]=0 end
ctt[i]=ctt[i+1]
if i==tonumber(cttl) then
ctt[cttl]=tonumber(conky_parse('${cpu cpu0}'))
end
end
--CALCULATE AVERAGE
cpu5min=0
for i=1,cttl do
if ctt[i]==nil then ctt[i]=0 end
cpu5min=cpu5min+ctt[i]
end
ready=#ctt
cpu5min=round(cpu5min/cttl,2)
----------------------------------------------------------------------------------
--conkyrc text
flx=5;fly=28;lw=11
--add=fly+((line-1)*lw)
--settings
line=0;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="S Y S T E M I N F O",textx=flx,texty=fly,tblue=0};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="UPTIME",textx=flx,tred=0};write(pass)
uptime=": " .. conky_parse("${uptime}")
pass={line=line,text=uptime,textx=flx+88};write(pass)
line=line+1;pass={line=line,text="MEMORY",textx=flx,tred=0};write(pass)
memory=": " .. conky_parse("${mem}") .. "/" .. conky_parse("${memmax}")
pass={line=line,text=memory,textx=flx+88};write(pass)
memperc=conky_parse("${memperc}") .. "%"
line=line+1.5;pass={line=line,text=memperc,textx=flx,fsize=18};write(pass)
line=line+0.5;pass={line=line,text="PROCESSES BY MEM:",textx=flx+40,tgreen=0,tblue=0};write(pass)
line=line+1;pass={line=line,text="NAME",textx=flx+88,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="MEM%",textx=flx+135,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="PID",textx=flx+180,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
tmn1=conky_parse("${top_mem name 1}")
tmn2=conky_parse("${top_mem name 2}")
tmn3=conky_parse("${top_mem name 3}")
tmm1=conky_parse("${top_mem mem 1}")
tmm2=conky_parse("${top_mem mem 2}")
tmm3=conky_parse("${top_mem mem 3}")
tmp1=conky_parse("${top_mem pid 1}")
tmp2=conky_parse("${top_mem pid 2}")
tmp3=conky_parse("${top_mem pid 3}")
line=line+1;pass={line=line,text=tmn1,textx=flx+88};write(pass)
pass={line=line,text=tmm1,textx=flx+135};write(pass)
pass={line=line,text=tmp1,textx=flx+180};write(pass)
line=line+1;pass={line=line,text=tmn2,textx=flx+88};write(pass)
pass={line=line,text=tmm2,textx=flx+135};write(pass)
pass={line=line,text=tmp2,textx=flx+180};write(pass)
line=line+1;pass={line=line,text=tmn3,textx=flx+88};write(pass)
pass={line=10,text=tmm3,textx=flx+135};write(pass)
pass={line=10,text=tmp3,textx=flx+180};write(pass)
line=line+1;pass={line=line,text="VOLUMES:",textx=flx,tred=0};write(pass)
line=line+1;pass={line=line,text="ROOT",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
root=": " .. conky_parse("${fs_used /}") .. "/" .. conky_parse("${fs_size /}")
pass={line=line,text=root,textx=flx+40};write(pass)
line=line+2;pass={line=line,text="HOME",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
home=": " .. conky_parse("${fs_used /home}") .. "/" .. conky_parse("${fs_size /home}")
pass={line=line,text=home,textx=flx+40};write(pass)
line=line+2;pass={line=line,text="CENTRAL PROCESSOR:",textx=flx,tred=0};write(pass)
line=line+1;pass={line=line,text="CORE 1",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
core1=": " .. conky_parse("${cpu cpu1}")
pass={line=line,text=core1 .. "%",textx=flx+88};write(pass)
line=line+1;pass={line=line,text="CORE 2",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
core2=": " .. conky_parse("${cpu cpu2}")
pass={line=line,text=core2 .. "%",textx=flx+88};write(pass)
line=line+1;pass={line=line,text="CORE 3",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
core3=": " .. conky_parse("${cpu cpu3}")
pass={line=line,text=core3 .. "%",textx=flx+88};write(pass)
----------------------------------------------------------------------------
totcpu=conky_parse("${cpu cpu0}") .. "%"
pass={line=line-1.5,text=totcpu,textx=flx,fsize=18};write(pass)
pass={line=line,text="5 MIN",textx=flx};write(pass)
if ready<300 then talpha=0.2 else talpha=1 end
pass={line=line+1,text=cpu5min .. "%",textx=flx,talpha=talpha};write(pass)
----------------------------------------------------------------------------
line=line+1;pass={line=line,text="PROCESSES BY CPU:",textx=flx+40,tgreen=0,tblue=0};write(pass)
line=line+1;pass={line=line,text="NAME",textx=flx+88,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="CPU%",textx=flx+135,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="PID",textx=flx+180,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
tcn1=conky_parse("${top name 1}")
tcn2=conky_parse("${top name 2}")
tcn3=conky_parse("${top name 3}")
tcc1=conky_parse("${top cpu 1}")
tcc2=conky_parse("${top cpu 2}")
tcc3=conky_parse("${top cpu 3}")
tcp1=conky_parse("${top pid 1}")
tcp2=conky_parse("${top pid 2}")
tcp3=conky_parse("${top pid 3}")
line=line+1;pass={line=line,text=tcn1,textx=flx+88};write(pass)
pass={line=line,text=tcc1,textx=flx+135};write(pass)
pass={line=line,text=tcp1,textx=flx+180};write(pass)
line=line+1;pass={line=line,text=tcn2,textx=flx+88};write(pass)
pass={line=line,text=tcc2,textx=flx+135};write(pass)
pass={line=line,text=tcp2,textx=flx+180};write(pass)
line=line+1;pass={line=line,text=tcn3,textx=flx+88};write(pass)
pass={line=line,text=tcc3,textx=flx+135};write(pass)
pass={line=line,text=tcp3,textx=flx+180};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="D A T E A N D T I M E",textx=flx,tblue=0};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="DATE",textx=flx,tred=0};write(pass)
date=": " .. os.date("%m/%d/%Y")
pass={line=line,text=date,textx=flx+88};write(pass)
line=line+1;pass={line=line,text="TIME",textx=flx,tred=0};write(pass)
time=": " .. os.date("%H:%M:%S")
pass={line=line,text=time,textx=flx+88};write(pass)
--####################################################################################################
--CALENDAR
--title text color
tred,tgreen,tblue,talpha=1,0,0,1
--title text font
tfont="Acknowledge TT BRK"
--title text size
tfontsize=12
--###################################################
--main body text color
bred,bgreen,bblue,balpha=1,1,1,1
--main body text font
mfont="Acknowledge TT BRK"
--main body text size
mfontsize=12
--###################################################
--highlight text color
hred,hgreen,hblue,halpha=1,1,0,1
--highlight font
hfont="Acknowledge TT BRK"
--highlight size
hfontsize=12
--###################################################
--surrounding numbers (previous and next month) 1=on, 0=off
surround=1
--surrounding dates text color
sred,sgreen,sblue,salpha=0.6,0.6,0.6,1
--surrounding font
sfont="Acknowledge TT BRK"
--surounding size
sfontsize=12
--##################################################
--position
across=50
flx=5;fly=28;lw=11
down=fly+((30-1)*lw)
--###################################################
--horizontal gap between dates
gaph=25
--###################################################
--gap between day titles and first line
gapt=11
--###################################################
--gap between calendar line
gapl=11
--###################################################
--spacer -- this can help with alignment enter 0, 1 space or 2 spaces between the ""
spacer=""
--###################################################
--start day, enter 0 for sunday, 1 for monday
sday=0
--###################################################
--## END OF CALENDAR SETUP ##########################
--###################################################
--calendar calcs
year=os.date("%G")
today=tonumber(os.date("%d"))
t1 = os.time( { year=year,month=03,day=01,hour=00,min=0,sec=0} );
t2 = os.time( { year=year,month=02,day=01,hour=00,min=0,sec=0} );
feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local totaldays=monthdays[1]+monthdays[2]+monthdays[3]+monthdays[4]+monthdays[5]+monthdays[6]+monthdays[7]+monthdays[8]+monthdays[9]+monthdays[10]+monthdays[11]+monthdays[12]
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
month=os.date("%m")
mdays=monthdays[tonumber(month)]
mdaystm=mdays
x=mdays+start_day
dnum={}
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
--###################################################
--print calendar titles
--###################################################
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 sday==0 then
dys={"SU","MO","TU","WE","TH","FR","SA"}
else
dys={"MO","TU","WE","TH","FR","SA","SU"}
end
--------------------------------
for i=1,7 do
cairo_move_to (cr, across+(gaph*(i-1)), down)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
cairo_select_font_face (cr, mfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, mfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
fn=i
for i=fn,fn+6 do
cairo_move_to (cr, across+(gaph*(i-fn)),down+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnum[i])
cairo_stroke (cr)
end
end
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
fn=i
for i=fn,fn+6 do
cairo_move_to (cr, across+(gaph*(i-fn)),down+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, dnumh[i])
cairo_stroke (cr)
end
end
--###############################################################################
if surround==1 then
thisstart=tonumber(start_day)+1
thisend=tonumber(start_day)+mdays
previous=tonumber(start_day)
nextmon=dlen-thisend
pmon=tonumber(month)-1
if pmon==0 then pmon=12 end
pmon=monthdays[pmon]
snum={}
for i=1,dlen do
snum[i]=""
end
for i=tonumber(thisend)+1,tonumber(thisend)+nextmon do
snum[i]=i-tonumber(thisend)
end
for i=1,previous do
snum[i]=pmon-(previous-(i))
end
cairo_select_font_face (cr, sfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, sfontsize);
cairo_set_source_rgba (cr,sred,sgreen,sblue,salpha)
for i=1,plen,7 do
fn=i
for i=fn,fn+6 do
cairo_move_to (cr, across+(gaph*(i-fn)),down+gapt+(gapl*((fn-1)/7)))
cairo_show_text (cr, snum[i])
cairo_stroke (cr)
end
end
end
--###################################################
--end of calendar
if mdays+start_day<36 then
line=line
else
line=line+1
end
--####################################################################################################
currentday=os.date("%j")
currentweek=os.date("%U")
--print (totaldays,currentday,currentweek)
line=line+1;pass={line=line,text="DAY"};write(pass)
line=line+1;pass={line=line,text=currentday};write(pass)
line=line+1;pass={line=line,text="OF"};write(pass)
line=line+1;pass={line=line,text=totaldays};write(pass)
line=line+1;pass={line=line,text="WEEK"};write(pass)
line=line+1;pass={line=line,text=currentweek};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="N E T W O R K",textx=flx,tblue=0};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="CURRENT ACTIVITY",textx=flx,tred=0};write(pass)
----------------------------------------------------------------------------------
privateip=conky_parse("${addr eth0}")
iptimer=(updates %1800)+1
if iptimer==1 or updates==10 then
publicip=conky_parse("${exec curl ifconfig.me}")
end
postit=0
if postit==1 then
publicipbar=publicip
privateip="myprivateip"
publicip="my publicip"
else
publicipbar=publicip
privateip=privateip
publicip=publicip
end
pass={line=line,text=": " .. privateip,textx=flx+125};write(pass)
pass={line=line+0.3,text=publicipbar,font="Code 128",fsize=28,textx=flx,trot=90};write(pass)
pass={line=line+0.5,text=publicip,textx=flx+30,trot=90};write(pass)
---------------------------------------------------------------------------------------------------------
line=line+1;pass={line=line,text="UPSPEED",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
upspeed=": " .. conky_parse("${upspeed eth0}")
pass={line=line,text=upspeed,textx=flx+125};write(pass)
line=line+1;pass={line=line,text="UPLOADED",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
uploaded=": " .. conky_parse("${totalup eth0}")
pass={line=line,text=uploaded,textx=flx+125};write(pass)
line=line+3;pass={line=line,text="DOWNSPEED",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
downspeed=": " .. conky_parse("${downspeed eth0}")
pass={line=line,text=downspeed,textx=flx+125};write(pass)
line=line+1;pass={line=line,text="DOWNLOADED",textx=flx+40,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
downloaded=": " .. conky_parse("${totaldown eth0}")
pass={line=line,text=downloaded,textx=flx+125};write(pass)
line=line+3;pass={line=line,text="NETWORK DATA:",textx=flx,tred=0};write(pass)
nwtime=os.date("%a %D")
line=line+1;pass={line=line,text=nwtime,textx=flx,tgreen=0,tblue=0};write(pass)
nwmnth=os.date("%B")
pass={line=line,text=nwmnth,textx=flx+115,tgreen=0,tblue=0};write(pass)
--#################################################
--network info on 1800 timer
nwtimer=(updates %1800)+1
if nwtimer==1 or updates==15 then--update
--daily
lookup=os.date("%D")
local f = io.popen("vnstat -d |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $2}'| sed -e 's/^[ \t]*//'") -- runs command
rxd=f:read("*a") -- read output of command
rxd=string.gsub(rxd,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -d |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $3}'| sed -e 's/^[ \t]*//'") -- runs command
txd= f:read("*a") -- read output of command
txd=string.gsub(txd,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -d |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $4}'| sed -e 's/^[ \t]*//'") -- runs command
tld= f:read("*a") -- read output of command
tld=string.gsub(tld,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -d |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $5}'| sed -e 's/^[ \t]*//'") -- runs command
avd= f:read("*a") -- read output of command
avd=string.gsub(avd,"[\t\n\r]","")
f:close()
--monthly
lookup=os.date("%h")
local f = io.popen("vnstat -m |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $2}'| sed -e 's/^[ \t]*//'") -- runs command
rxm= f:read("*a") -- read output of command
rxm=string.gsub(rxm,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -m |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $3}'| sed -e 's/^[ \t]*//'") -- runs command
txm= f:read("*a") -- read output of command
txm=string.gsub(txm,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -m |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $4}'| sed -e 's/^[ \t]*//'") -- runs command
tlm= f:read("*a") -- read output of command
tlm=string.gsub(tlm,"[\t\n\r]","")
f:close()
local f = io.popen("vnstat -m |grep '" .. lookup .. "' | awk -F'" .. lookup .. "' '{print $2}' |awk -F'|' '{print $5}'| sed -e 's/^[ \t]*//'") -- runs command
avm= f:read("*a") -- read output of command
avm=string.gsub(avm,"[\t\n\r]","")
f:close()
end
--#################################################
if rxd==nil then rxd=0 end
if rxm==nil then rxm=0 end
if txd==nil then txd=0 end
if txm==nil then txm=0 end
if tld==nil then tld=0 end
if tlm==nil then tlm=0 end
if avd==nil then avd=0 end
if avm==nil then avm=0 end
line=line+1;pass={line=line,text="RX",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="RX",textx=flx+115,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. rxd,textx=flx+22};write(pass)
pass={line=line,text=": " .. rxm,textx=flx+137};write(pass)
line=line+1;pass={line=line,text="TX",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="TX",textx=flx+115,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. txd,textx=flx+22};write(pass)
pass={line=line,text=": " .. txm,textx=flx+137};write(pass)
line=line+1;pass={line=line,text="TL",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="TL",textx=flx+115,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. tld,textx=flx+22};write(pass)
pass={line=line,text=": " .. tlm,textx=flx+137};write(pass)
line=line+1;pass={line=line,text="AV",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text="AV",textx=flx+115,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. avd,textx=flx+22};write(pass)
pass={line=line,text=": " .. avm,textx=flx+137};write(pass)
line=line+1.5;pass={line=line,text="30 DAY RX",textx=flx,tred=0};write(pass)
pass={line=line,text="30 DAY TX",textx=flx+110,tred=0};write(pass)
--####################################################################################################
--vnstat graphs
timer1=(updates % 1800)+1
if timer1==1 or updates==10 then
local f = io.popen("vnstat -d | grep '|' | tail -n 31 | sed ':a;N;$!ba;s/\\n/ /g' | sed -e 's/estimated/| |/' -e 's/--//g' -e 's/ //g'") -- runs command
vnday=f:read("*a") -- read output of command
f:close()
vnday=string.split(vnday, "|")
lvntab=#vnday-1
for i=1,lvntab do
if vnday[i]=="" then vnday[i]="1nodata" end
--print (vnday[i])
end
if dunit(vnday[6+4])=="KiB" then
end
vnday30rx={}
for i=0,(lvntab/9) do
if vnday[5+(i*4)]=="nil" then vnday[5+(i*4)]="1nodata" end
if dunit(vnday[5+(i*4)])=="GiB" then
vnday30rx[i]=tonumber(dnumg(vnday[5+(i*4)]))*1024
end
if dunit(vnday[5+(i*4)])=="KiB" then
vnday30rx[i]=tonumber(dnumg(vnday[5+(i*4)]))/1024
end
if dunit(vnday[5+(i*4)])=="MiB" then
vnday30rx[i]=tonumber(dnumg(vnday[5+(i*4)]))
end--if
end--for
vnday30tx={}
for i=1,(lvntab/9) do
if vnday[6+(i*4)]=="nil" then vnday[6+(i*4)]="1nodata" end
if tostring(dunit(vnday[6+(i*4)]))=="GiB" then
vnday30tx[i]=tonumber(dnumg(vnday[6+(i*4)]))*1024
end
if tostring(dunit(vnday[6+(i*4)]))=="KiB" then
vnday30tx[i]=tonumber(dnumg(vnday[6+(i*4)]))/1024
end
if tostring(dunit(vnday[6+(i*4)]))=="MiB" then
vnday30tx[i]=tonumber(dnumg(vnday[6+(i*4)]))
end--if
end--for
end--timer
--###############################################################################
--rx----------------------------------------------------
--graph position
acrossx=6.5
flx=5;fly=28;lw=11
downy=(fly+((line+5)*lw))
gheight=55
heightrx=gheight
--calculate table height----------------------------
heightm,position=max(vnday30rx)
ht=string.split(heightm, "%p")
ht=string.gsub(ht[1],"^.","")
htl=string.len(ht)
add=10^(htl-1)
addn=add
while heightm>add do
add=add+addn
end--while
heightm=(add)
----------------------------------------------------
cairo_set_line_width (cr,1)
height=(gheight/(heightm/100))
across=acrossx
down=downy
adjust=2.5
-----------------
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,0.75,0.75,0.75,1)
cairo_rectangle (cr,across-(adjust/2),down,(30*adjust)+(adjust),-heightrx)
cairo_stroke (cr)
cairo_set_source_rgba (cr,0.4,0.4,0.4,1)
cairo_move_to (cr,across+adjust*10,down)
cairo_rel_line_to (cr,0,-heightrx)
cairo_stroke (cr)
cairo_move_to (cr,across+adjust*20,down)
cairo_rel_line_to (cr,0,-heightrx)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*1))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*2))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*3))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
------------------------------------
cairo_set_line_width (cr,adjust)
cairo_set_source_rgba (cr,1,1,1,1)
for i=1,30 do
if vnday30rx[i]==nil then vnday30rx[i]=0 end
idata=(vnday30rx[i]/100)*height
cairo_move_to (cr,across+((31-i)*adjust),down)
cairo_line_to (cr,across+((31-i)*adjust),down-idata)
cairo_stroke (cr)
end--for
heightrx=gheight
font="Acknowledge TT BRK"
fontsize=12
tadjrx=-30*adjust-5
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fontsize);
cairo_move_to (cr,across-tadjrx,down-((heightrx/4)*0))
cairo_show_text (cr, "0 M")
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heightrx/4)*1))
cairo_show_text (cr, round((heightm/4)*1,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heightrx/4)*2))
cairo_show_text (cr, round((heightm/4)*2,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heightrx/4)*3))
cairo_show_text (cr, round((heightm/4)*3,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heightrx/4)*4))
cairo_show_text (cr, heightm)
cairo_stroke (cr)
--x axis label
across=across-6
downs=down+10
cairo_move_to (cr,across,downs)
cairo_show_text (cr, "30")
cairo_stroke (cr)
add=adjust*10
cairo_move_to (cr,across+add,downs)
cairo_show_text (cr, "20")
cairo_stroke (cr)
add=add+adjust*10
cairo_move_to (cr,across+add,downs)
cairo_show_text (cr, "10")
cairo_stroke (cr)
add=add+adjust*10
cairo_move_to (cr,across+add+2,downs)
cairo_show_text (cr, "0")
cairo_stroke (cr)
--tx-------------------------------------------------------------------------
--graph position
acrossx=115.5
flx=5;fly=28;lw=11
downy=(fly+((line+5)*lw))
gheight=55
heighttx=gheight
--calculate table height----------------------------
heightm,position=max(vnday30tx)
ht=string.split(heightm, "%p")
ht=string.gsub(ht[1],"^.","")
htl=string.len(ht)
add=10^(htl-1)
addn=add
while heightm>add do
add=add+addn
end--while
heightm=(add)
----------------------------------------------------
height=(gheight/(heightm/100))
adjust=2.5
across=acrossx
down=downy
------------------------------------
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,0.75,0.75,0.75,1)
cairo_rectangle (cr,across-(adjust/2),down,(30*adjust)+(adjust),-heighttx)
cairo_stroke (cr)
cairo_set_source_rgba (cr,0.4,0.4,0.4,1)
cairo_move_to (cr,across+adjust*10,down)
cairo_rel_line_to (cr,0,-heighttx)
cairo_stroke (cr)
cairo_move_to (cr,across+adjust*20,down)
cairo_rel_line_to (cr,0,-heighttx)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*1))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*2))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
cairo_move_to (cr,across,down-((gheight/4)*3))
cairo_rel_line_to (cr,30*adjust,0)
cairo_stroke (cr)
------------------------------------
cairo_set_line_width (cr,adjust)
cairo_set_source_rgba (cr,1,1,1,1)
for i=1,30 do
if vnday30tx[i]==nil then vnday30tx[i]=0 end
if vnday30tx[i+1]==nil then vnday30tx[i+1]=0 end
idata=(vnday30tx[i]/100)*height
iplus=(vnday30tx[i+1]/100)*height
cairo_move_to (cr,across+((31-i)*adjust),down)
cairo_line_to (cr,across+((31-i)*adjust),down-idata)
cairo_stroke (cr)
end--for
heighttx=gheight
font="Acknowledge TT BRK"
fontsize=12
tadjrx=-30*adjust-5
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fontsize);
cairo_move_to (cr,across-tadjrx,down-((heighttx/4)*0))
cairo_show_text (cr, "0 M")
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heighttx/4)*1))
cairo_show_text (cr, round((heightm/4)*1,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heighttx/4)*2))
cairo_show_text (cr, round((heightm/4)*2,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heighttx/4)*3))
cairo_show_text (cr, round((heightm/4)*3,2))
cairo_stroke (cr)
cairo_move_to (cr,across-tadjrx,down-((heighttx/4)*4))
cairo_show_text (cr, heightm)
cairo_stroke (cr)
--x axis label
across=across-6
downs=down+10
cairo_move_to (cr,across,downs)
cairo_show_text (cr, "30")
cairo_stroke (cr)
add=adjust*10
cairo_move_to (cr,across+add,downs)
cairo_show_text (cr, "20")
cairo_stroke (cr)
add=add+adjust*10
cairo_move_to (cr,across+add,downs)
cairo_show_text (cr, "10")
cairo_stroke (cr)
add=add+adjust*10
cairo_move_to (cr,across+add+2,downs)
cairo_show_text (cr, "0")
cairo_stroke (cr)
--end of vnstat graphs
--####################################################################################################
line=line+8.5;pass={line=line,hr=1};write(pass)
line=line+1;pass={line=line,text="W E A T H E R",textx=flx,tblue=0};write(pass)
line=line+1;pass={line=line,hr=1};write(pass)
--weather data
--reads KSDK website and extracts current weather conditions-------------------------------------------
timerw=(updates %1800)+1
if timerw==1 or updates==12 then
local f = io.popen("curl -L 'http://www.ksdk.com/weather/default.aspx' | grep -A37 '<h3>CURRENT CONDITIONS</h3>'")
data1= f:read("*a")
f:close()
local f = io.popen("echo '" .. data1 .. "' | gawk -F'>' -v RS='<' 'RT{print $NF}' | sed -e '/^[ \r]*$/d' -e 's/°/°/g' -e 's/%/%/g'")
data= f:read("*a")
data=string.split(data,"\n")
f:close()
end
line=line+1;pass={line=line,text=data[2],textx=flx,tred=0};write(pass)
line=line+1;pass={line=line,text="CONDITIONS",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. data[5],textx=flx+80};write(pass)
line=line+1;pass={line=line,text="TEMP",textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. data[3] .. data[4],textx=flx+80};write(pass)
line=line+1;pass={line=line,text=data[6],textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. data[7],textx=flx+80};write(pass)
line=line+1;pass={line=line,text=data[8],textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. data[9],textx=flx+80};write(pass)
line=line+1;pass={line=line,text=data[10],textx=flx,tred=0.75,tgreen=0.75,tblue=0.75};write(pass)
pass={line=line,text=": " .. data[11],textx=flx+80};write(pass)
line=line+2;pass={line=line,text="FORECAST",textx=flx,tred=0};write(pass)
line=line+1;pass={line=line,text=data[12],textx=flx,tgreen=0,tblue=0};write(pass)
pass={line=line,text=data[14],textx=flx+65,tgreen=0,tblue=0};write(pass)
pass={line=line,text=data[16],textx=flx+125,tgreen=0,tblue=0};write(pass)
line=line+1;pass={line=line,text=data[13],textx=flx};write(pass)
pass={line=line,text=data[15],textx=flx+65};write(pass)
pass={line=line,text=data[17],textx=flx+125};write(pass)
--get weather icon
cairo_move_to (cr,150,820)
cairo_select_font_face (cr, "ConkyWeather", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_set_font_size (cr, 56);
cairo_set_source_rgba (cr,1,1,1,1)
hours=tonumber(os.date("%H"))
if hours>20 or hours<6 then wicon="tonight " .. data[5] else wicon=data[5] end
cairo_show_text (cr,set_icon(wicon))
cairo_stroke (cr)
--end of conkytext
--#################################################################################
--bars -- bnum,barx,bary,bhigh,blong,bout
flx=5;fly=28;lw=11
---------------------
memperc=conky_parse("${memperc}");add=fly+((4)*lw)
pass={bnum=memperc,barx=flx+40,bary=add,bhigh=6,blong=173,bout=1};bar(pass)
rootbar=tonumber(conky_parse("${fs_used_perc /}"));add=fly+((12)*lw)
pass={bnum=rootbar,barx=flx,bary=add,bhigh=6,blong=150,bout=1};bar(pass)
homebar=tonumber(conky_parse("${fs_used_perc /home}"));add=fly+((14)*lw)
pass={bnum=rootbar,barx=flx,bary=add,bhigh=6,blong=150,bout=1};bar(pass)
core1=tonumber(conky_parse("${cpu cpu1}"));add=fly+((16)*lw)
pass={bnum=core1,barx=flx+130,bary=add,bhigh=6,blong=82,bout=1};bar(pass)
core2=tonumber(conky_parse("${cpu cpu2}"));add=fly+((17)*lw)
pass={bnum=core2,barx=flx+130,bary=add,bhigh=6,blong=82,bout=1};bar(pass)
core3=tonumber(conky_parse("${cpu cpu3}"));add=fly+((18)*lw)
pass={bnum=core3,barx=flx+130,bary=add,bhigh=6,blong=82,bout=1};bar(pass)
end--end if 5
end--end main function
function write(t)
flx=5;fly=28;lw=11
local line=t.line
add=fly+((line-1)*lw)
--set default font,fsize and face
if t.textx==nil then textx=flx else textx=t.textx end
if t.texty==nil then texty=add else texty=t.texty end
if t.hr==nil then hr=0 else hr=t.hr end
if t.font==nil then font="Acknowledge tt BRK" else font=t.font end
if t.fsize==nil then fsize=14 else fsize=t.fsize end
if t.face==nil then face=CAIRO_FONT_WEIGHT_NORMAL end
if t.face=="bold" then face=CAIRO_FONT_WEIGHT_BOLD end
if t.tred==nil then tred=1 else tred=t.tred end
if t.tgreen==nil then tgreen=1 else tgreen=t.tgreen end
if t.tblue==nil then tblue=1 else tblue=t.tblue end
if t.talpha==nil then talpha=1 else talpha=t.talpha end
if t.talpha==nil then talpha=1 else talpha=t.talpha end
if t.trot==nil then trot=0 else trot=t.trot end
if t.text~=nil then
local text=t.text
cairo_move_to(cr,textx,texty)
cairo_rotate (cr,(math.pi/180)*trot)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, face)
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_show_text (cr,text)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(trot*-1))
end
if t.hrl==nil then hrl=250 else hrl=t.hrl end
if t.hr~=nil then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_move_to (cr,textx,texty+0.5-3)
cairo_set_line_width (cr,1)
cairo_rel_line_to (cr,hrl,0)
cairo_stroke (cr)
end
end
function bar(t)
local bnum=t.bnum
if t.bmax==nil then bmax=100 else bmax=t.bmax end
local barx=t.barx+0.5
local bary=t.bary+0.5
local bhigh=t.bhigh
local blong=t.blong
local bout=t.bout
local length=((bnum/bmax)*blong)
cairo_rectangle (cr,barx,bary,length,-bhigh)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
if bout==1 then
cairo_rectangle (cr,barx,bary,blong,-bhigh)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_stroke (cr)
end
end
function set_icon(text)
local text = string.lower(text)
if string.find(text, "tonight") then
if string.find(text, "clear") then return("A")
elseif string.find(text, "thunderstorms") then return("K")
elseif string.find(text, "partly cloudy") then return("C")
elseif string.find(text, "cloudy") then return("D")
elseif string.find(text, "scattered clouds") then return("B")
elseif string.find(text, "overcast") then return("D")
elseif string.find(text, "freezing") then return("O")
elseif string.find(text, "sleet") then return("O")
elseif string.find(text, "flurries") then return("O")
elseif string.find(text, "snow") then return("r")
elseif string.find(text, "fog") then return("0")
elseif string.find(text, "haze") then return("0")
elseif string.find(text, "rain") then return("G")
else
return("-")
end
else
if string.find(text, "clear") then return("a")
elseif string.find(text, "sunny") then return("b")
elseif string.find(text, "chance of snow") then return("o")
elseif string.find(text, "chance of flurries") then return("p")
elseif string.find(text, "chance of thunderstorms") then return("m")
elseif string.find(text, "chance of rain") then return("g")
elseif string.find(text, "sleet") then return("w")
elseif string.find(text, "freezing rain") then return("v")
elseif string.find(text, "thunderstorms") then return("n")
elseif string.find(text, "light rain") then return("g")
elseif string.find(text, "overcast") then return("f")
elseif string.find(text, "mostly cloudy") then return("d")
elseif string.find(text, "partly cloudy") then return("c")
elseif string.find(text, "cloudy") then return("e")
elseif string.find(text, "scattered clouds") then return("b")
elseif string.find(text, "fog") then return("0")
elseif string.find(text, "haze") then return("7")
elseif string.find(text, "rain") then return("i")
elseif string.find(text, "snow") then return("r")
else
return("-")
end
end
endLast edited by mrpeachy (2011-04-12 23:59:57)
Offline
I'm trying to use Sector11's conky weather script and it's not displaying the correct region's weather info. I changed the location code (USNC0636) everywhere that I can find it, am I doing something wrong or did it just cache bad data before I changed the location code? Is there some way to wipe the cached data from conkyForecast?
~/.conkyrc
# To use #! in a conky use: ${exec echo '#!'}
# CBL Weather by Sector11
background no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints below,skip_taskbar,skip_pager
own_window_title CBL Weather
own_window_class CBL Weather
# Graphics
double_buffer yes
use_spacer right # yes is NOT an option - left right or none
override_utf8_locale yes
use_xft yes
xftfont monospace:size=8
xftalpha 1.0 #0.2
update_interval 1
uppercase no # set to yes if you want all text to be in uppercase
stippled_borders 0
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_graph_borders no
draw_outline no # amplifies text if yes
draw_shades no # shadecolor black
# Colors
default_color DCDCDC #Gainsboro
color0 7FFF00 #Chartreuse
color1 FFA07A #LightSalmon
color2 FF8C00 #Darkorange
color3 778899 #LightSlateGrey
color4 FFD700 #Gold
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
# colours below used by colorize script
color7 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
no_buffers yes
short_units yes
pad_percents 2
#max_specials 1024
#max_user_text 10000
# Layout
alignment br
gap_x 5 # left-right
gap_y 10 # up-down
imlib_cache_size 0
minimum_size 230 0
maximum_width 230
text_buffer_size 5120
TEXT
${execpi 1800 conkyForecast --location=USNC0636 --template=$HOME/CBL/weather/English.template~/CBL/weather/English.template
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=0]${font}${goto 175} FL: ${color}[--datatype=LT --hideunits]${image [--datatype=WI] -p 10,20 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--datatype=HT --startday=0 --hideunits]
${goto 175}${color3}Min: ${color}[--datatype=LT --startday=0 --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits]${goto 175}${color3}Rain: ${color}[--datatype=PC]
${goto 100}${color3}Vis:${color} [--datatype=VI]${goto 175}${color3}DP: ${color}[--datatype=DP --hideunits]
${goto 100}${color3}UV: ${color}[--datatype=UI] - ${color}[--datatype=UT]
${goto 40}${color3}P: ${color}[--datatype=BR] - [--datatype=BD]${color}
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC]${font}${color}
${color4}${hr 1}${color}${if_match "${execi 1 conkyForecast-SunsetSunriseCountdown --location=USNC0636 -t}"=="Sunrise"}${image ~/Conky/images/Moon.png -p 150,140 -s 60x60}${else}${image ~/Conky/images/Sun.png -p 150,140 -s 60x60}${endif}
${voffset 5}${goto 22}${color3}Sunrise:${goto 90}${color}[--datatype=SR]
${goto 28}${color3}Sunset:${goto 90}${color}[--datatype=SS]
${goto 16}${color3}Daylight:${goto 90}${color}[--datatype=DL]
${goto 10}${color3}${execi 1 conkyForecast-SunsetSunriseCountdown --location=USNC0636 -t} in:${goto 90}${color}${execi 1 conkyForecast-SunsetSunriseCountdown --location=USNC0636}
${color4}${hr 1}${color}
${goto 5}${voffset 0}${color3}[--datatype=MP]${color}${image [--datatype=MI] -p 15,225 -s 50x50}${image [--datatype=BI] -p 85,225 -s 50x50}
${voffset 8}${goto 140}${color3}Wind: ${color}[--datatype=WA]°([--datatype=WD])
${goto 140}${color3}Speed: ${color}[--datatype=WS]
${goto 140}${color3}Gusts: ${color}[--datatype=WG]
${voffset 8}${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=1]${goto 175}${font} FL: ${color}[--datatype=LT --startday=1 --hideunits]${image [--datatype=WI --startday=1] -p 15,295 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=1]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=1 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=1 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=1]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=1]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=1]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=1] ${color3}Sunset: ${color}[--datatype=SS --startday=1]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=1]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=2]${goto 175}${font} FL: ${color}[--datatype=LT --startday=2 --hideunits]${image [--datatype=WI --startday=2] -p 15,425 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=2]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=2 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=2 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=2]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=2]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=2]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=2] ${color3}Sunset: ${color}[--datatype=SS --startday=2]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=2]
${color4}${hr 1}${color}
${goto 100}${font monospace:size=12}${color3}[--datatype=DW --shortweekday --startday=3]${goto 175}${font} FL: ${color}[--datatype=LT --startday=3 --hideunits]${image [--datatype=WI --startday=3] -p 15,550 -s 60x60}
${goto 100}${font Zekton:size=20}${color}[--datatype=HT --startday=3]${font}${voffset -15}${goto 175}${color3}Max: ${color}[--startday=3 --datatype=HT --hideunits]
${goto 175}${color3}Min: ${color}[--startday=3 --datatype=LT --hideunits]
${goto 100}${voffset 5}${color3}Hum: ${color}[--datatype=HM --hideunits --startday=3]${goto 175}${color3}Rain: ${color}[--datatype=PC --startday=3]
${voffset 5}${goto 10}${color4}${font monospace:bold:size=10}[--datatype=CC --startday=3]${font}${color}
${goto 23}${color3}Sunrise: ${color}[--datatype=SR --startday=3] ${color3}Sunset: ${color}[--datatype=SS --startday=3]
${goto 71}${color3}DayLight: ${color}[--datatype=DL --startday=3]~/.conkyForecast.config
# config settings for conkyForecast.py
CACHE_FOLDERPATH = /tmp/
CONNECTION_TIMEOUT = 5
EXPIRY_MINUTES = 30
TIME_FORMAT = %H:%M
DATE_FORMAT = %Y-%m-%d
LOCALE = en
XOAP_PARTNER_ID = censored
XOAP_LICENCE_KEY = censored
DEFAULT_LOCATION = USNC0636
MAXIMUM_DAYS_FORECAST = 4
AUTO_NIGHT = False
BASE_XOAP_URL = http://xoap.weather.com/weather/local/<LOCATION>?cc=*&dayf=5&link=xoap&prod=xoap&par=<XOAP_PARTNER_ID>&key=<XOAP_LICENCE_KEY>&unit=m
#BASE_XOAP_URL = http://xml.weather.com/weather/local/<LOCATION>?cc=*&dayf=10&link=xoap&prod=xoap&par=<XOAP_PARTNER_ID>&key=<XOAP_LICENCE_KEY>&unit=m
PROXY_HOST =
PROXY_PORT = 8080
PROXY_USERNAME =
PROXY_PASSWORD = Offline
This is my first conky. Nothing fancy. Maybe later i can add some if statements and mess around with an lua but for now this is it.
background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 200
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color orange
default_shade_color black
default_outline_color white
alignment top_right
gap_x 12
gap_y 12
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
TEXT
${font sans-serif:bold:size=8}SYSTEM ${hr 2}
${font sans-serif:normal:size=8}$sysname $kernel $alignr $machine
Host:$alignr$nodename
Uptime:$alignr$uptime
File System: $alignr${fs_type}
Battery: ${alignr}${battery_percent BAT1}% ${battery_bar 8,100 BAT1}
${font sans-serif:bold:size=8}PROCESSORS ${hr 2}
CPU1: ${cpu cpu1}% $alignr CPU2: ${cpu cpu2}%
${cpugauge cpu1} $alignr ${cpugauge cpu2}
CPU3: ${cpu cpu3}% $alignr CPU4: ${cpu cpu4}%
${cpugauge cpu3}$alignr ${cpugauge cpu4}
${font sans-serif:bold:size=8}MEMORY ${hr 2}
${font sans-serif:normal:size=8}RAM $alignc $mem / $memmax $alignr $memperc%
$membar
${font sans-serif:bold:size=8}DISKS ${hr 2}
${font sans-serif:normal:size=8}/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /}%
${fs_bar /}
SWAP $alignc ${swap} / ${swapmax} $alignr ${swapperc}%
${swapbar}
${font sans-serif:bold:size=8}TOP PROCESSES ${hr 2}
${font sans-serif:normal:size=8}${top_mem name 1}${alignr}${top_mem pid 1}${top mem 1} %
${top_mem name 2}${alignr}${top_mem pid 2}${top mem 2} %
$font${top_mem name 3}${alignr}${top_mem pid 3}${top mem 3} %
$font${top_mem name 4}${alignr}${top_mem pid 4}${top mem 4} %
$font${top_mem name 5}${alignr}${top_mem pid 5}${top mem 5} %
${font sans-serif:bold:size=8}NETWORK ${hr 2}
${font}$alignc Signal Strength
${wireless_bitrate wlan0}$alignc ${wireless_link_bar 8,100 wlan0}
$alignc DLS:${downspeedf wlan0}kb/s
$alignc ${downspeedgraph wlan0 8,100}
$alignc ULS:${upspeedf wlan0}kb/s
$alignc ${upspeedgraph wlan0 8,100}
${font}ESSID: $alignr ${wireless_essid wlan0}
${font sans-serif:normal:size=8}IP address: $alignr ${addr wlan0}Last edited by Da#!R0cK$ (2011-04-14 01:18:33)
Offline
Offline
Offline
Offline
@ sunjack
i liked the blue indicator on black background curves better, like the setup you posted in the screenshot thread. 
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.