You are not logged in.
Looks awesome! I would recommend putting it at the bottom of a conky, the bigger comics (like heartbleed_explanation.png spill down in overflow so any text below it might be hard to read. I'll have to think of a mogrify command to clip while resizing.
And thanks, just added a thumbnail now.
Last edited by dynendal (2014-06-17 22:38:24)
Offline
Looks awesome! I would recommend putting it at the bottom of a conky, the bigger comics (like heartbleed_explanation.png spill down in overflow so any text below it might be hard to read. I'll have to think of a mogrify command to clip while resizing.
And thanks, just added a thumbnail now.
That was a test conky that changes every time I test something.
What I have now is: Cartoon in a Box!
If I find 250 isn't wide enough, I will change it.
own_window_hints below,skip_taskbar,skip_pager ##undecorated
minimum_size 250 950 # w|h
maximum_width 250
gap_x 0 # l|r
gap_y 0 # u|d
alignment mm
lua_load /media/5/Conky/LUA/draw-bg.lua
update_interval 1
TEXT
${lua conky_draw_bg 0 0 0 0 0 0x000000 0.5}
${execi 5000 ~/bin/xkcd.sh}
${image ~/bin/XKCD.png -p 10,10}
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Done ! more discreet.. but still big...
Conky_all_lua_archive
Last edited by ragamatrix (2014-06-19 09:54:22)
Offline
here is a not quite practical (unreadable) ~0.66-smallened to usual desktop sidebar clock sizes version of
:
--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
--smallened 118:78, aaa3 2014-06-20
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if updates<=3 then return "" end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=15
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l" --"l"=left, "r"=right, "c"=center
default_vertical_justify="n" --"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=80,80
--########################################################################################
--background circle
hexcolor({c=0x212121})
cairo_arc(cr,centx,centy,78,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x3c3c3c})
cairo_arc(cr,centx,centy,72,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({ff="b"})
hexcolor({c=0xccaa7a})
--set clock type
clock_hours=12
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
--if string.find(i/5,"%.")~=nil then
x,y=pt(centx,centy,72,((360/60)*i)) --x,y,radius,rotationpos
cairo_move_to(cr,x,y)
x,y=pt(centx,centy,65,((360/60)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end--for
--draw numbers and dots around main circle
if clock_hours==24 then
for i=1,24 do
if i==24 or i==8 or i==16 then
x,y=pt(centx,centy,55,((360/24)*i))
text({y=y,x=x,t=i,hj="c",vj="m"})
end
if i==4 or i==12 or i==20 then
hexcolor({c=0xdac09b})
x,y=pt(centx,centy,66,((360/24)*i))
cairo_arc(cr,x,y,4,0,2*math.pi)
cairo_fill(cr)
else
hexcolor({c=0xccaa7a})
x,y=pt(centx,centy,66,((360/24)*i))
cairo_arc(cr,x,y,2.6,0,2*math.pi)
cairo_fill(cr)
end
end--for
elseif clock_hours==12 then
for i=1,12 do
if i==12 or i==4 or i==8 then
x,y=pt(centx,centy,55,((360/12)*i))
text({y=y,x=x,t=i,hj="c",vj="m"})
end
if i==2 or i==6 or i==10 then
hexcolor({c=0xdac09b})
x,y=pt(centx,centy,66,((360/12)*i))
cairo_arc(cr,x,y,4,0,2*math.pi)
cairo_fill(cr)
else
hexcolor({c=0xccaa7a})
x,y=pt(centx,centy,66,((360/12)*i))
cairo_arc(cr,x,y,2.6,0,2*math.pi)
cairo_fill(cr)
end
end--for
end--if
--outer circle
cairo_arc(cr,centx,centy,72,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,64,60)
font({fs=7,ff="n"})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,44,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end
--marks
for i=0,24 do
if string.find(i/3,"%.")~=nil and i~=0 then
x,y=pt(dcx,dcy,37,180+((120/24)*i))
cairo_move_to(cr,x,y)
x,y=pt(dcx,dcy,35,180+((120/24)*i)) --inner endpoint of lines
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(dcx,dcy,36,180+((120/24)*i))
cairo_arc(cr,x,y,1.5,0,2*math.pi) --dots
cairo_fill(cr)
end
end
--day name
font({fs=15,ff="b"})
dtx,dty=pt(dcx,dcy,18,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,1.5)
hexcolor({c=0xdac09b})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,34,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=7,ff="n"})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,64,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31}
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
if string.find((i-1)/3,"%.")~=nil then
x,y=pt(mcx,mcy,38,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,36,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(mcx,mcy,38,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,34,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,45,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end
--month name
font({fs=15,ff="b"})
text({x=mcx,y=mcy-19,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,1.5)
hexcolor({c=0xdac09b})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,33,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=7,ff="n"})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,64,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,39,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
x,y=pt(ycx,ycy,39,60+((angle[i] or 0)))
cairo_move_to(cr,x,y)
x,y=pt(ycx,ycy,36,60+((angle[i] or 0)))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,44,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=15,ff="b"})
ytx,yty=pt(ycx,ycy,19,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=9})
text({x=ytx-6,y=yty-5,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,1.5)
hexcolor({c=0xdac09b})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,35,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xdac09b,a=1})
cairo_arc(cr,centx,centy,4,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
if clock_hours==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
elseif clock_hours==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*24))
end
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xdac09b,a=0.75}) --alpha was 0.8 orig
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
50,--string or value for hand length (radius)
1.5,--set hand center width in pixels
11,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
hexcolor({c=0xdac09b,a=0.7})
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
61,--string or value for hand length (radius)
2,--set hand center width in pixels
8,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.85--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end
function adeg(deg)
return(math.pi/180)*(deg-90)
end
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f or default_font_name or "mono"
local size=fontt.fs or default_font_size or 12
local face=fontt.ff or default_font_face or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c or default_hex_color or 0xffffff
local a=hexcolort.a or default_alpha or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function rgbcolor(rgbcolort)
local r=rgbcolort.r or default_red or 1
local g=rgbcolort.g or default_green or 1
local b=rgbcolort.b or default_blue or 1
local a=rgbcolort.a or default_alpha or 1
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x or 100
local y=textt.y or 100
local t=textt.t or "set txt"
local hj=textt.hj or default_horizontal_justify or "l"
local vj=textt.vj or default_vertical_justify or "n"
local r=textt.r or default_rotation or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ###################################################################
Last edited by aaa3 (2014-06-20 20:34:50)
Offline
@ aaa3
Screenshot?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
ah, thought not necessary as its virtually the same just smaller, but here it is
(btw, since then, i ve already changed in my own local file the two upper arcs to use size 6 instead of 7 fonts as those are not need to be read really, and it looks way nicer that way. but i guess more users would like useability first.)
- edit, the 24h version looks much better so lets post it too : D - together w t smaller fonts, and an overview picture. i use the 12 (now), thats why the original post.and a size comparison
Last edited by aaa3 (2014-06-21 00:09:54)
Offline
re-working on old lua one...
Done !
OK, when did you sneak this one in? Love the Blue
You are bewitched - your head is rotating
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
ragamatrix wrote:re-working on old lua one...
Done !
OK, when did you sneak this one in? Love the Blue
You are bewitched - your head is rotating
Conky lua makes my head turning...
The blue one is in the archive ?? not sure to have understood your request ?
I'm not at home but try it and just say me if it's the right one in this dropbox archive...?
Offline
Has anyone manage to display the scores in the current World Cup game?
Offline
Conky lua makes my head turning...
The blue one is in the archive ?? not sure to have understood your request ?
I'm not at home but try it and just say me if it's the right one in this dropbox archive...?
Not a request... It was a compliment to your work - I like the conky you created ... on the blue background.
And , not the LUA, the animated gif you used in your post. --> bewitching ]:D
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Has anyone manage to display the scores in the current World Cup game?
Hey, nice idea ... so I went looking for an RSS feed ... still looking ... but you can use this meantime:
back to searching....
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Dave6 wrote:Has anyone manage to display the scores in the current World Cup game?
Hey, nice idea ... so I went looking for an RSS feed ... still looking ... but you can use this meantime:
back to searching....
Thanks for the link, I couldn't find a suitable RSS feed either...
Offline
Thanks for the link, I couldn't find a suitable RSS feed either...
You're welcome. You can join is here too: 2014 - Brasil - FIFA World Cup
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
ragamatrix wrote:Conky lua makes my head turning...
The blue one is in the archive ?? not sure to have understood your request ?
I'm not at home but try it and just say me if it's the right one in this dropbox archive...?Not a request... It was a compliment to your work - I like the conky you created ... on the blue background.
And , not the LUA, the animated gif you used in your post. --> http://s8.postimg.org/erretqpyp/jawaxswirl1.gif bewitching ]:D
Outch... Now you know my English level ... :8 Thanks for the compliment
I'm searchin a good rss field to display world cup calendar matches too... but I didn't find something usable in conky...
Offline
You would have to use the Way Back Machine to find it (them), but there were some scripts that would parse the scoreboard from a site like ESPN and display the results in conky.
and a simple two liner with just the basics:
Last edited by PackRat (2014-06-25 19:10:10)
"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe
Offline
Offline
dk75 wrote:Any imlib images ($image function) when transparency is set will be blurred/washed.
It was reported with Conky 1.9 and it still present in Conky 2.0.
It's a bug with how Conky draw Imlib images.is there a way to fix this problem? or a workaround??
A patch that fixes this for conky 1.9.1 was recently accepted into conky.
It creates a new setting in .conkyrc that changes a setting in the imlib2 library used by ${image} that determines if the ${image} function will draw images with an alpha channel or not.
I don't have a composited environment setup so I have not personally tested if this works though.
The imlib2 setting being changed is this one.
imlib_image_set_has_alpha(has_alpha)
Parameters:
has_alpha Alpha flag.
Sets the alpha flag for the current image. Set has_alpha to 1 to enable the alpha channel in the current image, or 0 to disable it.
If you use the imlib2 lua binding in a lua script (not ${image}) you can change this setting by putting
imlib_image_set_has_alpha(0)
in your script before you have it display an image to disable the alpha channel so it won't be transparent.
ARGB images (those with built in transparency through inclusion of a alpha channel) likely need to have
imlib_image_set_has_alpha(1)
(the current default in conky) for the transparency information in their alpha channel to be used.
Since they have a alpha channel of their own they may display correctly in a composited environment by using their alpha settings and not the conky windows.
I can make a simple example lua function to test how well it works with different desktop setups if anyone is interested.
Offline
» Need help with formating width/height of a horizontal conky bar
So I have this conky-in-progress and I can't figure out how I can set the height of the bar. I want the bar to be just high enough for the text. Code is below:
# Settings
# fonts and font colors
use_xft yes
xftalpha 1
xftfont DejaVu Sans:size=8
default_color a9a9a9
default_shade_color 000000
default_outline_color 000000
# window and window colors
background yes
update_interval 0.5
total_run_times 0
own_window yes
#own_window_transparent 55%
own_window_type desktop
own_window_argb_visual yes
own_window_argb_value 140
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 1920 10
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
alignment tr
gap_x 0
gap_y 1
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
format_human_readable yes
# Output
TEXT
$alignr$nodename | \
Up $alignr$uptime | \
RAM$alignr$mem/$memmax | \
Swap$alignr$swap/$swapmax | \
Disk$alignr${fs_used /}/${fs_size /} | \
CPU$alignr ${cpu cpu1}% ${cpu cpu2}% ${cpu cpu3}% ${cpu cpu4}%
I would greatly appreciate any help that could be offered.
Offline
» Need help with formating width/height of a horizontal conky bar
So I have this conky-in-progress and I can't figure out how I can set the height of the bar. I want the bar to be just high enough for the text. Code is below:
I would greatly appreciate any help that could be offered.
A few questions:
1. Are you looking for a transparent background 'bar'? - I see the "# own_window_transparent 55#" and it leads me to think that.
2. or a solid bar that you have?
By commenting out "# own_window_transparent" you have created a bar - height 10 with font size 8 - "minimum_size 1900 10" what you need to reduce is 10 to 8 and add border_inner_margin 0
This is a bit tighter:
minimum_size 1900 8
border_inner_margin 0
Or are you looking for something like this that is semi-transparent:
Do you really want the bar across the entire top of the screen?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
A few questions:
1. Are you looking for a transparent background 'bar'? - I see the "# own_window_transparent 55#" and it leads me to think that.
2. or a solid bar that you have?By commenting out "# own_window_transparent" you have created a bar - height 10 with font size 8 - "minimum_size 1900 10" what you need to reduce is 10 to 8 and add border_inner_margin 0
This is a bit tighter:
minimum_size 1900 8 border_inner_margin 0
http://s20.postimg.org/ymlrxwv7t/2014_07_02_11_27_31_1920x1080_Sector11.jpg
Or are you looking for something like this that is semi-transparent:
http://s20.postimg.org/awwc97wuh/2014_07_02_11_33_13_1920x1080_Sector11.jpgDo you really want the bar across the entire top of the screen?
http://s20.postimg.org/4x8l5kc21/2014_07_02_11_39_26_1920x1080_Sector11.jpg
Answers to 1&2) What I am really wanting is to have my conky integrated with my tint2 panel, so that all my system monitors are on my panel but I couldn't figure out how to do this. In lieu of this, I have decided to make a semi-transparent bar across the very top above my panel, which will hold all my needed info while also matching my panel's look. And just to make it look nice, all the info I need there will be spaced to take the whole width.
The border_inner_margin is what I didn't know about. I had set the minimum_size to 1920 8 or 6 or 4 and it never changed, because I didn't know about the need for specifying the inner margin. So thanks for that! But there's still a problem. As I said I wanted the bar height to be just enough for the text, basically flush with the text height. With border_inner_margin 0 set, and leave minimum height at 10, it changed to this (I have moved my panel down some to show the conky bar more definitively). I again tried minimum height setting it to higher and lower values but it never changed.
Also, is it possible to send rightclick actions to the desktop when rightclicking on the conky bar?
Last edited by alaskan-hippie (2014-07-02 22:06:04)
Offline
Getting wound up now!!!
Does anyone have a simple plain text weather config?
I just want the current conditions and temperature for a number of locations.
I found this one and tried to make it work, but I'll be damned if I can! https://bbs.archlinux.org/viewtopic.php?id=37381&p=1
I've been searching to a solution for about 4hrs and can't find anything that works...
Any ideas?
Last edited by Dave6 (2014-07-05 20:31:50)
Offline
Getting wound up now!!!
Does anyone have a simple plain text weather config?
I just want the current conditions and temperature for a number of locations.
Any ideas?
Yes ... the native conky ${weather} command:
# conky -c /media/5/conky/CONKY_WEATHER_txt_files/conkyrc_NOAA &
# pkill -xf "conky -c /media/5/conky/CONKY_WEATHER_txt_files/conkyrc_NOAA" &
# To use #! in a conky use: ${exec echo '#!'}
# killall conky && conky -c /media/5/conky/CONKY_WEATHER/conkyrc_NOAA &
# by Sector11
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title A blank test
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### 'own_window_type override'
# own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 0
minimum_size 950 5 ## width, height
maximum_width 950 ## width, usually a good idea to equal minimum width
gap_x 0 ### left &right
gap_y 9 ### up & down
alignment top_middle
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Anonymous Pro:size=8
xftfont monofur:size=11
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 0
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
draw_shades yes
default_shade_color black
draw_outline no # amplifies text if yes
default_outline_color black
default_color DCDCDC #Gainsboro
color0 DAA520 #Goldenrod FFFFF0 #Ivory
color1 778899 #LightSlateGrey
color2 FF8C00 #Darkorange
color3 7FFF00 #Chartreuse
color4 FFA07A #LightSalmon
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 00FFFF #Cyan 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background no
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 1028
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
## lua_load /media/5/Conky/LUA/draw_bg.lua
## TEXT
## ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
##
## OR Both above TEXT (No composite manager required - no blinking!)
lua_load /media/5/Conky/LUA/draw-bg.lua
lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
## TEXT
##
####################################################### End LUA Settings ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
## Airport Codes
# http://www.airlinecodes.co.uk/aptcodesearch.asp
TEXT
J.Newbury ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE temperature}° Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_speed} km/h\
${goto 500}London ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU wind_speed} km/h
${color6} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE cloud_cover}\
${goto 500} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYXU cloud_cover}${color}
${color1}${hr}${color}
Ezeiza ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ wind_speed} km/h\
${goto 500}Montreal ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX wind_speed} km/h
${color6} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAEZ cloud_cover}\
${goto 500} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYMX cloud_cover}${color}
${color1}${hr}${color}
Mar del Plata ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM wind_speed} km/h\
${goto 500}Winnipeg ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG wind_speed} km/h
${color6} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SAZM cloud_cover}\
${goto 500} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ CYWG cloud_cover}${color}
${color1}${hr}${color}
Thessaloníki ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS wind_speed} km/h\
${goto 500}Athens ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV temperature}°\
Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV pressure}\
Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV humidity}%\
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV wind_speed} km/h
${color6} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGTS cloud_cover}\
${goto 500} ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LGAV cloud_cover}${color}
${color1}${hr}${color}
Updated: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE last_update}\
${goto 500}CPU: ${cpu}% - updating every second
Check it out here search for weather
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
conkyrc:
minimum_size 1680 1050
gap_x 0
gap_y 0
border_inner_margin 0
border_outer_margin 0
draw_shades no # #401 using "draw_shades yes" lua script runs twice per update
double_buffer yes
own_window yes
own_window_type dock
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_argb_visual yes
own_window_argb_value 255
update_interval 1.0
lua_load ~/ninlith.lua
lua_draw_hook_pre conky_main
TEXT
ninlith.lua:
--
-- ninlith.lua
-- Copyright (C) 2014 Okko Hartikainen
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Version: 0.1
-- Depends: qdbus, librsvg2-bin
--
require 'cairo'
local default_font = {
family = "Cantarell",
size = 15,
weight = CAIRO_FONT_WEIGHT_BOLD,
slant = CAIRO_FONT_SLANT_NORMAL,
}
local colors = {
normal = {0.8, 0.8, 0.8, 1},
background = {0, 0, 0, 1},
outline = {0.5, 0.5, 0.5, 0.33},
water = {0.1, 0.7, 1, 0.2},
water_surface = {0, 0.2, 0.3, 0.5},
boat_hull = {0.3, 0.2, 0.1, 1},
boat_outline = {0.25, 0.15, 0.05, 1},
boat_planking = {0, 0, 0, 0.1},
boat_flag_bg = {0, 0, 0, 1},
boat_flag_fg = {0.8, 0.8, 0.8, 1},
}
local icons = {
media = "/usr/share/icons/gnome/scalable/mimetypes/" ..
"audio-x-generic-symbolic.svg",
}
local icon_size = 16
local torrent_drops_margin = 200
local media_bar_vertical_alignment = 0.33
local water_minimum_height = 75
local top_panel_height = 28
local cpu_table = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
local cr, extents, boat_image_surface = nil, nil, nil
local is_first_run = true
local M_PI = math.pi
-------------------------------------------------------------------------------
-- conky_main
function conky_main()
-- setup
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)
extents = cairo_text_extents_t:create()
tolua.takeownership(extents)
if is_first_run then
predraw_boat()
convert_icons()
is_first_run = not is_first_run
else
draw_torrent_drops()
draw_media_bar()
draw_cpu_water()
end -- if
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr = nil
collectgarbage()
end -- conky_main
-------------------------------------------------------------------------------
-- draw_torrents_drops
function draw_torrent_drops()
local deluge_info = get_deluge_info()
local drop_x = conky_window.width - torrent_drops_margin
for _, value in pairs(deluge_info) do
local progress = value["Progress"]
if progress then
draw_drop(drop_x, tonumber(progress:match("%d+")))
drop_x = drop_x - 45
end -- if
end -- for
end -- draw_torrents_drops
-------------------------------------------------------------------------------
-- get_deluge_info
function get_deluge_info()
local command = "deluge-console info | tail -n +2"
local deluge_info, record = {}, {}
local file = io.popen(command)
for line in file:lines() do
local key, value = unpack(explode(": ", line, 2))
if value then
record[key] = value
else
table.insert(deluge_info, record)
record = {}
end -- if
end -- for
table.insert(deluge_info, record)
file:close()
return deluge_info
end -- get_deluge_info
-------------------------------------------------------------------------------
-- draw_drop
function draw_drop(x, progress)
local dh = 25
local dw = dh/2
local y = top_panel_height
cairo_set_source_rgba(cr, unpack(colors.background))
cairo_move_to(cr, x - dw*2, y)
cairo_curve_to(cr,
x, y,
x - 2, y + dh/2,
x - 2, y + dh)
cairo_line_to(cr, x - 2, y + dh + progress)
cairo_curve_to(cr,
x - 2, y + dh*2 + progress,
x - dw, y + dh*2 + progress,
x - dw, y + dh*2.5 + progress)
cairo_curve_to(cr,
x - dw, y + dh*2.5 + dh*2/3 + progress,
x + dw, y + dh*2.5 + dh*2/3 + progress,
x + dw, y + dh*2.5 + progress)
cairo_curve_to(cr,
x + dw, y + dh*2 + progress,
x + 2, y + dh*2 + progress,
x + 2, y + dh + progress)
cairo_line_to(cr, x + 2, y + dh)
cairo_curve_to(cr,
x + 2, y + dh/2,
x, y,
x + dw*2, y)
cairo_fill(cr)
end -- draw_drop
-------------------------------------------------------------------------------
-- draw_media_bar
function draw_media_bar()
-- get current track
local mpris2_metadata = get_mpris2_metadata()
local artist = mpris2_metadata["xesam:artist"]
local title = mpris2_metadata["xesam:title"]
if artist and title then
local text = artist .. ": " .. title
cairo_select_font_face(cr, default_font.family, default_font.slant,
default_font.weight)
cairo_set_font_size(cr, default_font.size)
cairo_text_extents(cr, text, extents)
-- draw sidebar
local horizontal_padding = 14
local vertical_padding = 2
local bar_width = extents.width + extents.x_bearing*2 + icon_size
+ horizontal_padding*3
local bar_height = top_panel_height + vertical_padding*2
local bar_y = conky_window.height*media_bar_vertical_alignment
- bar_height/2
draw_sidebar(bar_y, bar_width, bar_height)
-- draw text
cairo_set_source_rgba(cr, unpack(colors.normal))
cairo_move_to(cr, conky_window.width - extents.width
- extents.x_bearing*2 - horizontal_padding,
bar_y + bar_height/2 - extents.y_bearing/2)
cairo_show_text(cr, text)
-- draw icon
local image = cairo_image_surface_create_from_png(icons.media)
cairo_set_source_surface(cr, image,
conky_window.width - bar_width + horizontal_padding,
bar_y + bar_height/2 - icon_size/2)
cairo_paint(cr)
cairo_surface_destroy(image)
end -- if
end -- draw_media_bar
-------------------------------------------------------------------------------
-- get_mpris2_metadata
function get_mpris2_metadata()
local command = 'qdbus $(qdbus org.mpris.MediaPlayer2.* | head -1) ' ..
'/org/mpris/MediaPlayer2 ' ..
'org.freedesktop.DBus.Properties.Get ' ..
'org.mpris.MediaPlayer2.Player Metadata 2> /dev/null'
local mpris2_metadata = {}
local file = io.popen(command)
for line in file:lines() do
local key, value = unpack(explode(": ", line, 2))
mpris2_metadata[key] = value
end -- for
file:close()
return mpris2_metadata
end -- get_mpris2_metadata
-------------------------------------------------------------------------------
-- draw_sidebar
function draw_sidebar(y, width, height)
local radius = 7
cairo_move_to(cr, conky_window.width, y)
cairo_line_to(cr, conky_window.width - width + radius, y)
cairo_arc_negative(cr, conky_window.width - width + radius,
y + radius, radius, 1.5*M_PI, 1*M_PI)
cairo_arc_negative(cr, conky_window.width - width + radius,
y + height - radius, radius, 1*M_PI, 0.5*M_PI)
cairo_line_to(cr, conky_window.width, y + height)
local copied_path=cairo_copy_path(cr)
cairo_set_source_rgba(cr, unpack(colors.background))
cairo_fill(cr)
-- outline
cairo_set_source_rgba(cr, unpack(colors.outline))
cairo_set_line_width(cr, 1)
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_stroke(cr)
cairo_path_destroy(copied_path)
end -- draw_sidebar
-------------------------------------------------------------------------------
-- draw_cpu_water
function draw_cpu_water()
local y = conky_window.height - water_minimum_height
local segment_width = conky_window.width/(#cpu_table - 1)
update_cpu_table()
-- draw boat
local boat_x = segment_width + segment_width/2
local boat_y = (y - cpu_table[2]*2 + y - cpu_table[3]*2)/2
- 30 + math.random(0, 1)
local angle = math.atan2(cpu_table[2]*2 - cpu_table[3]*2, segment_width)
/1.2
cairo_save(cr)
cairo_translate(cr, boat_x, boat_y)
cairo_rotate(cr, angle)
cairo_translate(cr,
-boat_x - cairo_image_surface_get_width(boat_image_surface)/2,
-boat_y - cairo_image_surface_get_height(boat_image_surface)/2)
cairo_set_source_surface(cr, boat_image_surface, boat_x, boat_y)
cairo_paint(cr)
cairo_restore(cr)
-- draw water
cairo_move_to(cr, 0, y - cpu_table[1]*2)
for i = 1, #cpu_table do
cairo_line_to(cr, (i - 1)*segment_width, y - cpu_table[i]*2)
end -- for
local copied_path = cairo_copy_path(cr)
cairo_set_source_rgba(cr, unpack(colors.water))
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_line_to(cr, conky_window.width, conky_window.height)
cairo_line_to(cr, 0, conky_window.height)
cairo_close_path(cr)
cairo_fill(cr)
cairo_set_source_rgba(cr, unpack(colors.water_surface))
cairo_set_line_width(cr, 4)
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_stroke(cr)
cairo_path_destroy(copied_path)
end -- draw_cpu_water
-------------------------------------------------------------------------------
-- update_cpu_table
function update_cpu_table()
local cpu = tonumber(conky_parse('${cpu}')) or 0
table.remove(cpu_table, 1)
table.insert(cpu_table, cpu)
end -- update_cpu_table
-------------------------------------------------------------------------------
-- predraw_boat
function predraw_boat()
local angle = 25
local radian = 40
local mast_y = 25
local mast_x = 35
boat_image_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
100, 100)
local cr = cairo_create(boat_image_surface)
-- draw hull
cairo_set_source_rgba(cr, unpack(colors.boat_hull))
cairo_arc(cr, 50, 50, radian, math.rad(angle), math.rad(180.0 - angle))
cairo_close_path(cr)
local copied_path = cairo_copy_path(cr)
cairo_fill(cr)
-- draw hull outline
cairo_set_source_rgba(cr, unpack(colors.boat_outline))
cairo_set_line_width(cr, 2)
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_stroke(cr)
-- draw planking
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_clip(cr)
cairo_set_source_rgba(cr, unpack(colors.boat_planking))
cairo_set_line_width(cr, 4)
cairo_move_to(cr, 0, 51)
for i = 1, 10 do
cairo_rel_line_to(cr, 100, 0)
cairo_rel_move_to(cr, -100, 5)
end
cairo_stroke(cr)
cairo_reset_clip(cr)
cairo_path_destroy(copied_path)
-- draw flag background
cairo_set_source_rgba(cr, unpack(colors.boat_flag_bg))
cairo_move_to(cr, mast_x, mast_y)
cairo_rel_line_to(cr, 26, 0)
cairo_rel_line_to(cr, 0, 16)
cairo_rel_line_to(cr, -26, 0)
local copied_path = cairo_copy_path(cr)
cairo_fill(cr)
-- draw jolly roger
cairo_set_source_rgba(cr, unpack(colors.boat_flag_fg))
cairo_arc(cr, mast_x + 1 + 25/2, mast_y + 5, 3, 0, 2*M_PI)
cairo_fill(cr)
cairo_set_source_rgba(cr, unpack(colors.boat_flag_bg))
cairo_arc(cr, mast_x + 1 + 25/2 - 1, mast_y + 5 - 1, 1, 0, 2*M_PI)
cairo_fill(cr)
cairo_arc(cr, mast_x + 1 + 25/2 + 1, mast_y + 5 - 1, 1, 0, 2*M_PI)
cairo_fill(cr)
cairo_set_source_rgba(cr, unpack(colors.boat_flag_fg))
cairo_set_line_width(cr, 1)
cairo_move_to(cr, mast_x + 1 + 5, mast_y + 8)
cairo_rel_line_to(cr, 15, 5)
cairo_move_to(cr, mast_x + 1 + 5, mast_y + 8 + 5)
cairo_rel_line_to(cr, 15, -5)
cairo_stroke(cr)
cairo_arc(cr, mast_x + 1 + 5 + 1, mast_y + 8, 1.5, 0, 2*M_PI)
cairo_fill(cr)
cairo_arc(cr, mast_x + 1 + 5 + 1, mast_y + 8 + 5, 1.5, 0, 2*M_PI)
cairo_fill(cr)
cairo_arc(cr, mast_x + 1 + 5 - 1 + 15, mast_y + 8, 1.5, 0, 2*M_PI)
cairo_fill(cr)
cairo_arc(cr, mast_x + 1 + 5 - 1 + 15, mast_y + 8 + 5, 1.5, 0, 2*M_PI)
cairo_fill(cr)
-- draw flag outline
cairo_set_source_rgba(cr, unpack(colors.outline))
cairo_set_line_width(cr, 0.5)
cairo_new_path(cr)
cairo_append_path(cr, copied_path)
cairo_stroke(cr)
cairo_path_destroy(copied_path)
-- draw mast
cairo_set_line_width(cr, 3)
cairo_set_source_rgba(cr, unpack(colors.boat_outline))
cairo_move_to(cr, mast_x, 50 + radian*math.sin(math.rad(angle)))
cairo_line_to(cr, mast_x, mast_y)
cairo_stroke(cr)
cairo_destroy(cr)
end -- predraw_boat
-------------------------------------------------------------------------------
-- convert_icons
function convert_icons()
for key, value in pairs(icons) do
if string.sub(value, -4) == ".svg" then
local tmpfile = os.tmpname()
local command = "rsvg-convert -w " .. icon_size .. " -h "
.. icon_size .. " -f png -o " .. tmpfile .. " " .. icons[key]
io.popen(command)
icons[key] = tmpfile
end -- if
end -- for
end -- convert_icons
-------------------------------------------------------------------------------
-- explode
function explode(delimiter, str, limit)
if (delimiter == '') then return false end
local i, pos, arr = 0, 0, {}
for s, e in function() return string.find(str, delimiter, pos, true) end do
table.insert(arr, string.sub(str, pos, s - 1))
pos = e + 1
if limit and limit > 1 then
i = i + 1
if i >= limit - 1 then break end
end -- if
end -- for
table.insert(arr, string.sub(str, pos))
return arr
end -- explode
Offline
Dave6 wrote:Getting wound up now!!!
Does anyone have a simple plain text weather config?
I just want the current conditions and temperature for a number of locations.
Any ideas?
Yes ... the native conky ${weather} command:
http://s20.postimg.org/6eh9ppzih/2014_07_05_19_01_14_1920x1080_Sector11.jpg...code...
Check it out here search for weather
Thanks S11, the native weather doesn't work for me as I'm in the UK.
I did find this one though...
https://bbs.archlinux.org/viewtopic.php?id=109812
...but the degree symbol is messed up, and i prefer Celsius to Fahrenheit.
ETA - I'm also trying to avoid lui, for simplicities sake.
Last edited by Dave6 (2014-07-06 17:30:53)
Offline
Thanks S11, the native weather doesn't work for me as I'm in the UK.
I think it was HAL that said:
I'm sorry Dave. I can't let you do that.
If you want native weather go see the local
As I said: the built in conky ${weather} command - it works world wide!
In the conky I posted you see these lines commented out above TEXT:
## Airport Codes
## http://www.airlinecodes.co.uk/aptcodesearch.asp
A nice UK site. Then at the conky site where I told you to search for 'weather' (bold italics are mine):
'locID' must be a valid location identifier for the required uri. For the NOAA site this must be a valid ICAO (see for instance https://pilotweb.nas.faa.gov/qryhtml/icao/). For the weather.com site this must be a valid location ID (see for instance http://aspnetresources.com/tools/locid.aspx).
New conky:
# conky -c /media/5/conky/test.conky &
# pkill -xf "conky -c /media/5/conky/test.conky" &
# OS: ${pre_exec lsb_release -sd}
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title A blank test
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 255
minimum_size 300 0 # w|h
maximum_width 300
gap_x 0 # l|r
gap_y 10 # u|d
alignment tl
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont monofur:bold:size=12
#xftfont ubuntu condensed:size=7
#xftfont Anonymous Pro:bold:size=9
#xftfont Anonymous Pro:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0
#font monofur:size=9
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
draw_shades no ##yes
default_shade_color 000000
draw_outline no
default_outline_color 000000
default_color DCDCDC #220 220 220 Gainsboro
#default_color C0C0C0 #192 192 192 Silver
#default_color B0E0E6 #176 224 230 PowderBlue
#default_color D8BFD8 #216 191 216 Thistle
color0 8FBC8F #DarkSeaGreen
#color1 C0C0C0 # Silver
#color1 D3D3D3 #LightGrey
color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
#color3 87CEFA #E0FFFF #LightCyan
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
#color7 5F9EA0 #CadetBlue
#color8 FFFFE0 #LightYellow
color8 FFD700 #Gold
#color8 F0E68C #Khaki
color9 FFA07A #LightSalmon
#color9 CD5C5C #IndianRed
#color9 FF0000 #Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 05
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 6144
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable th0e image cache.
imlib_cache_size 0
#default_bar_size 0 10
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0xffffff 0.05
#lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.5
#lua_draw_hook_post draw_bg 10 0 0 0 0 0xffffff 0.5
#lua_draw_hook_post draw_bg 10 0 0 0 0 0x000000 0.5
#
# TEXT
#
#
############### V9000 ########################################################
#starts the lua weather data gathering function, call once at top of conkyrc
#lua_load ~/v9000/v9000.lua
#lua_draw_hook_post weather
#lua_load /media/5/Conky/templates/cF-2013.template.lua
#lua_load /media/5/Conky/LUA/4clocks.lua
#lua_draw_hook_pre main
####################################################### End LUA Settings ###
#lua_load /media/5/Conky/LUA/syspro_a_of_n.lua
#lua_load /media/5/Conky/LUA/syspro_AofN.lua
#lua_draw_hook_pre system_profile
#lua_load /media/5/Conky/LUA/mounted.lua
##OS: ${pre_exec lsb_release -sd}
##OS: ${pre_exec lsb_release -si} ${pre_exec lsb_release -sr} ${pre_exec lsb_release -sc}
update_interval 1
default_bar_size 0 12
## Airport Codes
## http://www.airlinecodes.co.uk/aptcodesearch.asp
## For the NOAA site this must be a valid ICAO
TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.5}\
${time %T}${alignr}${time %x}
${alignc}UTC ${tztime UTC %H:%M:%S}
${alignc}${uptime}
${alignc}${if_match ${desktop}==1}${color6}${endif}•${color} ${if_match ${desktop}==2}${color6}${endif}•${color} ${if_match ${desktop}==3}${color6}${endif}•${color} ${if_match ${desktop}==4}${color6}${endif}•${color} ${if_match ${desktop}==5}${color6}${endif}•${color}
${alignc}CPU μm ${color5}${freq_g}${color}
${alignc}Avg ${if_match ${cpu cpu0}<10}${color1}00${color5}${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}${color1}0${color5}${cpu cpu0}\
${else}${color9}${cpu cpu0}${endif}${endif}${color5} %${color}
${alignc} ${color5}1${color} | ${color5}2${color} | ${color5}3 ${color}
${alignc}${if_match ${cpu cpu1}<10}${color1}00${color5}${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}${color1}0${color5}${cpu cpu1}\
${else}${color9}${cpu cpu1}${endif}${endif}${color}\
| ${if_match ${cpu cpu2}<10}${color1}00${color5}${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}${color1}0${color5}${cpu cpu2}\
${else}${color9}${cpu cpu2}${endif}${endif}${color}\
| ${if_match ${cpu cpu3}<10}${color1}00${color5}${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}${color1}0${color5}${cpu cpu3}\
${else}${color9}${cpu cpu3}${endif}${endif}${color}
${voffset -25}CPU ${color5}${platform f71882fg.2560 temp 1}${color}°\
${alignr}MB ${color5}${platform f71882fg.2560 temp 2}${color}°
GPU ${color5}${nvidia temp}${color}°\
${alignr}HD ${color5}${hddtemp /dev/sda}${color}°
${alignc}Fan ${color5}${platform f71882fg.2560 fan 1} ${color}RPM
${alignc}NVIDIA Freq MHz
${alignc}GPU ${color5}${nvidia gpufreq} ${color} MEM ${color5}${nvidia memfreq}${color}
London, England
${color6}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC cloud_cover}${color}
Temp: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC temperature}°\
${goto 100}Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC pressure}\
${goto 200}Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC humidity}%
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGLC wind_speed} km/h
Oxford, England
${color6}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK cloud_cover}${color}
Temp: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK temperature}°\
${goto 100}Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK pressure}\
${goto 200}Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK humidity}%
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGTK wind_speed} km/h
Glasgow, Scotland
${color6}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK cloud_cover}${color}
Temp: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK temperature}°\
${goto 100}Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK pressure}\
${goto 200}Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK humidity}%
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ EGPK wind_speed} km/h
Shanghai, China
${color6}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS cloud_cover}${color}
Temp: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS temperature}°\
${goto 100}Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS pressure}\
${goto 200}Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS humidity}%
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZSSS wind_speed} km/h
Buenos Aires, Argentina
${color6}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE cloud_cover}${color}
Temp: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE temperature}°\
${goto 100}Bar: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE pressure}\
${goto 200}Hum: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE humidity}%
Wind: ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir} (${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_dir_DEG}°) @ ${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ SABE wind_speed} km/h
Have fun!
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat