<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-456388347137284126</id><updated>2011-09-26T06:24:26.274-07:00</updated><category term='flower.lua'/><category term='conkyrc_flower'/><title type='text'>The Peachy Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>43</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7479957178251219680</id><published>2011-07-08T13:48:00.000-07:00</published><updated>2011-07-08T13:58:35.382-07:00</updated><title type='text'></title><content type='html'>Weather in conky&lt;br /&gt;&lt;br /&gt;Although conkyForecast is an excellent script, (and should be the first step for anyone who wants weather in their conky) when I recently reformatted and lost all my conkyForecast files I wasn't too keen on going through the weather.com registration again.&lt;br /&gt;&lt;br /&gt;So I've been looking at alternate ways of getting weather, particularly getting pretty icons.  One was is here&lt;br /&gt;&lt;a href="http://crunchbanglinux.org/forums/post/104686/#p104686"&gt;http://crunchbanglinux.org/forums/post/104686/#p104686&lt;/a&gt;&lt;br /&gt;look a few posts down for the code, although seeing as it is specific to my local weather station for the weather and the images, it probably wont work for you.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-49TOFIv7YAs/ThduHUKq9lI/AAAAAAAAAN4/11RvwVYVzHw/s1600/Screenshot-42.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/-49TOFIv7YAs/ThduHUKq9lI/AAAAAAAAAN4/11RvwVYVzHw/s320/Screenshot-42.png" alt="" id="BLOGGER_PHOTO_ID_5627087331374331474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;also out of this i had a way of drawing rounded corner boxes which I have further developed in various background scripts.&lt;br /&gt;&lt;br /&gt;With the weather there is also time and date and system info.  Everything is generated in a Lua script.  Not only do I find it easier, I find it is lighter on resources than running code from the conkyrc.&lt;br /&gt;&lt;br /&gt;An example of that is here&lt;br /&gt;&lt;br /&gt;&lt;a href="http://crunchbanglinux.org/forums/post/115451/#p115451"&gt;http://crunchbanglinux.org/forums/post/115451/#p115451&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7479957178251219680?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7479957178251219680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/weather-in-conky-although-conkyforecast.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7479957178251219680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7479957178251219680'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/weather-in-conky-although-conkyforecast.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-49TOFIv7YAs/ThduHUKq9lI/AAAAAAAAAN4/11RvwVYVzHw/s72-c/Screenshot-42.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1951219186648870325</id><published>2011-07-08T13:38:00.000-07:00</published><updated>2011-07-08T13:59:03.271-07:00</updated><title type='text'></title><content type='html'>Conky system monitor&lt;br /&gt;&lt;br /&gt;I wanted to get as much information about my system onto the screen using lua and conky.  This is what I came up with&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Q-f01VjoXKc/Thdr4aEJthI/AAAAAAAAANo/t1Vxb6w-XDw/s1600/Screenshot-33.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/-Q-f01VjoXKc/Thdr4aEJthI/AAAAAAAAANo/t1Vxb6w-XDw/s320/Screenshot-33.png" alt="" id="BLOGGER_PHOTO_ID_5627084876236305938" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-0bpAofpEDfk/ThdsRaselaI/AAAAAAAAANw/tUBuVFPNBf8/s1600/Screenshot-32.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/-0bpAofpEDfk/ThdsRaselaI/AAAAAAAAANw/tUBuVFPNBf8/s320/Screenshot-32.png" alt="" id="BLOGGER_PHOTO_ID_5627085305902175650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;from this post&lt;br /&gt;&lt;a href="http://crunchbanglinux.org/forums/post/102809/#p102809"&gt;http://crunchbanglinux.org/forums/post/102809/#p102809&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These setups are pretty complex and require some other things to be running such as vnstat.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1951219186648870325?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1951219186648870325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/conky-system-monitor-i-wanted-to-get-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1951219186648870325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1951219186648870325'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/conky-system-monitor-i-wanted-to-get-as.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Q-f01VjoXKc/Thdr4aEJthI/AAAAAAAAANo/t1Vxb6w-XDw/s72-c/Screenshot-33.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1003260720241575627</id><published>2011-07-08T13:20:00.000-07:00</published><updated>2011-07-08T13:59:29.191-07:00</updated><title type='text'></title><content type='html'>NEW UPADTES! amazing!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-uDGM91IvjoA/ThdosnaZS7I/AAAAAAAAANY/5TyJzzfBgwY/s1600/Screenshot-90.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 198px;" src="http://1.bp.blogspot.com/-uDGM91IvjoA/ThdosnaZS7I/AAAAAAAAANY/5TyJzzfBgwY/s320/Screenshot-90.png" alt="" id="BLOGGER_PHOTO_ID_5627081375125949362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lua calendar&lt;br /&gt;&lt;br /&gt;I think this is the most up to date code for the lua calendar&lt;br /&gt;&lt;a href="http://crunchbanglinux.org/forums/post/110725/#p110725"&gt;http://crunchbanglinux.org/forums/post/110725/#p110725&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The standard way to get calendars in conky is by cal followed by some complicated regex to make the current day show up in a different color.  Other than that you don't have much control over the layout and you have to use a mono font otherwise everything is out of line.&lt;br /&gt;&lt;br /&gt;This calendar can use any font you like and still keep aligned.  You can also control many other aspects of the calendar layout.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1003260720241575627?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1003260720241575627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/new-upadtes-amazing-lua-calendar-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1003260720241575627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1003260720241575627'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2011/07/new-upadtes-amazing-lua-calendar-i.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-uDGM91IvjoA/ThdosnaZS7I/AAAAAAAAANY/5TyJzzfBgwY/s72-c/Screenshot-90.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7239380748752183741</id><published>2010-12-26T22:18:00.001-08:00</published><updated>2011-01-04T22:16:46.217-08:00</updated><title type='text'></title><content type='html'>Mayan calendar&lt;br /&gt;&lt;br /&gt;UPDATE&lt;br /&gt;I made the calendar much more readable by adding text labels around the rings like so:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/TSQMaZKCqCI/AAAAAAAAANI/X86V76AozYY/s1600/Screenshot-21.png"&gt;&lt;img style="cursor: pointer; width: 374px; height: 349px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/TSQMaZKCqCI/AAAAAAAAANI/X86V76AozYY/s400/Screenshot-21.png" alt="" id="BLOGGER_PHOTO_ID_5558581487651170338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've just been cleaning up the code and found a couple of errors that have been corrected.  You can find the code for the above &lt;a href="http://ubuntuforums.org/showpost.php?p=10318534&amp;amp;postcount=15722"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;--Original post below-----------------------&lt;br /&gt;&lt;br /&gt;I have been thinking about setting up a "year clock" using multiple rings showing progress in the year, month, day, hour, and minute.  I had come up with some designs like so:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/TRgwDPX9XTI/AAAAAAAAAMY/6BqVBhQIOY8/s1600/clock.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 235px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/TRgwDPX9XTI/AAAAAAAAAMY/6BqVBhQIOY8/s400/clock.png" alt="" id="BLOGGER_PHOTO_ID_5555242972586270002" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In this case the largest circle is the year and the dot on the circle is where we are in the year.  The next largest circle is the month and the dot where we are in the month and so on.  I had set it up so that everything moved in increments of 1 second.  The right side shows what the set up would look like on midnight of December 31st.  The nice thing about this clock is that it will never look the same twice in a year.  However, it isn't exactly easy to read :)&lt;br /&gt;&lt;br /&gt;Next I tried this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/TRgwvP3NdtI/AAAAAAAAAMg/Am38EAgBIJA/s1600/Screenshot-2.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 386px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/TRgwvP3NdtI/AAAAAAAAAMg/Am38EAgBIJA/s400/Screenshot-2.png" alt="" id="BLOGGER_PHOTO_ID_5555243728631592658" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Which uses similar mechanics as the clock above, but as you can see the rings are marked with information.  Each circle rotated so that the current date/time was at the top of the ring.   Unfortunately this clock proved to be extremely cpu intensive (it was actually pushing my cpu to 100%).  I reoriented the circles to this:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgwvZ_fR9I/AAAAAAAAAMo/3o2JK6LFvpI/s1600/Screenshot-3.png"&gt;&lt;img style="cursor: pointer; width: 380px; height: 400px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgwvZ_fR9I/AAAAAAAAAMo/3o2JK6LFvpI/s400/Screenshot-3.png" alt="" id="BLOGGER_PHOTO_ID_5555243731350669266" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;But there was no was this script was going to be viable.  But I liked the look of the above, with the rings within rings.&lt;br /&gt;&lt;br /&gt;Then later I had the idea to try something else and this is what I came up with:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgxtiRaBpI/AAAAAAAAAMw/-Dnr7t-o-z4/s1600/Screenshot-11.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 250px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgxtiRaBpI/AAAAAAAAAMw/-Dnr7t-o-z4/s400/Screenshot-11.png" alt="" id="BLOGGER_PHOTO_ID_5555244798725195410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is when things started looking very Mayan :)&lt;br /&gt;In the above calendar clock, year is the innermost circle and instead of having the circles move I had indicators move around the circles.  I also went on to add some system info indicators like so:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/TRgyflyAKfI/AAAAAAAAAM4/b8KeR3uuPvY/s1600/Screenshot-12.png"&gt;&lt;img style="cursor: pointer; width: 347px; height: 400px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/TRgyflyAKfI/AAAAAAAAAM4/b8KeR3uuPvY/s400/Screenshot-12.png" alt="" id="BLOGGER_PHOTO_ID_5555245658660678130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code for the above is &lt;a href="http://crunchbanglinux.org/forums/post/97622/#p97622"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Sector11 has also made some cool looking additions to the calendar part.  You can see that &lt;a href="http://dl.dropbox.com/u/16070765/full_Mayan_Clock.png"&gt;here&lt;/a&gt;.  I have a nice Mayan symbol dingbat font that may well be used in conjunction with my circlewriting script to add some glyphs to the calendar also.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7239380748752183741?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7239380748752183741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/mayan-calendar-i-have-been-thinking.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7239380748752183741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7239380748752183741'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/mayan-calendar-i-have-been-thinking.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/TSQMaZKCqCI/AAAAAAAAANI/X86V76AozYY/s72-c/Screenshot-21.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-5262437864958943697</id><published>2010-12-26T22:11:00.000-08:00</published><updated>2010-12-26T22:17:48.135-08:00</updated><title type='text'></title><content type='html'>I posted a perspective bar set up some time ago, and thought I would revisit a 3D approach.  This is what I ended up with.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TRguV7M5cXI/AAAAAAAAAMQ/_gh6sK9m3Hk/s1600/Screenshot-9.png"&gt;&lt;img style="cursor: pointer; width: 230px; height: 302px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TRguV7M5cXI/AAAAAAAAAMQ/_gh6sK9m3Hk/s400/Screenshot-9.png" alt="" id="BLOGGER_PHOTO_ID_5555241094565425522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The bar rises and falls in relation to whatever conky output you feed it.  The script can be found &lt;a href="http://crunchbanglinux.org/forums/post/96230/#p96230"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It took a crash refresher course in basic trigonometry to get everything working and I can't guarantee that if you try the script it will work.  The bar looks as I wanted it to, but I was hoping to be able to define simple coordinates and have multiple bars generated that all fitted together.&lt;br /&gt;&lt;br /&gt;This didn't work out in this script as I the math I was using wasn't calculating the right perspectives for subsequent bars.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-5262437864958943697?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/5262437864958943697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/i-posted-perspective-bar-set-up-some.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5262437864958943697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5262437864958943697'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/i-posted-perspective-bar-set-up-some.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/TRguV7M5cXI/AAAAAAAAAMQ/_gh6sK9m3Hk/s72-c/Screenshot-9.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-6266018947122200892</id><published>2010-12-26T22:02:00.000-08:00</published><updated>2010-12-26T22:11:11.882-08:00</updated><title type='text'></title><content type='html'>Updates, I have a couple of things that I've been working on recently.&lt;br /&gt;&lt;br /&gt;First there is a amalgamated circle generating and circlewriting lua script.&lt;br /&gt;It can do things like this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgsigcq35I/AAAAAAAAAMA/9V5U7J6ggGA/s1600/Screenshot-6.png"&gt;&lt;img style="cursor: pointer; width: 393px; height: 366px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TRgsigcq35I/AAAAAAAAAMA/9V5U7J6ggGA/s400/Screenshot-6.png" alt="" id="BLOGGER_PHOTO_ID_5555239111698866066" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And this is a little more complicated (obviously you can get whatever colors you want for rings and text I was just feeling monochrome when I made these.)&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_bEV68MpI_n4/TRgsiuHUckI/AAAAAAAAAMI/lcjYB9T_xb8/s1600/Screenshot-8.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 188px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/TRgsiuHUckI/AAAAAAAAAMI/lcjYB9T_xb8/s400/Screenshot-8.png" alt="" id="BLOGGER_PHOTO_ID_5555239115367412290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The intertwining effect is made by making different bits of the circle at different points in the lua script.  In lua the later instances of cairo graphics are drawn above any earlier instances.&lt;br /&gt;&lt;br /&gt;The script can be found &lt;a href="http://crunchbanglinux.org/forums/post/95845/#p95845"&gt;here&lt;/a&gt; on the crunchbang Linux forum (where you can see a more colorful use of the script.  It can also generate bars that can be placed and rotated freely.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-6266018947122200892?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/6266018947122200892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/updates-i-have-couple-of-things-that.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6266018947122200892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6266018947122200892'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/12/updates-i-have-couple-of-things-that.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/TRgsigcq35I/AAAAAAAAAMA/9V5U7J6ggGA/s72-c/Screenshot-6.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7056557656388737800</id><published>2010-10-14T22:12:00.000-07:00</published><updated>2010-10-15T10:34:05.762-07:00</updated><title type='text'>Splitting text into individual letters</title><content type='html'>One Lua trick that I use a lot is taking a string and splitting it up into individual characters which then get stored in a table.&lt;br /&gt;&lt;br /&gt;I used this approach for my circle writing function and many other functions.  This is how it's done.&lt;br /&gt;&lt;br /&gt;You need the following function in the Lua script above the main function.  I did not write this function and I cant remember exactly where I got it from but whoever did write it has my thanks!&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;function string:split(delimiter)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;local result = { }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;local from  = 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;local delim_from, delim_to = string.find( self, delimiter, from  )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;while delim_from do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;table.insert( result, string.sub( self, from , delim_from-1 ) )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;from  = delim_to + 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;delim_from, delim_to = string.find( self, delimiter, from  )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;table.insert( result, string.sub( self, from  ) )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;return result&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;These are the lines that split up the text...&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;text="text"&lt;/span&gt;&lt;br /&gt;print (text) --&gt; text&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;sub=string.gsub(text, ".", "%1|")&lt;/span&gt;&lt;br /&gt;-- the above inserts "|" after every character&lt;br /&gt;print (sub) --&gt; t|e|x|t|&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;split=string.split(sub, "|")&lt;/span&gt;&lt;br /&gt;-- the above splits the string whenever a "|" occurs and also deletes the "|"&lt;br /&gt;the resulting split up characters are stored in a table called split in this case&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 204, 204);"&gt;slen=string.len(text)&lt;/span&gt;&lt;br /&gt;-- slen is the length of the original text,&lt;br /&gt;so will be the number of entries in that table "split"&lt;br /&gt;&lt;br /&gt;so that:&lt;br /&gt;split[1] = "t"&lt;br /&gt;split[2] = "e"&lt;br /&gt;split[3] = "x"&lt;br /&gt;split[4] = "t"&lt;br /&gt;&lt;br /&gt;now I can deal with each character individually.&lt;br /&gt;I could give each character a different font, or a different color&lt;br /&gt;or, in the case of my square font conky below, convert each character to the square font.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7056557656388737800?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7056557656388737800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/splitting-text-into-individual-letters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7056557656388737800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7056557656388737800'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/splitting-text-into-individual-letters.html' title='Splitting text into individual letters'/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-8649319728342625632</id><published>2010-10-14T21:56:00.001-07:00</published><updated>2010-10-14T22:11:13.936-07:00</updated><title type='text'>Square text conky</title><content type='html'>I had an idea for a conky.  I wanted it to be extremely compact and involve text in different orientations.  This is what I ended up with!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/TLfe_VXSU4I/AAAAAAAAAL0/Y_p90tsDtPk/s1600/2010-10-08--1286571330_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 267px; height: 176px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/TLfe_VXSU4I/AAAAAAAAAL0/Y_p90tsDtPk/s400/2010-10-08--1286571330_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5528132247268512642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The problem was that I spent a long time looking for a square font.  I found several fonts that I liked but when I came to rotate them and put rotated letters next to regularly orientated letters I found that none of the fonts were actually square.  Non were the same width as height.&lt;br /&gt;&lt;br /&gt;So I decided to make my own font using the Lua script.  I had done something similar in my ascii text lua; a function that read each letter of the text I wanted displayed and converted the letter into ascii.&lt;br /&gt;&lt;br /&gt;In this case I created my own square font out of the webdings font.  With webdings a "g" gave me a solid color square, while "c" gave me a black square with a color outline.  I simply constructed my letters using those blocks like so:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;if letter=="T" then&lt;br /&gt;font="webdings"&lt;br /&gt;acrosst=across&lt;br /&gt;downt=down&lt;br /&gt;rotate=rotate*math.pi/180&lt;br /&gt;cairo_translate (cr, acrosst, downt)&lt;br /&gt;cairo_rotate (cr, rotate)&lt;br /&gt;cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);&lt;br /&gt;cairo_set_font_size (cr, fontsize);&lt;br /&gt;cairo_set_source_rgba (cr, red, green, blue, alpha);&lt;br /&gt;cairo_move_to (cr, 0, 0);&lt;br /&gt;cairo_show_text (cr, "ggggg")&lt;br /&gt;ldown=fontsize&lt;br /&gt;cairo_move_to (cr, 0, ldown);&lt;br /&gt;cairo_show_text (cr, "ccgcc")&lt;br /&gt;ldown=fontsize+ldown&lt;br /&gt;cairo_move_to (cr, 0, ldown);&lt;br /&gt;cairo_show_text (cr, "ccgcc")&lt;br /&gt;ldown=fontsize+ldown&lt;br /&gt;cairo_move_to (cr, 0, ldown);&lt;br /&gt;cairo_show_text (cr, "ccgcc")&lt;br /&gt;ldown=fontsize+ldown&lt;br /&gt;cairo_move_to (cr, 0, ldown);&lt;br /&gt;cairo_show_text (cr, "ccgcc")&lt;br /&gt;cairo_rotate (cr, -1*rotate)&lt;br /&gt;cairo_translate (cr, -1*acrosst, -1*downt)&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt; I actually really like the look of the resulting square "font".  And everything fitted nicely together with no gaps :)&lt;br /&gt;&lt;br /&gt;Go &lt;a href="http://crunchbanglinux.org/forums/post/88638/#p88638"&gt;here&lt;/a&gt; to take a look at the code via the link.  This is another really long script, mainly because of the letter conversion function.  Originally I set up the function converting lowercase letters into upper case letters of the square font.  But I didn't like the way they looked, so I re-wrote the letter conversion function to include converting uppercase letters to a different version of the square font.&lt;br /&gt;&lt;br /&gt;I just used the lua command string.upper to make everything uppercase and fed it to the conversion function.  I never bothered to delete the lowercase conversion lines :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-8649319728342625632?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/8649319728342625632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/square-text-conky.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8649319728342625632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8649319728342625632'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/square-text-conky.html' title='Square text conky'/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/TLfe_VXSU4I/AAAAAAAAAL0/Y_p90tsDtPk/s72-c/2010-10-08--1286571330_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-6917633075583652592</id><published>2010-10-14T21:26:00.000-07:00</published><updated>2010-10-16T12:43:28.786-07:00</updated><title type='text'>Final Fantsy VII</title><content type='html'>I am a big final fantasy 7 fan, so when rabidofx posted a FF7 themed&lt;a href="http://crunchbanglinux.org/forums/post/87286/#p87286"&gt; conky&lt;/a&gt;, I immediately thought of the potential to turn the FF7 bottom combat panel into a conky display.&lt;br /&gt;&lt;br /&gt;And this is what I eventually came up with!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/TLfZSpGGBpI/AAAAAAAAALo/7_BCfoah_NE/s1600/2010-10-02--1286068505_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 76px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/TLfZSpGGBpI/AAAAAAAAALo/7_BCfoah_NE/s400/2010-10-02--1286068505_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5528125981912860306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have tried to be as faithful as I can to the FF7 panel while still allowing the conky to function as a source of information.&lt;br /&gt;&lt;br /&gt;It still needs some work and the script needs a good cleanup and improvements to make it more user friendly.  You can get the code here at &lt;a href="http://conky-pitstop.wikidot.com/by-mrpeachy-ff-vii"&gt;conky-pitstop&lt;/a&gt;!   Or &lt;a href="http://crunchbanglinux.org/forums/post/87881/#p87881"&gt;here&lt;/a&gt; on the crunchbanglinux forum.  While your on the forum check out rabidfox's post directly above.  He has modified ADcomps Adeskbar to look like materia slots (very nice!).&lt;br /&gt;&lt;br /&gt;So why does it take 2200 lines of lua code to produce my FF7 panel conky?&lt;br /&gt;Well 3 reasons... first because it's just a little messy.  A lot of copying and pasting went on and I'm sure that I could comb through it an eliminate a large number of supurflouous lines :)&lt;br /&gt;&lt;br /&gt;Second drawing in lua with the cairo library takes a lot of lines.  To draw the blue shaded rectangles required this:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;sa=5&lt;br /&gt;sd=5&lt;br /&gt;rh=120&lt;br /&gt;rw=280&lt;br /&gt;red=1&lt;br /&gt;green=1&lt;br /&gt;blue=1&lt;br /&gt;alpha=1&lt;br /&gt;pat = cairo_pattern_create_linear (sa, sd, rh, rw)&lt;br /&gt;cairo_pattern_add_color_stop_rgba (pat, 0, red-1, green-1, blue, alpha)&lt;br /&gt;cairo_pattern_add_color_stop_rgba (pat, 1, red-1, green-1, blue-1, alpha)&lt;br /&gt;cairo_set_source (cr, pat)&lt;br /&gt;cairo_rectangle (cr, sa, sd, rw, rh)&lt;br /&gt;cairo_fill (cr)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;I could have used less lines and specified the positions and colors etc in the actual pattern and drawing lines, but this way is just so much easier for fine tuning.  I set the colors up like this becasue I kept forgetting which number represented what in the cairo_set_pattern lines!  :)&lt;br /&gt;&lt;br /&gt;The grey border around the blue was also line intensive.&lt;br /&gt;&lt;br /&gt;Reason 3, and perhaps the main reason for the length of the script is the way you have to use cairo to display text.  And if you look closely you will see that every piece of text has a black "shadow" ...which is simply the same piece of text, colored black and printed behind and offset a little.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;font="Acknowledge TT (BRK)"&lt;br /&gt;text=topl1&lt;br /&gt;fsize=20&lt;br /&gt;red=0&lt;br /&gt;green=0&lt;br /&gt;blue=0&lt;br /&gt;alpha=1&lt;br /&gt;across=32&lt;br /&gt;down=22&lt;br /&gt;cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);&lt;br /&gt;cairo_set_font_size (cr, fsize);&lt;br /&gt;cairo_set_source_rgba (cr, red, green, blue, alpha);&lt;br /&gt;cairo_move_to (cr, across, down);&lt;br /&gt;cairo_show_text (cr, text)&lt;br /&gt;red=0.8&lt;br /&gt;green=0.8&lt;br /&gt;blue=0.8&lt;br /&gt;alpha=1&lt;br /&gt;across=across-2&lt;br /&gt;down=down-2&lt;br /&gt;cairo_set_source_rgba (cr, red, green, blue, alpha);&lt;br /&gt;cairo_move_to (cr, across, down);&lt;br /&gt;cairo_show_text (cr, text)&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;So I had to set the font, set the font size, set the red, green, blue and alpha, set the position, write the font, fontsize and color setup lines, move cairo to the coordinates and then tell it to diaplay the text.  That gave me the shadow, then I had to change the color and position, set up the text drawing variables and draw the main text.&lt;br /&gt;&lt;br /&gt;I kept this format throughout the script, so i could easily change colors and positions without wading through a sea of setup lines.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-6917633075583652592?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/6917633075583652592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/final-fantsy-vii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6917633075583652592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6917633075583652592'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/10/final-fantsy-vii.html' title='Final Fantsy VII'/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/TLfZSpGGBpI/AAAAAAAAALo/7_BCfoah_NE/s72-c/2010-10-02--1286068505_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1197757527792374009</id><published>2010-09-11T21:23:00.000-07:00</published><updated>2010-09-11T22:12:13.494-07:00</updated><title type='text'></title><content type='html'>Here is my latest conky configuration&lt;br /&gt;&lt;br /&gt;conkybar!&lt;br /&gt;&lt;br /&gt;and this is what it looks like currently:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/TIxWE-y3JxI/AAAAAAAAAK8/cToHfDUsmPY/s1600/2010-09-10--1284171775_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 250px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/TIxWE-y3JxI/AAAAAAAAAK8/cToHfDUsmPY/s400/2010-09-10--1284171775_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5515878287197808402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Nothing out of the ordinary in terms of content over many other conkyrc generated displays.&lt;br /&gt;&lt;br /&gt;But with a few differences.&lt;br /&gt;&lt;br /&gt;The first thing is that every is generated in a lua script.  The second is that those black triangles at the top are clickable buttons.  Here is how this setup functions.&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://blip.tv/play/AYH8hSAA" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="295" width="488"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;A while ago on the crunchbanglinux website a poster by the name of jpope had a wallpaper that had a large power button right in the middle of the screen.  Here is the post:&lt;br /&gt;&lt;a href="http://crunchbanglinux.org/forums/post/45907/#p45907"&gt;http://crunchbanglinux.org/forums/post/45907/#p45907&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;ADcomp had written a python script to place a button on the desktop that would launch a command or script.  The button could be placed anywhere and you could make your own icons for it to use and it could execute any command when you click it.  It was all set up in the script.&lt;br /&gt;&lt;br /&gt;I thought that was pretty cool and I stored it in the back of my mind.&lt;br /&gt;&lt;br /&gt;Then recently I started looking into the file io function of lua, the ability to open files in the lua script, read their contents and store that as strings which could be manipulated in the script.  I had been working on some bash scripts using curl to download information from webpages, then editing the html to pull out specific pieces of information.&lt;br /&gt;&lt;br /&gt;I had been using the conky_parse command in lua to execute the bash scripts via conky, but I was trying to bring some of the operations into the native lua language to make the scripts run a little lighter cpu wise.&lt;br /&gt;&lt;br /&gt;However, once I started playing around with the file io commands I realised that I could affect the whole lua script by having the script "watching" a text file and then editing the file, initially via a terminal command.&lt;br /&gt;&lt;br /&gt;something like this:&lt;br /&gt;$ touch /tmp/setw.txt; echo "1" &gt; /tmp/setw.txt&lt;br /&gt;&lt;br /&gt;the touch command creates the file then the &gt; writes a "1" into the file.&lt;br /&gt;a similar command could then easily ovewrite the "1" with a "2"&lt;br /&gt;&lt;br /&gt;so if i had the Lua script watching that file I could put the output into a string and use the string as a basis for an if statement.&lt;br /&gt;&lt;br /&gt;These are the lines that watch the text files in the lua script&lt;br /&gt;&lt;br /&gt;wread = io.open("/home/mcdowall/conkyset/wset.txt", "r")&lt;br /&gt;wset = wread:read("*lines")&lt;br /&gt;&lt;br /&gt;I've changed the names and moved the files out of /tmp so they are persistant.&lt;br /&gt;&lt;br /&gt;So now a simple:&lt;br /&gt;&lt;br /&gt;if wset=="1" then&lt;br /&gt;--display one thing--&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;if wset=="2" then&lt;br /&gt;--display something else--&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;gives me interactive control over the script.&lt;br /&gt;&lt;br /&gt;I then remembered the button script I had seen, and after some searching (and asking) I had the link to the script.&lt;br /&gt;&lt;br /&gt;take a look at this entry on the ubuntu conky thread for more infomation on how the interaction works.&lt;br /&gt;&lt;a href="http://ubuntuforums.org/showpost.php?p=9826304&amp;amp;postcount=13840"&gt;http://ubuntuforums.org/showpost.php?p=9826304&amp;amp;postcount=13840&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The actual lua script can be found here.  It is still very much a work in progress.&lt;br /&gt;&lt;a href="http://ubuntuforums.org/showpost.php?p=9830734&amp;amp;postcount=13855"&gt;http://ubuntuforums.org/showpost.php?p=9830734&amp;amp;postcount=13855&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The fact that everything has to be constructed in lua was itself a challenge.  Lua doesn't have all the goodies pre-programmed into it like the objects you can get in a conkyrc by putting in the right command&lt;br /&gt;&lt;br /&gt;The calendars were tricky.  I saw londonali1010's post on lua calendars here&lt;br /&gt;&lt;a href="http://mylittledesktop.blogspot.com/2009/10/argh-my-first-snag-with-my-lovely.html"&gt;http://mylittledesktop.blogspot.com/2009/10/argh-my-first-snag-with-my-lovely.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I looked over her code and borrowed a couple of lines (for calculating start day), but went about contructing the calendar in a very different way.  The result was a calendar that looked very similar to the one available through a conkyrc.  I'm still trying to perfect the day indicator however.&lt;br /&gt;&lt;br /&gt;The biggest limitation to using Lua to construct a complete conky output is how it handles displaying text.  It takes a lot of lines to get the tables you see in my output, far more than if I were to do the same thing in a straight conkyrc.&lt;br /&gt;&lt;br /&gt;Anyway, I'm still working on the content of the conky but I am happy how the mechanics have worked out!&lt;br /&gt;&lt;br /&gt;As it stands right now this setup is no more cpu draining than my regular all conkyrc setup.  And when I have all the sections rolled up (except system monitor so that I can see the cpu usage) it runs much lighter.  When a section is "rolled up" or inactive the lua script does not have to do any of the calculations or rendering for that section.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1197757527792374009?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1197757527792374009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/09/here-is-my-latest-conky-configuration.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1197757527792374009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1197757527792374009'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/09/here-is-my-latest-conky-configuration.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/TIxWE-y3JxI/AAAAAAAAAK8/cToHfDUsmPY/s72-c/2010-09-10--1284171775_1440x900_scrot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1291273036506964077</id><published>2010-08-29T22:00:00.001-07:00</published><updated>2010-08-29T22:15:13.457-07:00</updated><title type='text'></title><content type='html'>Animated text conky.&lt;br /&gt;Here is a concept for a conky that I have been thinking about for a while.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-6f73c1213081276e" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v10.nonxt2.googlevideo.com/videoplayback?id%3D6f73c1213081276e%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D10EB7D2B76334B1B8440CE63DF08C9C11A1D4182.2C5478C3F0AB113EFD889E6806F5B6B9FBC10993%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D6f73c1213081276e%26offsetms%3D5000%26itag%3Dw160%26sigh%3D3BZLYg22qbONEcyBPz2wTqkBm8k&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v10.nonxt2.googlevideo.com/videoplayback?id%3D6f73c1213081276e%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D10EB7D2B76334B1B8440CE63DF08C9C11A1D4182.2C5478C3F0AB113EFD889E6806F5B6B9FBC10993%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D6f73c1213081276e%26offsetms%3D5000%26itag%3Dw160%26sigh%3D3BZLYg22qbONEcyBPz2wTqkBm8k&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;having the text in conky appear as if it were being typed.&lt;br /&gt;&lt;br /&gt;The idea came a while back when I was thinking about how to get a better scroll function in conky, and I was working on a matrix rain themed conky.  I thought it would be cool if you could get text in conky to appear like the text that appeared on Neo's computer in the movie.&lt;br /&gt;&lt;br /&gt;I just hadn't done anything about it till now.&lt;br /&gt;&lt;br /&gt;Thanks go to iggykoopa of the crunchbanglinux forum for his help with coding.  Other wise the script would be very difficult to change.  Now you can set up the script to display any text you like, when you like and where you like.  It's still a bit tricky as you have to work out your timings for each section of text to appear, pause and vanish.&lt;br /&gt;&lt;br /&gt;I have set it up so that you get the impression that a program is runing inside of conky, scanning your system and fetching the information.&lt;br /&gt;&lt;br /&gt;You can get the code on the crunchbang linux forum &lt;a href="http://crunchbanglinux.org/forums/post/83807/#p83807"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1291273036506964077?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1291273036506964077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/08/animated-text-conky.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1291273036506964077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1291273036506964077'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/08/animated-text-conky.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2961514129647953526</id><published>2010-07-31T20:21:00.000-07:00</published><updated>2010-07-31T21:04:11.986-07:00</updated><title type='text'></title><content type='html'>My latest conky plots the position of the sun throughout the day.  The Lua script also calculates and displays the sun's altitude and azimuth as it changes throughout the day.  I had to get to grips with some equations and also get to grips with how to do those calculations in Lua.&lt;br /&gt;&lt;br /&gt;The conky has 2 scripts that make it work.&lt;br /&gt;Firstly there is a bash script that uses the curl function to access a webpage.  Then using grep, awk and sed I extracted key astronomical data from the page.&lt;br /&gt;&lt;br /&gt;The Lua script is then fed the data via conky and uses the numbers to perform all the necessary calculations.  I also display a range of data in the conky via the Lua script.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TFTpzbB_zUI/AAAAAAAAAKc/VKXeT7XFkFQ/s1600/2010-07-31--1280615475_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 388px; height: 338px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TFTpzbB_zUI/AAAAAAAAAKc/VKXeT7XFkFQ/s400/2010-07-31--1280615475_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5500278114564951362" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The figure is all based on equations which are in turn based on the data I gathered.  The figure shows a very accurate representation of the position of the sun relative to the horizon.&lt;br /&gt;&lt;br /&gt;You can get the code for the bash and Lua script on the crunchbang linux website &lt;a href="http://crunchbanglinux.org/forums/post/79992/#p79992"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If you are interested in using this conky then be sure to read my post as you will have to make some changes to the scripts regarding geographical location.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2961514129647953526?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2961514129647953526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/07/my-latest-conky-plots-position-of-sun.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2961514129647953526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2961514129647953526'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/07/my-latest-conky-plots-position-of-sun.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/TFTpzbB_zUI/AAAAAAAAAKc/VKXeT7XFkFQ/s72-c/2010-07-31--1280615475_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-4010664626809657270</id><published>2010-07-31T19:48:00.000-07:00</published><updated>2010-07-31T21:02:45.703-07:00</updated><title type='text'></title><content type='html'>Here is a new conky/lua setup from me.&lt;br /&gt;&lt;br /&gt;This is based on a wallpaper created by the ever talented gutterslob which he posted on the crunchbang linux website &lt;a href="http://crunchbanglinux.org/forums/post/59257/#p59257"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This was posted back in March and I said at the time that it would make a great conky but I never went any further than that.  Then recently I saw someone else on the crunchbang site post a screenshot using the wallpaper and, as I had some time to kill, I started making a conky display based upon it.&lt;br /&gt;&lt;br /&gt;This is how it turned out (everything is labeled in the picture)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/TFTjvVhP-ZI/AAAAAAAAAKE/c3iARN3pooI/s1600/aaaanewconky.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 317px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/TFTjvVhP-ZI/AAAAAAAAAKE/c3iARN3pooI/s400/aaaanewconky.png" alt="" id="BLOGGER_PHOTO_ID_5500271447296178578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code is on the crunchbang website &lt;a href="http://crunchbanglinux.org/forums/post/78668/#p78668"&gt;here&lt;/a&gt;.&lt;br /&gt;The code is ugly, overlong, overcomplicated and far from user friendly.  The Lua script is an amalgamation of bits of previous lua scripts with modifications but I have yet to go through the code and clean it up.&lt;br /&gt;&lt;br /&gt;There are some innovations.  I think my clock turned out quite nicely and I haven't seen a clock like that before.  I also liked the idea of a wordless/numberless figure (which this is)&lt;br /&gt;&lt;br /&gt;Also my upspeed and downspeed bars, while seemingly simple, display speed as a percentage of total possible speed (determined via speed testing).  The lua script can differentiate between bytes, kilobytes and megabytes per second (that is output by the conky object upspeed for example) and calculate speed in a single unit which makes this possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-4010664626809657270?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/4010664626809657270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/07/here-is-new-conkylua-setup-from-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4010664626809657270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4010664626809657270'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/07/here-is-new-conkylua-setup-from-me.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/TFTjvVhP-ZI/AAAAAAAAAKE/c3iARN3pooI/s72-c/aaaanewconky.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2030705564948649482</id><published>2010-03-16T08:56:00.000-07:00</published><updated>2010-03-16T09:10:10.054-07:00</updated><title type='text'></title><content type='html'>I haven't been very active conky wise lately and it looks like I won't be able to spend much time in the future on conky/Lua tinkering either.&lt;br /&gt;&lt;br /&gt;I have projects that are going to be keeping me busy.  But hopefully I will have a few hours here and there to play!&lt;br /&gt;&lt;br /&gt;I've still got lots of good ideas about things to do with Lua/cairo scripts, but as the scripts get more complicated they also take longer to write and test.&lt;br /&gt;&lt;br /&gt;I guess I'm entering a mostly retired state as far as conky goes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2030705564948649482?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2030705564948649482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/i-havent-been-very-active-conky-wise.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2030705564948649482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2030705564948649482'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/i-havent-been-very-active-conky-wise.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-328069059235713069</id><published>2010-03-06T20:09:00.001-08:00</published><updated>2010-03-06T20:21:30.283-08:00</updated><title type='text'></title><content type='html'>Numbers to text conversion functions.&lt;br /&gt;Code available on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/57623/#p57623"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S5MnMETYXXI/AAAAAAAAAJk/oYi3gbOKvpc/s1600-h/2010-03-06--1267932508_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 112px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S5MnMETYXXI/AAAAAAAAAJk/oYi3gbOKvpc/s400/2010-03-06--1267932508_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5445739462688005490" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have written 3 functions for converting various numbers to text representations.&lt;br /&gt;The first function converts any regular 3 digit or lower number into words, so that:&lt;br /&gt;19 becomes "nineteen" and 487 becomes "four hundred and eighty seven"&lt;br /&gt;I have used this function in the third line in the image above to convert the output of $cpu to words.&lt;br /&gt;&lt;br /&gt;The second function converts number dates into text, as in the first line in the image above.&lt;br /&gt;&lt;br /&gt;The third converts time data to words as in the middle line above.  This function takes into account all the changes that occur with displaying the time as words.  For example at 6:01, the function will output "one minute past six".  At 6:02 it will be "two minutes past six".  At 6:00 it will show "six o'clock" etc.  You can choose between having seconds represented or not.&lt;br /&gt;&lt;br /&gt;I intend to use these functions with my circlewriting functions to create a text only, non-linear display along the lines of this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S5Mo10XSQ_I/AAAAAAAAAJs/oXZQlRpcB9s/s1600-h/2010-03-06--1267934762_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 275px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S5Mo10XSQ_I/AAAAAAAAAJs/oXZQlRpcB9s/s400/2010-03-06--1267934762_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5445741279475549170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;here is what it looks like when its working:&lt;br /&gt;&lt;br /&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-dde6e47570f5681a" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v6.nonxt4.googlevideo.com/videoplayback?id%3Ddde6e47570f5681a%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D2B23EF25933261706F7DEA62B5BCD801B8336A19.2F611997BDE129EF87241780F818801341148943%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddde6e47570f5681a%26offsetms%3D5000%26itag%3Dw160%26sigh%3DyI3Tv35rZXPEF0WNEEKYSS-xXLM&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v6.nonxt4.googlevideo.com/videoplayback?id%3Ddde6e47570f5681a%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D2B23EF25933261706F7DEA62B5BCD801B8336A19.2F611997BDE129EF87241780F818801341148943%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddde6e47570f5681a%26offsetms%3D5000%26itag%3Dw160%26sigh%3DyI3Tv35rZXPEF0WNEEKYSS-xXLM&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-328069059235713069?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/328069059235713069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/numbers-to-text-conversion-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/328069059235713069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/328069059235713069'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/numbers-to-text-conversion-functions.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/S5MnMETYXXI/AAAAAAAAAJk/oYi3gbOKvpc/s72-c/2010-03-06--1267932508_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-4584264599507961760</id><published>2010-03-01T11:36:00.000-08:00</published><updated>2010-03-02T17:47:37.494-08:00</updated><title type='text'></title><content type='html'>UPDATE.  I have made the perspective drawing function configurable and posted the code on the crunchbanglinux website &lt;a href="http://crunchbanglinux.org/forums/post/57196/#p57196"&gt;here&lt;/a&gt;.  The code there displays the following graphic.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S42CIGjYBXI/AAAAAAAAAJM/lb8eLJIL4Mg/s1600-h/2010-03-02--1267560524_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 244px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S42CIGjYBXI/AAAAAAAAAJM/lb8eLJIL4Mg/s320/2010-03-02--1267560524_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5444150600270349682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Because everything is based off of equations (which are themselves based off just a few key pieces of data), you can easily use the settings to alter the look of the bars like so:&lt;br /&gt;&lt;br /&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-d7e5c1f9a9f516b3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v4.nonxt8.googlevideo.com/videoplayback?id%3Dd7e5c1f9a9f516b3%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D116A3DCA7AF7DB5A3C2746EACCA4D184937F1BCF.36031F88F4B0044D0140580AB024E5600C5A8F75%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Dd7e5c1f9a9f516b3%26offsetms%3D5000%26itag%3Dw160%26sigh%3D2N3kXGjdpXGkhOJ9zjz7CW4dUlI&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v4.nonxt8.googlevideo.com/videoplayback?id%3Dd7e5c1f9a9f516b3%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330363693%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D116A3DCA7AF7DB5A3C2746EACCA4D184937F1BCF.36031F88F4B0044D0140580AB024E5600C5A8F75%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Dd7e5c1f9a9f516b3%26offsetms%3D5000%26itag%3Dw160%26sigh%3D2N3kXGjdpXGkhOJ9zjz7CW4dUlI&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;In this case the red bar is cpu usage.&lt;br /&gt;The green is memperc.&lt;br /&gt;The blue and yellow bars show the percent used of my hard disk drives.&lt;br /&gt;There is a maximum of 6 bars assignable.  For more bars the Lua script would have to altered to add them manually.&lt;br /&gt;&lt;br /&gt;ORIGINAL POST&lt;br /&gt;&lt;br /&gt;I have also been thinking more about creating more isometric figure drawing functions.  I put together &lt;a href="http://thepeachyblog.blogspot.com/2010/02/three-dimensional-bars-well-i-guess-to.html"&gt;this one&lt;/a&gt; a little while ago.  While it does look cool, it clearly does not reflect any kind of reality of how a 3D shape would look from a fixed perspective (which is what isometric means).&lt;br /&gt;&lt;br /&gt;So I thought about trying to create a more realistic looking figure.  I knew it would involve the use of perspective, but I had no idea about how to create the effect or the mathematical principles behind perspective.&lt;br /&gt;&lt;br /&gt;So I turned to google and one of the first things I came across was &lt;a href="http://www.metacafe.com/watch/566841/beginner_perspective_drawing_calculating_diminishing_spaces/"&gt;this video&lt;/a&gt;.&lt;br /&gt;That gave me a basic understanding of how the effect was achieved.  But I didn't want to simply draw a figure using fixed coordinates (that would have been far too easy), I wanted to have a isometric figure that could be configured through settings.&lt;br /&gt;&lt;br /&gt;I had to rapidly re-aquaint myself with the mathematics of triangles!&lt;br /&gt;&lt;br /&gt;This is what I ended up with.  It takes the output from the previous cpu recording and averaging function.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S4wZmKADS2I/AAAAAAAAAIs/CgcwJvoobi4/s1600-h/2010-03-01--1267461604_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 250px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S4wZmKADS2I/AAAAAAAAAIs/CgcwJvoobi4/s320/2010-03-01--1267461604_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5443754192894380898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The largest, whitest bar is current cpu usage, then the next bar is 1 minute, then 5, 15, 30 and 60 minute averages.  The darker bars are all low because the conky had not been running for long before I too this screenshot.&lt;br /&gt;&lt;br /&gt;You could feed each bar anything you wanted, the first could be current CPU followed by memperc etc.  Currently (and for the foreseeable future) to add or remove bars is a manual process.  Perhaps someone with more mathematics and coding skill than me could "automate" the drawing process with "for i=numberofbars do".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-4584264599507961760?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/4584264599507961760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/i-have-also-been-thinking-more-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4584264599507961760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4584264599507961760'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/i-have-also-been-thinking-more-about.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S42CIGjYBXI/AAAAAAAAAJM/lb8eLJIL4Mg/s72-c/2010-03-02--1267560524_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2118893907073349562</id><published>2010-03-01T11:25:00.000-08:00</published><updated>2010-03-01T11:36:01.523-08:00</updated><title type='text'></title><content type='html'>A poster by the name of dbro &lt;a href="http://crunchbanglinux.org/forums/post/56845/#p56845"&gt;posted&lt;/a&gt; a conky config on the crunchbanglinux forum that had an interesting idea about recording data over time and then displaying the data as averages for a period of time via bars.&lt;br /&gt;&lt;br /&gt;I took a look at his Lua script but I couldnt work out how it worked :) &lt;br /&gt;I also thought his bars were confusing.  I think it was partlly because of the way he was using the Lua script with conky.   He wasn't using cairo to display the bars but parsing the Lua script and then creating bars via the $hr conky object.&lt;br /&gt;&lt;br /&gt;I liked the idea of being able to compare computer usage now, to avergae usage over a set time period, so I took dbro's idea and applied my own logic and code to achieve this end.  This is what I came up with:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4wWN8O--yI/AAAAAAAAAIk/F4KTUrexasY/s1600-h/2010-02-27--1267319940_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 263px; height: 241px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4wWN8O--yI/AAAAAAAAAIk/F4KTUrexasY/s320/2010-02-27--1267319940_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5443750478347172642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code is &lt;a href="http://crunchbanglinux.org/forums/post/56870/#p56870"&gt;here&lt;/a&gt; on the crunchbanglinux website.  Here you can alse read a little about the evolution of this script and in dbro's post below he sets out a less intensive way to achieve the same result.  I have yet to try and implement dbro's method but the cogs are turning as to how I would apply it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2118893907073349562?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2118893907073349562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/poster-by-name-of-dbro-posted-conky.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2118893907073349562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2118893907073349562'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/03/poster-by-name-of-dbro-posted-conky.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S4wWN8O--yI/AAAAAAAAAIk/F4KTUrexasY/s72-c/2010-02-27--1267319940_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-5947233320521159268</id><published>2010-02-27T12:16:00.000-08:00</published><updated>2010-02-27T12:48:06.192-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S4l927n7_6I/AAAAAAAAAIU/TyGjEssN6ss/s1600-h/2010-02-27--1267287546_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 220px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S4l927n7_6I/AAAAAAAAAIU/TyGjEssN6ss/s320/2010-02-27--1267287546_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5443020007325564834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another, and most likely the last, variation on my valentine flower Lua script and a final entry in the conky of the month &lt;a href="http://blog.conky.be/2010/02/03/februarys-cotm-competition-st-valentines-daymassacre/"&gt;competition&lt;/a&gt; on the conky blog.&lt;br /&gt;&lt;br /&gt;The biggest change here is the use of shading to the flower petals.  Also I changed the shapes that were transformed by the output of the various conky objects so that there is no overlap.  I think these changes have added quite a bit of eye-candy value to this conky and the effect was quite simple to apply.&lt;br /&gt;&lt;br /&gt;The hearts were also drawn with cairo in the Lua script and shaded to match the flowers.  Luckily I had a heart shape already on file from my&lt;a href="http://crunchbanglinux.org/forums/post/54377/#p54377"&gt; first flower conky&lt;/a&gt;.  I tweaked it a bit for shape, inspired by a &lt;a href="http://static.simpledesktops.com/photo/2010/02/14/v-day.jpg"&gt;wallpaper&lt;/a&gt; I found &lt;a href="http://simpledesktops.com/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I made an option to change the number of petals for each flower, but I didn't factor in how this would affect the shading.  As a result changing the number of petals alters the shading effect.  This should be easily fixed however if I feel like working on the script some more.&lt;br /&gt;&lt;br /&gt;As ever, the code is posted on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/56797/#p56797"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-5947233320521159268?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/5947233320521159268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/another-and-most-likely-last-variation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5947233320521159268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5947233320521159268'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/another-and-most-likely-last-variation.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/S4l927n7_6I/AAAAAAAAAIU/TyGjEssN6ss/s72-c/2010-02-27--1267287546_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-143254786305162352</id><published>2010-02-25T10:32:00.001-08:00</published><updated>2010-02-25T10:44:59.225-08:00</updated><title type='text'></title><content type='html'>Text Blur and shadow.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S4bCbh2C-HI/AAAAAAAAAH0/dOKXeLRaDXg/s1600-h/2010-02-25--1267121839_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 185px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S4bCbh2C-HI/AAAAAAAAAH0/dOKXeLRaDXg/s320/2010-02-25--1267121839_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5442250977921136754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a simple script to add a blur like effect to text and numbers.&lt;br /&gt;It can also be used to make shadows for text.&lt;br /&gt;&lt;br /&gt;Here is a comparison of the blur effect in use and text without the effect.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S4bC0crUDmI/AAAAAAAAAH8/x-6zu0iUF0M/s1600-h/2010-02-25--1267122519_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 94px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S4bC0crUDmI/AAAAAAAAAH8/x-6zu0iUF0M/s320/2010-02-25--1267122519_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5442251406030671458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The effect works by taking multiple instances of the same text, making them mostly transparent and then overlaying them with a slight offset for each instance.  In this case I am displaying the text at various points around a very small circle.&lt;br /&gt;&lt;br /&gt;Like so:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S4bEq5yJfBI/AAAAAAAAAIE/4XO7ilbFGp8/s1600-h/2010-02-25--1267123273_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 291px; height: 283px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S4bEq5yJfBI/AAAAAAAAAIE/4XO7ilbFGp8/s320/2010-02-25--1267123273_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5442253441068530706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The blur effect uses a much smaller circle and calculates transparency by the number of instances of the text you want.&lt;br /&gt;&lt;br /&gt;You can get the code from my post on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/56642/#p56642"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-143254786305162352?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/143254786305162352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/text-blur-and-shadow.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/143254786305162352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/143254786305162352'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/text-blur-and-shadow.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/S4bCbh2C-HI/AAAAAAAAAH0/dOKXeLRaDXg/s72-c/2010-02-25--1267121839_1440x900_scrot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7152632302075596204</id><published>2010-02-24T08:31:00.000-08:00</published><updated>2010-02-24T12:47:33.840-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S4VUhFN28WI/AAAAAAAAAHk/rDRktm1VXaI/s1600-h/2010-02-24--1267028734_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 313px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S4VUhFN28WI/AAAAAAAAAHk/rDRktm1VXaI/s320/2010-02-24--1267028734_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441848652059832674" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I took my line graph Lua script, tweaked it a bit and produced the above.&lt;br /&gt;The FSY "heartbeat" blip shows the filesystem used percent, then 1/4 of fsys used.&lt;br /&gt;&lt;br /&gt;The MEM goes up to current memory use, stays there for two cycles then goes back to zero.&lt;br /&gt;&lt;br /&gt;You can get the code &lt;a href="http://crunchbanglinux.org/forums/post/56517/#p56517"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7152632302075596204?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7152632302075596204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-took-my-line-graph-lua-script-tweaked.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7152632302075596204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7152632302075596204'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-took-my-line-graph-lua-script-tweaked.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/S4VUhFN28WI/AAAAAAAAAHk/rDRktm1VXaI/s72-c/2010-02-24--1267028734_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-9019038365896600442</id><published>2010-02-23T18:27:00.000-08:00</published><updated>2010-02-23T18:53:53.191-08:00</updated><title type='text'></title><content type='html'>I was having some trouble with getting the line graph working properly.   In fact a few hours were spent getting frustrated with the lua script because it wasn't doing what I wanted it to do!&lt;br /&gt;&lt;br /&gt;But then I had a breakthrough and after that it was pretty straightforward :)&lt;br /&gt;This is what the current script is capable of displaying.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S4SPLis2WZI/AAAAAAAAAHU/oxxXtRCRXgQ/s1600-h/2010-02-23--1266977116_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 238px; height: 320px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S4SPLis2WZI/AAAAAAAAAHU/oxxXtRCRXgQ/s320/2010-02-23--1266977116_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441631678226651538" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In fact the first figure was what I had been after for a while.  I wanted my graph to resemble an electroencephalogram.&lt;br /&gt;&lt;br /&gt;I'm sure there is more that can be done from this basis so I may well be posting updates in the future.&lt;br /&gt;&lt;br /&gt;You can get the code from my post in the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/56443/#p56443"&gt;here&lt;/a&gt;.  You can also watch a short clip of an earlier form of this script in action.&lt;br /&gt;&lt;br /&gt;The problem was the transfer of information from the data generating function to the figure drawing function.  The problem was that you can only transfer data held in strings.  In the data function I was generating a table something like this:&lt;br /&gt;&lt;br /&gt;table={}&lt;br /&gt;n=10&lt;br /&gt;for i=1,n do&lt;br /&gt;table[i]=i&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;This would give me a table with 10 entries, the entries being the numbers 1 to 10.&lt;br /&gt;If i did this:&lt;br /&gt;&lt;br /&gt;print (table[i])&lt;br /&gt;&lt;br /&gt;I would get this output in the terminal:&lt;br /&gt;&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;8&lt;br /&gt;9&lt;br /&gt;10&lt;br /&gt;&lt;br /&gt;Which has been fine so far, but the table I was using was much more complicated than this and I just couldn't get things working by simply transferring the string "table[i]" to the figure drawing function.  What I really needed was to transfer the whole table to the drawing function.&lt;br /&gt;&lt;br /&gt;The breakthrough was the use of this command:&lt;br /&gt;string=table.concat(table, ":")&lt;br /&gt;&lt;br /&gt;What this does is to take a table and turn it into a string, in this case, each entry in the table will be seperated from the next by a ":" in the string.  So our example table from above, print (string) would output the following:&lt;br /&gt;1:2:3:4:5:6:7:8:9:10&lt;br /&gt;&lt;br /&gt;I could then take the string, pass it to the drawing function and use the split string function to turn it back into a table.  Then I could work from the table to achieve the figure.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-9019038365896600442?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/9019038365896600442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-was-having-some-trouble-with-getting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/9019038365896600442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/9019038365896600442'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-was-having-some-trouble-with-getting.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/S4SPLis2WZI/AAAAAAAAAHU/oxxXtRCRXgQ/s72-c/2010-02-23--1266977116_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2824638521747429502</id><published>2010-02-23T08:20:00.000-08:00</published><updated>2010-08-22T13:57:36.603-07:00</updated><title type='text'></title><content type='html'>In response to a question asked about vertical graphs on the ubuntu conky thread, I thought that the script I had come up with for bar graphs could be easily modified to give vertical bars.  And it was pretty easy.&lt;br /&gt;&lt;br /&gt;Then I thought about how I could apply a gradient effect along the bar graph, like you can get in a regular conkyrc, and that wasn't too hard either.   So now the script can output graphs like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/THGPEmUvIrI/AAAAAAAAAKs/18vIaBdrHK4/s1600/2010-08-22--1282495584_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 184px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/THGPEmUvIrI/AAAAAAAAAKs/18vIaBdrHK4/s400/2010-08-22--1282495584_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5508341128420598450" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The code to do this has been posted on my original crunchbang linux forum post.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Alternate graphs.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S4QAVS7HXnI/AAAAAAAAAGs/tRKy-wZ3Fbo/s1600-h/2010-02-21--1266772220_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 281px; height: 269px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S4QAVS7HXnI/AAAAAAAAAGs/tRKy-wZ3Fbo/s320/2010-02-21--1266772220_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441474615627439730" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The standard graph outputs from conky are rather uninspiring, so  thought I would try and put together some alternatives.  The above screenshot is displaying cpu usage over time.  Usage is displayed as both a negative and positive value at each point, so you get this kind of "waveform".&lt;br /&gt;&lt;br /&gt;You can get the code on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/56135/#p56135"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In the scrip there is a setting that can produce 3 types of graph, the up and down as above, only up or only down as below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4QBejlrlPI/AAAAAAAAAG0/7V9-xDkWayk/s1600-h/2010-02-21--1266778449_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 111px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4QBejlrlPI/AAAAAAAAAG0/7V9-xDkWayk/s320/2010-02-21--1266778449_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441475874231391474" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another improvement over the regular graphs is that you can change which direction the graph moves in.&lt;br /&gt;&lt;br /&gt;Other configurables include:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;colors&lt;/li&gt;&lt;li&gt;total height&lt;/li&gt;&lt;li&gt;bar width&lt;/li&gt;&lt;li&gt;spacing&lt;/li&gt;&lt;li&gt;gridlines on or off&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I am also working on a line graph, but have run into a few problems, and I havnt got it working how I want it yet.  But it may not be possible to do what I want either :)&lt;br /&gt;This is what it currently looks like:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S4QCegEoXSI/AAAAAAAAAG8/edFiQzw-ar4/s1600-h/2010-02-21--1266810392_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 90px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S4QCegEoXSI/AAAAAAAAAG8/edFiQzw-ar4/s320/2010-02-21--1266810392_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441476972799089954" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think this graph has a lot of potential however!&lt;br /&gt;See subsequent blog entries for developments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2824638521747429502?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2824638521747429502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/alternate-graphs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2824638521747429502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2824638521747429502'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/alternate-graphs.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/THGPEmUvIrI/AAAAAAAAAKs/18vIaBdrHK4/s72-c/2010-08-22--1282495584_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2635492033571153592</id><published>2010-02-22T11:58:00.000-08:00</published><updated>2010-02-22T16:14:25.729-08:00</updated><title type='text'></title><content type='html'>When to use "for i = do" and a look at drawing with cairo.&lt;br /&gt;&lt;br /&gt;I was fiddling with my updated flowers conky, drawing a bumpy circle with cairo to use as the flowers center.  Drawing with cairo via a text file isn't the most user friendly thing you can do, but with some experiementation I had worked out a good way to draw a repeating apttern in a cicle using the cairo_curve_to command.&lt;br /&gt;&lt;br /&gt;The approach involved defining a set of circles, and then using the mathematics available in Lua to generate plot points.&lt;br /&gt;&lt;br /&gt;Like so:&lt;br /&gt;but first I need to set up some variables!&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;inner=110&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;outer1=120&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;outer2=118&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;outer3=120&lt;/span&gt;&lt;br /&gt;The 4 lines above set out the radius of the circles from which I will be calculating my plot points.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;varth1=0.53&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;varth2=0.42&lt;/span&gt;&lt;br /&gt;The above 2 lines will be seen in action later.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;hori=150&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;vert=200&lt;/span&gt;&lt;br /&gt;These are positional setups.&lt;br /&gt;Now I can do the drawing.&lt;br /&gt;&lt;br /&gt;cairo_translate (cr, hori, vert)&lt;br /&gt;cairo_move_to (cr, 0, 0)&lt;br /&gt;I like to use the translate command for positioning figures.  The reason for this is that it allows you to assign the figure "local" coordinates of 0,0  so that you can apply rotations to the figures without cauing problems.  When using trandlate in a drawing function you always need to translate back at the bottom of the function.  In this case I would translate back with:&lt;br /&gt;"cairo_translate (cr, -hori, -vert)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--inner arc from&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, 1);&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;text_arc=((2*math.pi/24)*(3))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs1=0+inner*(math.sin(text_arc))&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;tys1=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;Above I am setting a starting point for our drawing.  The first line is calculating radians for points around the circle.  In this case I have divided the circle up into 24 pieces and we are getting the radian value for point number 3.  Theres no reason I started at 3, thats just how it happened.&lt;br /&gt;I am also using comments to remind me whats what.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through bump1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(3+varth1))&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;txs2=0+outer1*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;tys2=0-outer1*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;This is the "control" point that will determine the extent of the curve.&lt;br /&gt;Take a look &lt;a href="http://cairographics.org/tutorial/#L2createpath"&gt;here&lt;/a&gt; to see how cairo works out its curves (scroll down a little for curves.)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;text_arc=((2*math.pi/24)*(4))&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;txs3=0+outer2*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;tys3=0-outer2*(math.cos(text_arc))&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;cairo_move_to (cr, txs1, tys1)&lt;/span&gt;&lt;br /&gt;This is the coodinates of where the curve will finish.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs1, tys1, txs2, tys2, txs3, tys3)&lt;/span&gt;&lt;br /&gt;And above the curve is being drawn.  Because I am drawing very simple curves (arcs really but I find the use of curve_to easier and more understandable than arc_to) I am basically getting this effect:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4Lq3PnD13I/AAAAAAAAAGk/q2PsjGyy5nM/s1600-h/curve1.png"&gt;&lt;img style="cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4Lq3PnD13I/AAAAAAAAAGk/q2PsjGyy5nM/s320/curve1.png" alt="" id="BLOGGER_PHOTO_ID_5441169534621046642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So the above drawing made a curve out, now we will curve back in, from point txs3,tys3  to coordinates txs5,tys5 and that curve will be controlled by point txs4,tys4 as below.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(4+varth2))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs4=0+outer3*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys4=0-outer3*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(5))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs5=0+inner*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys5=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs3, tys3, txs4, tys4, txs5, tys5)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This gives me one bump like this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LkKdlyqLI/AAAAAAAAAGc/szZ1Lcpn6tg/s1600-h/2010-02-22--1266869213_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 209px; height: 124px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LkKdlyqLI/AAAAAAAAAGc/szZ1Lcpn6tg/s320/2010-02-22--1266869213_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441162168209942706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then originally I did this:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through bump2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(5+varth1))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs6=0+outer1*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys6=0-outer1*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(6))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs7=0+outer2*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys7=0-outer2*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs5, tys5, txs6, tys6, txs7, tys7)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(6+varth2))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs8=0+outer3*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys8=0-outer3*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(7))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs9=0+inner*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys9=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs7, tys7, txs8, tys8, txs9, tys9)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through bump3&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(7+varth1))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs10=0+outer1*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys10=0-outer1*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(8))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs11=0+outer2*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys11=0-outer2*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs9, tys9, txs10, tys10, txs11, tys11)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(8+varth2))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs12=0+outer3*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys12=0-outer3*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/24)*(9))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs13=0+inner*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys13=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs11, tys11, txs12, tys12, txs13, tys13)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;etc etc...&lt;br /&gt;&lt;br /&gt;Drawing the lines for the curves one by one, out then in, out then in... until I got all the way around, closed the path and filled it in.  This was was pretty easy, just copy and paste and edit the numbers.  I also pretty much knew that I didn't have to number the strings in order but I did it anyway.  For example:&lt;br /&gt;string=1&lt;br /&gt;print (string) --&gt; 1&lt;br /&gt;string=2&lt;br /&gt;print (string) --&gt;2&lt;br /&gt;&lt;br /&gt;But I could see that there was an obvious pattern and was a candidate for using the:&lt;br /&gt;&lt;br /&gt;"for i = x,y do" command.&lt;br /&gt;&lt;br /&gt;So I looked at the first bump I had drawn, assigned i a value of 1 and then edited the values so that the points I was plotting on the circles were expressed via i, point 3 being i+2 and point 4 being i+3.  And setting up a string to supply the number of points, substituting the string into the code.  What I ended up with is this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;number=12&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;for i = 1,number do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, 1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--inner arc from&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/number)*(i+2))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs1=0+inner*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys1=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through bump1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/number)*((i+2)+varth1))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs2=0+outer1*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys2=0-outer1*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/number)*(i+3))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs3=0+outer2*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys3=0-outer2*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_line_to (cr, txs1, tys1)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs1, tys1, txs2, tys2, txs3, tys3)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc through&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/number)*((i+3)+varth2))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs4=0+outer3*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys4=0-outer3*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--outer arc to&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/number)*(i+4))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs5=0+inner*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys5=0-inner*(math.cos(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_curve_to (cr, txs3, tys3, txs4, tys4, txs5, tys5)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_close_path (cr)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_fill (cr)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But it wasn't quite so simple. For some reason the shapes of the bumps changed (they were alot more pointy instead of round) and I had to add these lines or the middle of my drawing did not get filled in:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_line_to (cr, txs1, tys1)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But it was quite easy to fiddle with the settings to make the bumps rounded and voila!.&lt;br /&gt;&lt;br /&gt;So when you have a repeating pattern, of you want multiple instances of a figure, then it's a good bet that you can cut down the line count by using this technique.  You can also affect other things with the "i" term.  Achieving a position change from figure to figure you could do something like:&lt;br /&gt;&lt;br /&gt;horizontal = 10*i&lt;br /&gt;vertical = 10&lt;br /&gt;&lt;br /&gt;in this case you would get a horizontal line of figures, spaced 10 apart.&lt;br /&gt;&lt;br /&gt;But you could also do something like:&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 1, 0+(i/10)&lt;br /&gt;&lt;br /&gt;So if "i" has a range of 1 to 10, the first figure would have an alpha of 0.1 while the tenth figure would have an alpha of 1.&lt;br /&gt;&lt;br /&gt;Or you can fit "i" into any number of equations and have it affect any number of variables.&lt;br /&gt;&lt;br /&gt;And if you want more figures, just increase the range of "i" without having to add any additional lines of code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2635492033571153592?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2635492033571153592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/when-to-use-for-i-do-and-look-at.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2635492033571153592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2635492033571153592'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/when-to-use-for-i-do-and-look-at.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S4Lq3PnD13I/AAAAAAAAAGk/q2PsjGyy5nM/s72-c/curve1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2713218803375420796</id><published>2010-02-19T18:52:00.000-08:00</published><updated>2010-02-19T19:13:23.464-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S39OjKzyCqI/AAAAAAAAAFs/Ff_skLd7RUU/s1600-h/2010-02-19--1266634271_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 222px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S39OjKzyCqI/AAAAAAAAAFs/Ff_skLd7RUU/s320/2010-02-19--1266634271_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5440153240990780066" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Three Dimensional Bars!  Well, I guess to be more accurate they would be called isometric?&lt;br /&gt;I had been thinking about doing this for a while and it seemed like an obvious idea :)&lt;br /&gt;&lt;br /&gt;Anyway,  I thought this project would be easy, and to begin with it was.  Getting a bar on Lua is pretty easy, then all I would have to do is draw a top and a side and get everything moving correctly.  This all happened quickly until I started to look at the lines!&lt;br /&gt;&lt;br /&gt;Unfortunately I couldn't simply take the shapes I had drawn to form the "faces" with fill, and overlay them using stroke.  The corners stuck out when the line width was increased and the different line unison &lt;a href="http://cairographics.org/samples/set_line_join/"&gt;options&lt;/a&gt; in cairo were not going to work.  So I had to re-do the lines from scratch, and it took far too may attempts and corrections before I finally got it right.&lt;br /&gt;&lt;br /&gt;With this script you can specify:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;face color&lt;/li&gt;&lt;li&gt;line color&lt;/li&gt;&lt;li&gt;bar width ("depth" is always set to width/2)&lt;/li&gt;&lt;li&gt;bar height&lt;/li&gt;&lt;li&gt;bar position&lt;/li&gt;&lt;li&gt;wire-frame outline on or off&lt;/li&gt;&lt;li&gt;and font, font size, font color and font position&lt;/li&gt;&lt;/ul&gt;You can get the code on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/55927/#p55927"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2713218803375420796?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2713218803375420796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/three-dimensional-bars-well-i-guess-to.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2713218803375420796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2713218803375420796'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/three-dimensional-bars-well-i-guess-to.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S39OjKzyCqI/AAAAAAAAAFs/Ff_skLd7RUU/s72-c/2010-02-19--1266634271_1440x900_scrot.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-8457018126619228660</id><published>2010-02-18T12:39:00.000-08:00</published><updated>2010-02-18T12:47:03.220-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S32lpfzNvtI/AAAAAAAAAFc/HwTXlBvBsQA/s1600-h/2010-02-18--1266520677_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 246px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S32lpfzNvtI/AAAAAAAAAFc/HwTXlBvBsQA/s320/2010-02-18--1266520677_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5439686057262956242" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More ring meter variations.&lt;br /&gt;I have added the ability to draw:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;anticlockwise indicator&lt;/li&gt;&lt;li&gt;rounded ends to indicator lines&lt;/li&gt;&lt;li&gt;rounded end borders&lt;/li&gt;&lt;li&gt;and square end borders&lt;/li&gt;&lt;/ul&gt;You can get the cod on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/55805/#p55805"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-8457018126619228660?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/8457018126619228660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/more-ring-meter-variations.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8457018126619228660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8457018126619228660'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/more-ring-meter-variations.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/S32lpfzNvtI/AAAAAAAAAFc/HwTXlBvBsQA/s72-c/2010-02-18--1266520677_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-8675379427898402700</id><published>2010-02-17T12:59:00.000-08:00</published><updated>2010-02-17T20:16:44.579-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S3xYpkF3SzI/AAAAAAAAAEs/wHyEHP450bM/s1600-h/circlewriter.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 245px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S3xYpkF3SzI/AAAAAAAAAEs/wHyEHP450bM/s320/circlewriter.png" alt="" id="BLOGGER_PHOTO_ID_5439319921042869042" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have improved my circlewriting function significantly!  No more annoying fiddling about to get it right, the function puts everything in the right place first time.  I have kept the option to fine tune through variables to take into account the variations in fonts.  I find this function works best with a monospace font anyway.&lt;br /&gt;&lt;br /&gt;There are 2 function:&lt;br /&gt;"circlewriting" writes text across the top of a circle, on the outside.&lt;br /&gt;"circlewritingdown" writes text along the bottom of a circle on the inside.&lt;br /&gt;Like so:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S3xZNda_oTI/AAAAAAAAAE0/TaKCA70Akzc/s1600-h/2010-02-17--1266440011_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 294px; height: 239px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3xZNda_oTI/AAAAAAAAAE0/TaKCA70Akzc/s320/2010-02-17--1266440011_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5439320537727738162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can get the code for these functions &lt;a href="http://crunchbanglinux.org/forums/post/55708/#p55708"&gt;here&lt;/a&gt; on the crunchbanglinux forum.&lt;br /&gt;&lt;br /&gt;Several of my previous Lua scripts have used predecessors of this function.  For those, just delete the old function, put in the new functions and make sure that when you activate the function you are giving it all the right information.  In the code in the link above I have made the way that you feed the function data a little easier:&lt;br /&gt;&lt;br /&gt;--text must be in quotes&lt;br /&gt;text=" Circle Writing "&lt;br /&gt;--font name must be in quotes&lt;br /&gt;font="White Rabbit"&lt;br /&gt;fontsize=18&lt;br /&gt;radius=80&lt;br /&gt;positionx=100&lt;br /&gt;positiony=150&lt;br /&gt;colorred=1&lt;br /&gt;colorgreen=1&lt;br /&gt;colorblue=1&lt;br /&gt;coloralpha=1&lt;br /&gt;letterposition=0&lt;br /&gt;letterrotation=0&lt;br /&gt;circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, letterposition, letterrotation)&lt;br /&gt;&lt;br /&gt;Information is entered line by line with well described strings.&lt;br /&gt;&lt;br /&gt;You can also use this kind of display for "live" information.  Here I am using the addzero100 function so that the numbers are always 3 digits, although because now the "text" string length is read automatically, the display will alter itself with altering length of "text".&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S3xicTMkg8I/AAAAAAAAAFE/86vavH-t2wM/s1600-h/2010-02-17--1266442679_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 270px; height: 229px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S3xicTMkg8I/AAAAAAAAAFE/86vavH-t2wM/s320/2010-02-17--1266442679_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5439330688285574082" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the text strings that achieved the above:&lt;br /&gt;&lt;br /&gt;cpu=tonumber(conky_parse('${cpu}'))&lt;br /&gt;text=(" CPU " .. (addzero100(cpu)) .. "% ")&lt;br /&gt;&lt;br /&gt;mem=tonumber(conky_parse('${memperc}'))&lt;br /&gt;text=(" MEMORY " .. (addzero100(mem)) .. "% ")&lt;br /&gt;&lt;br /&gt;and for reminder here is the addzero100 function:&lt;br /&gt;&lt;br /&gt;function addzero100(num)&lt;br /&gt;if tonumber(num) &lt; 10 then&lt;br /&gt;return "00" .. num&lt;br /&gt;elseif tonumber(num) &lt;100 then&lt;br /&gt;return "0" .. num&lt;br /&gt;else return num&lt;br /&gt;end&lt;br /&gt;end &lt;br /&gt;&lt;br /&gt;I have now included the ability to set a start and finish position for the displayed text so that you can achieve results like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="cursor: pointer; width: 320px; height: 303px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3yIp9P9QuI/AAAAAAAAAFM/AfAR0FRXuE4/s320/2010-02-17--1266452564_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5439372704354222818" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I have updated my post on the crunchbanglinux forum &lt;a href="http://crunchbanglinux.org/forums/post/55708/#p55708"&gt;here&lt;/a&gt;.  The code there outputs the above image.  There is also a brief discussion regarding overcoming the alignment problems that are inherent in this function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-8675379427898402700?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/8675379427898402700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-have-improved-my-circlewriting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8675379427898402700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8675379427898402700'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-have-improved-my-circlewriting.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S3xYpkF3SzI/AAAAAAAAAEs/wHyEHP450bM/s72-c/circlewriter.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1694055250595381</id><published>2010-02-17T08:52:00.000-08:00</published><updated>2010-02-22T11:49:13.614-08:00</updated><title type='text'></title><content type='html'>ANOTHER UPDATE :)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LZChcxPeI/AAAAAAAAAGU/_VqpJmjjuW4/s1600-h/2010-02-22--1266865863_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LZChcxPeI/AAAAAAAAAGU/_VqpJmjjuW4/s320/2010-02-22--1266865863_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441149937178983906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I was looking at the code I had written and the cairo commands to draw the flower shapes clearly had repeating patterns, so I decided to use the old "for i =" trick to make the code smaller.  This worked and I managed to cut down the line count quite considerably.  Then I realized that having done that I could change the range that i is equal to.  The end result is that you can now specify the number of petals for each flower, and the bumpy middle always has 2x the number of petals.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S3wfAr3ArnI/AAAAAAAAAEU/iifz3KBmY4A/s1600-h/2010-02-16--1266379551_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S3wfAr3ArnI/AAAAAAAAAEU/iifz3KBmY4A/s320/2010-02-16--1266379551_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5439256546590633586" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Conky flowers revisited.&lt;br /&gt;Go &lt;a href="http://crunchbanglinux.org/forums/post/55639/#p55639"&gt;here&lt;/a&gt; to the crunchbang forum for the latest code.&lt;br /&gt;&lt;br /&gt;UPDATE - I have updated the code in the post above so that the Lua script has my improved circlewriting function.&lt;br /&gt;UPDATE2 - I wasn't completely happy with the circular middles, they seemed too hard.  So I have enabled the option to draw bumpy middles as so:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S4LG9g5y4SI/AAAAAAAAAGE/X7CQZXdO0bs/s1600-h/bumpyflowermiddle.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 108px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S4LG9g5y4SI/AAAAAAAAAGE/X7CQZXdO0bs/s320/bumpyflowermiddle.png" alt="" id="BLOGGER_PHOTO_ID_5441130059923644706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Some significant changes and some significant improvements.&lt;br /&gt;First the improvements:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;flower are placeable independently&lt;/li&gt;&lt;li&gt;flowers can be rotated in place without anything else being effected&lt;/li&gt;&lt;li&gt;flowers can be used with any wallpaper and allow transparency effects and overlap&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The third improvement was accomplished by redesigning the flower's color change mechanism.  In the original the flower color change "effect" was created by placing a circle that changed size in response to a numerical input behind a flower "cutout" (see my crunchbang post to see what I'm talking about).  But with the revisit, each petal moves independently from each other (except they are all fed the same number although it would be possible to have each petal represent a separate data output).  Everything is contained within the flower shape.&lt;br /&gt;&lt;br /&gt;There are some things I need to work on.  The circlewriting function needs work.  I think I know how to get it working better, but right now it is far too fiddly, adjusting the "variables" to make everything look right.&lt;br /&gt;&lt;br /&gt;Anyway, this is yet another (or an alternative) entry in the conky blog valentine &lt;a href="http://blog.conky.be/2010/02/03/februarys-cotm-competition-st-valentines-daymassacre/"&gt;competition&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1694055250595381?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1694055250595381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/conky-flowers-revisited.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1694055250595381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1694055250595381'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/conky-flowers-revisited.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S4LZChcxPeI/AAAAAAAAAGU/_VqpJmjjuW4/s72-c/2010-02-22--1266865863_1440x900_scrot.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-243098814725534413</id><published>2010-02-15T17:44:00.000-08:00</published><updated>2010-02-22T10:18:35.445-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S3n6GDapxDI/AAAAAAAAAEM/3iNWTw2TTL0/s1600-h/circlecpu.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 225px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S3n6GDapxDI/AAAAAAAAAEM/3iNWTw2TTL0/s320/circlecpu.png" alt="" id="BLOGGER_PHOTO_ID_5438653006929839154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here is another Lua script.  For the code and to see it in action go &lt;a href="http://crunchbanglinux.org/forums/post/55430/#p55430"&gt;here&lt;/a&gt; to my post on the crunchbang forum.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;require 'cairo'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have describe the below function in my full screen lua script.  This function is here because at first I was just trying to generate numbers arranged around a circle, and I wanted all the numbers to be 3 digits constantly.  When I first wrote the function It was to output numbers around a circle.  I suppose I need to re-write this script for the sake of clarity :)&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function addzero100(num)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if tonumber(num) &lt;&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;return "00" .. num&lt;/span&gt;&lt;br /&gt;return "0" .. num&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;else&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;return num&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;end&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The below function is the figure drawing function.  This was taken from  the circle-writing function I wrote for my valentines flower conky.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function circlewriting(inum, text, ival, font, fsize, radi, horiz, verti, tred, tgreen, tblue, var1, var2)&lt;/span&gt;&lt;br /&gt;Above is the function name followed by a long list of strings that the function needs to work.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;inum&lt;/span&gt; - "length" ie the number of instances that the data will move to.  In the above image this number was 10.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;text&lt;/span&gt; - the actual data that is being represented, in this case cpu usage.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ival&lt;/span&gt; - in the below function an array is used to generate the data and in that array we will be using the code line:&lt;br /&gt;for i = 1, tonumber(len_t) do&lt;br /&gt;len_t is the same number as "inum" above.  So "i" is all the numbers between 1 and 10.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;font&lt;/span&gt; - to set the font for the text output&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;fsize&lt;/span&gt; - sets the font size&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;radi&lt;/span&gt; - sets the radius of the circle around which the bars or text will be displayed.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;horiz&lt;/span&gt; - horizontal, x, position.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;verti&lt;/span&gt; - vertical, y, position&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tred&lt;/span&gt; - output red color value&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tgreen&lt;/span&gt; - output green color value&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;tblue&lt;/span&gt; - oputput blue color value&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;var1&lt;/span&gt; - variable 1&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;var2&lt;/span&gt; - variable 2&lt;br /&gt;&lt;br /&gt;variables 1 and 2 are used to fine tune the position and orientation of the bars or text around the circle.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;deg=360/inum&lt;/span&gt;&lt;br /&gt;Above is a quick calculation to work out how many degrees there are between each bar.  This will be used for the rotation of each bar.&lt;br /&gt;&lt;br /&gt;Now comes the hard math!&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;text_arc=((2*math.pi/inum)*ival+var1)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;txs=0+radi*(math.sin(text_arc))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tys=0-radi*(math.cos(text_arc))&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;br /&gt;The above 3 lines are equations to work out the positions of each bar around the circle.&lt;br /&gt;As we all know: circumference = 2 x pi x radius&lt;br /&gt;and to calculate coordinates for each point around a circle&lt;br /&gt;x=SIN(degrees x n)*radius&lt;br /&gt;and&lt;br /&gt;y=COS(degrees x n)*radius&lt;br /&gt;&lt;br /&gt;Where "n" is the number order of the thing that is being displayed.  For example, on a clock face there are the numbers 1 to 12.  So to get the x,y position of those numbers, n would be 0 for 12, 1 for 1, 2 for 2 etc.&lt;br /&gt;&lt;br /&gt;But Lua only works with radians so the first line is converting degrees to radians.&lt;br /&gt;The next 2 calculate the x and y plot points.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,&lt;br /&gt;CAIRO_FONT_WEIGHT_NORMAL);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_font_size (cr, 22);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, tred, tgreen, tblue, ival/10);&lt;/span&gt;&lt;br /&gt;The above lines are setting the font, font size and color.&lt;br /&gt;&lt;br /&gt;Below are the lines that generate the bars.  I worked out how to apply the rotation to the bars "locally" and position them with the translate command.&lt;br /&gt;&lt;br /&gt;First the position is translated into position.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_translate (cr, txs+horiz, tys+verti)&lt;/span&gt;&lt;br /&gt;Then the bar is rotated below.  You might wonder why I am taking the "deg" string, set earlier, and performing calculations on it to convert degrees into radians, when I have already done that 8 lines earlier when I was calculating the x,y plot points of my bars.  The answer is simple... when I first wrote the function for the flowers.lua my math skills re circles were extremely rusty, so instead of trying to work out the x,y equations for myself, I borrowed then from dissecting londonali1010's air clock lua script (found &lt;a href="http://conky.linux-hardcore.com/?page_id=2780"&gt;here&lt;/a&gt;) without really understanding the math but knowing it worked.  So when I implemented the rotation feature I wrote the calculations seperately.  A case of historical artifacts.  Just another thing to clean up in this script :)&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, (deg*(ival+var2)*(math.pi/180)))&lt;/span&gt;&lt;br /&gt;Then the rectangle is drawn at "local" position 0,0.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rectangle (cr, 0, 0, 20, (text*-1))&lt;br /&gt;cairo_fill (cr)&lt;/span&gt;&lt;br /&gt;Then the rotation is reset.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, ((deg*(ival+var2)*(math.pi/180)*-1)))&lt;/span&gt;&lt;br /&gt;And finally the translation point is reset.  Remember that all cairo transformations are cumulative so if these reset steps were not done then the next bar would be translated and rotated relative to the first bars position and rotation.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_translate (cr, -1*(txs+horiz), -1*(tys+verti))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here are the lines that generate the text output.  I decided to comment them out as I liked the lookof the bars better.  But they can be reinstated easily&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--you can reinstate these lines to get a text output around the circle&lt;br /&gt;--cairo_move_to (cr, txs+horiz, tys+verti);&lt;br /&gt;--cairo_rotate (cr, (deg*(ival+var2)*(math.pi/180)))&lt;br /&gt;--cairo_show_text (cr, (addzero100(text)))&lt;br /&gt;--cairo_rotate (cr, ((deg*(ival+var2)*(math.pi/180)*-1)))&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;/span&gt;Thats the end of the figure drawing function.&lt;br /&gt;Next comes the data generating function.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function conky_draw_graph()&lt;/span&gt;&lt;br /&gt;Above is the name of the function, this is the function we will call in conky.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if conky_window == nil then return end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cr = cairo_create(cs)&lt;/span&gt;&lt;br /&gt;Above is the "canvas" setup just set out a little differently from how I have done it before.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local updates=tonumber(conky_parse('${updates}'))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if updates==1 then     &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;len_t=10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;t1={}   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;The above lines are particularly important.  Here we are initializing the variable.  Basically we are telling Lua that the string called "t1" is a table.  We are also setting the "length" of the figure with len_t.  It took me a little figuring out to understand why these lines had to be here and why they were set only when conky update number = 1.&lt;br /&gt;The reason is that if the line "t1={}" were moved below with the rest of the function (which has to start when conky updates &gt;3 to prevent a segmentation fault when using the conky object ${cpu}) then with each cycle, the line:&lt;br /&gt;"if updates&gt; 3 then"&lt;br /&gt;would be true and everything below that line would be performed and the data stored table "t" would be reset each time.  We are relying on the data in the table to "remember" the past cpu usage numbers so t1={} can only be set once.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if updates&gt; 3 then&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;br /&gt;Below is the array that will generate the data and store it in the table.&lt;br /&gt;And here is the all important "i"&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;for i = 1, tonumber(len_t) do&lt;/span&gt;&lt;br /&gt;Here we are saying that "i" is equal to every number from 1 to len_t (set above).  So to think about this array more simply we will say that "i"=1&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if t1[i+1]==nil then t1[i+1]=0 end&lt;/span&gt;&lt;br /&gt;The above line is a error checking line to stop the "tried to call a nil value" error that can cause the script to stop functioning.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt; t1[i]=t1[i+1]    &lt;/span&gt;&lt;br /&gt;So when "i"=1 then&lt;br /&gt;t1[1]=t1[2].&lt;br /&gt;As we have seen before, numbers, or strings in square brackets relate to an entry in a table, in this case table "t1".  This doesnt make much sense until we get to the next couple of lines:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if i==len_t then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;t1[len_t]=tonumber(conky_parse('${cpu}'))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;So when "i" = the upper limit of its range, len_t (which in this case is 10) then t1[10]=current cpu usage.  Now everything else is set because&lt;br /&gt;t1[9]=t1[10]&lt;br /&gt;t1[8]=t1[9]&lt;br /&gt;t1[7]=t1[8]&lt;br /&gt;to&lt;br /&gt;t1[1]=t1[2]&lt;br /&gt;&lt;br /&gt;Now you might think that if everything equals everything else then why isn't t1[1] to t1[10] all the same number?  What you need to think about here is how the Lua script is working with conky.  Say you have your conkyrc set to update every second, then every second the Lua script is run from the top, so actually the example I gave above about how the table is set up is the wrong way round. &lt;br /&gt;&lt;br /&gt;Because the script lines are performed in order from top to bottom here is what is happening: (or this is how it makes sense to me)&lt;br /&gt;&lt;br /&gt;on the first pass at time 1:&lt;br /&gt;t1[10]=cpu usage at time 1&lt;br /&gt;&lt;br /&gt;then on the next pass at time 2&lt;br /&gt;t1[9]=t1[10] *but* this is the t1[10] from the &lt;span style="font-weight: bold;"&gt;previous&lt;/span&gt; pass where t1[10]=cpu at time 1&lt;br /&gt;because t1[9] is set every so slightly before t1[10] is reset to equal cpu usage at time 2&lt;br /&gt;&lt;br /&gt;and so on it goes so that&lt;br /&gt;t1[10] = current cpu usage at time t&lt;br /&gt;t1[9] = cpu usage at t-1&lt;br /&gt;t1[8] = cpu usage at t-2&lt;br /&gt;t1[7] = cpu usage at t-3&lt;br /&gt;etc...&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--circlewriting (&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;inum, text, ival, font, fsize, radi, horiz, verti, tred, tgreen, tblue, var1, var2)&lt;/span&gt;&lt;br /&gt;Above I am reminding myself of all the variable i need to send the circlewriting function and below I have called the function with all of the relevant info.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;circlewriting(len_t, t1[i], i, "Mono", 22, 40, 200, 200, 0, 0, 0, -0.25, 0)&lt;/span&gt;&lt;br /&gt;Below we are ending the part of the function that began "if updates&gt; 3 then"  It is important to put the call to the figure writing function above this end.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end  &lt;/span&gt;&lt;br /&gt;Below we are freeing some memory, althoug in action I havnt noticed any difference from when I use these lines to when I do not use these lines.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_destroy(cr)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_surface_destroy(cs)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;And then we close the function.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;I will probably revisit this explanation again soon to go over some parts more thoroughly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-243098814725534413?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/243098814725534413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-another-lua-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/243098814725534413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/243098814725534413'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-another-lua-script.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/S3n6GDapxDI/AAAAAAAAAEM/3iNWTw2TTL0/s72-c/circlecpu.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2845201734249644364</id><published>2010-02-14T20:01:00.000-08:00</published><updated>2010-02-14T20:30:17.645-08:00</updated><title type='text'></title><content type='html'>This approach has the advantage of being much more compact and using less functions.  I will be feeding the variables straight into the drawing function.  The lua is to create bars and circle charts like so.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S3jI1dEnPLI/AAAAAAAAAEE/_twmYHFitNA/s1600-h/boundedcircbar.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 221px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3jI1dEnPLI/AAAAAAAAAEE/_twmYHFitNA/s320/boundedcircbar.png" alt="" id="BLOGGER_PHOTO_ID_5438317370712472754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can get the whole code &lt;a href="http://crunchbanglinux.org/forums/post/54938/#p54938"&gt;here&lt;/a&gt; on the crunchbang forum.&lt;br /&gt;&lt;br /&gt;Here is the code lines in question:&lt;br /&gt;The first line of the function that draws the bars is:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la, rotate)&lt;/span&gt;&lt;br /&gt;you can see the name of the function followed by a long list of strings.  These are all the strings that will be set later when the function is called.  Here is a description of each string:&lt;br /&gt;&lt;br /&gt;co = conky object data to display&lt;br /&gt;width = how wide the rectangle will be&lt;br /&gt;height = how tall the rectangle will be&lt;br /&gt;across = x position&lt;br /&gt;down = y position&lt;br /&gt;bgr = red component of background color&lt;br /&gt;bgg =green component of background color&lt;br /&gt;bgb = blue component of background color&lt;br /&gt;bga = alpha component of background color&lt;br /&gt;inr = red component of indicator color&lt;br /&gt;ing = green component of indicator color&lt;br /&gt;inb = blue component of indicator color&lt;br /&gt;ina = alpha  component of indicator color&lt;br /&gt;lw = width of the boundary line&lt;br /&gt;lr  = red component of line color&lt;br /&gt;lg  = green component of line color&lt;br /&gt;lb  = blue component of line color&lt;br /&gt;la  = alpha component of line color&lt;br /&gt;rotate = rotation in degrees that you want applied to the bar&lt;br /&gt;&lt;br /&gt;pretty straightforward variables, and I tried to make it so that you could more or less work out what the string names meant.  Now here is the line when the function is called:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;draw_bar(cpu, 150, 20, 75, 50, 0, 1, 0, 0.5, 0, 1, 0, 1, 10, 1, 0, 0, 0.5, 0)&lt;/span&gt;&lt;br /&gt;Each value is passed up to the draw_bar function.&lt;br /&gt;So that:&lt;br /&gt;co=cpu&lt;br /&gt;width=150&lt;br /&gt;length=20&lt;br /&gt;across=75&lt;br /&gt;down=50&lt;br /&gt;...etc etc.&lt;br /&gt;&lt;br /&gt;Then you can call the same function again but feed it a different set of information like so:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;draw_bar(mem, 150, 40, 250, 30, 0, 0, 1, 0.5, 0, 0, 1, 1, 20, 0, 1, 0, 0.5, 0)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Not as user friendly as the settings table approach but far less code and alot less complicated.  Another important aspect to this approach is that it is more like a "tool" that can be used in a Lua script that contains multiple elements.  All you need is the figure drawing function above the function that you will be calling in conky, then if you want a bar or circle meter in your setup, call the function with a single line setup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2845201734249644364?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2845201734249644364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-approach-has-advantage-of-being.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2845201734249644364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2845201734249644364'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-approach-has-advantage-of-being.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/S3jI1dEnPLI/AAAAAAAAAEE/_twmYHFitNA/s72-c/boundedcircbar.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2905844135243929071</id><published>2010-02-14T12:57:00.000-08:00</published><updated>2010-02-14T13:29:22.397-08:00</updated><title type='text'></title><content type='html'>I knew it could be done more easily.&lt;br /&gt;Thanks to the coding skills of wlourf, the code to generate the moving bars/moving dots lua (&lt;a href="http://thepeachyblog.blogspot.com/2010/02/these-two-graphs.html"&gt;here&lt;/a&gt;) is now significantly shorter!  &lt;a href="http://crunchbanglinux.org/forums/post/55304/#p55304"&gt;Here&lt;/a&gt; is wlourf first post on the crunchbang forum.&lt;br /&gt;&lt;br /&gt;I knew it was possible and I knew it would involve the technique that wlourf used.  I just haven't gotten to grips with the workings of arrays!&lt;br /&gt;&lt;br /&gt;And here is a simplified code that generates the moving dot conky as I did before:&lt;br /&gt;&lt;br /&gt;require 'cairo'&lt;br /&gt;function dotdraw(cr, num, inum, length, hori, vert, width, height, dotsize, dotr, dotg, dotb, dota)&lt;br /&gt;cairo_set_source_rgba (cr, dotr, dotg, dotb, dota)&lt;br /&gt;modnum=(num*(height/100))&lt;br /&gt;cairo_arc(cr, ((width*inum)+hori), (vert-modnum), dotsize, 0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;cairo_fill (cr)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function conky_draw_graph()&lt;br /&gt;if conky_window == nil then return end&lt;br /&gt;local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)&lt;br /&gt;cr = cairo_create(cs)&lt;br /&gt;local updates=tonumber(conky_parse('${updates}'))&lt;br /&gt;if updates==1 then&lt;br /&gt;  len_t=20&lt;br /&gt;  t1={}&lt;br /&gt;end&lt;br /&gt;if updates&gt; 3 then&lt;br /&gt;for i = 1, tonumber(len_t) do&lt;br /&gt;      if t1[i+1]==nil then t1[i+1]=0 end&lt;br /&gt;      t1[i]=t1[i+1]&lt;br /&gt;      if i==len_t then&lt;br /&gt;          t1[len_t]=tonumber(conky_parse('${cpu}'))&lt;br /&gt;      end&lt;br /&gt;      --dotdraw(cr, num, inum, length, hori, vert, width, height, dotsize, dotr, dotg, dotb, dota)&lt;br /&gt;      dotdraw(cr, t1[i], i, len_t, 10, 200, 10, 200, 3, 0, 0, 0, 1)&lt;br /&gt;end &lt;br /&gt;cairo_destroy(cr)&lt;br /&gt;cairo_surface_destroy(cs)&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;Just a few hundred lines shorter!  And using the array you can have a graph as long as you want without increasing the size of the code.  All you have to do is change a variable.&lt;br /&gt;&lt;br /&gt;Also important, in addition to the use of an array to generate the data, is that the graph drawing function (dotdraw at the top) is separated from the data generating function (conky_draw_graph).  This means that the data can be fed easily into as many different kinds of drawing functions as you can think of to represent it.  I can think of a number of ways of presenting "graph" like data and now all i have to do is create the drawing function and feed it the data.&lt;br /&gt;&lt;br /&gt;In addition this method seemed ideal to apply to creating a text scroll function.&lt;br /&gt;Here is the result:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S3hm3c7b9LI/AAAAAAAAADk/OUWqXrLWR84/s1600-h/scroll.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 76px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3hm3c7b9LI/AAAAAAAAADk/OUWqXrLWR84/s320/scroll.png" alt="" id="BLOGGER_PHOTO_ID_5438209652894201010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code and a video clip are posted on the crunchbang forum &lt;a href="http://crunchbanglinux.org/forums/post/55334/#p55334"&gt;here&lt;/a&gt; (it is still a work in progress).&lt;br /&gt;I have never liked the native scroll function in conky because it is not continuous.  If you have a scroll length of 100 say, then it will scroll your message but then follow it up with 100 empty spaces.  Unfortunately this lua scroll has its drawbacks too.  Principally that the information is static as it moves across, cpu usage will not change and time will not update, until the strings are generated for the next pass.&lt;br /&gt;&lt;br /&gt;However, I think this scroll would be ideal for such things as time and date and to display the titles of music tracks.&lt;br /&gt;&lt;br /&gt;I'm certainly going to be seeing what interesting formats I can come up with!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2905844135243929071?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2905844135243929071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-knew-it-could-be-done-more-easily.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2905844135243929071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2905844135243929071'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-knew-it-could-be-done-more-easily.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/S3hm3c7b9LI/AAAAAAAAADk/OUWqXrLWR84/s72-c/scroll.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-1402404500203889461</id><published>2010-02-11T21:10:00.000-08:00</published><updated>2010-02-11T21:56:59.258-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S3TkJ7lOIBI/AAAAAAAAADM/SBGOgKv4EIQ/s1600-h/cpugraph.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 174px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S3TkJ7lOIBI/AAAAAAAAADM/SBGOgKv4EIQ/s320/cpugraph.png" alt="" id="BLOGGER_PHOTO_ID_5437221509406793746" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S3TkCZUVTRI/AAAAAAAAADE/iUqSOc3iKq4/s1600-h/blubars.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 238px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S3TkCZUVTRI/AAAAAAAAADE/iUqSOc3iKq4/s320/blubars.png" alt="" id="BLOGGER_PHOTO_ID_5437221379950071058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;These two graphs both display cpu usage over time.  The blue graph came first and then I modified the Lua script to generate the dot chart.  I had been thinking of tackling an animated bar chart for a while and decided that I should just give it a go.  But it wasn't easy!&lt;br /&gt;&lt;br /&gt;Just to conceptualize how it was going to work in the beginning took a while...&lt;br /&gt;I had to think of a way to capture cpu usage information at one particular time,  store that information and display it somehow while capturing new information every cycle and linking that all together to get the illusion of a moving chart.&lt;br /&gt;&lt;br /&gt;I had (with the help of the crunchbanglinux forum) found a way to implement a timer in lua:&lt;br /&gt;&lt;br /&gt;local updates=conky_parse('${updates}')&lt;br /&gt;update_num=tonumber(updates)&lt;br /&gt;local timer=(update_num % 4)+1&lt;br /&gt;&lt;br /&gt;Parse conky to get the updates number then using the line above, every time the updates number is divisible cleanly by 4 (ie no remainder) then timer =1 (without the +1 it would equal 0)&lt;br /&gt;The result is that the timer counts 1,2,3,4,1,2,3,4,1,2,3,4 etc etc.  This was the basis for the animation.&lt;br /&gt;&lt;br /&gt;I started with trying a 4 bar graph and after a little figuring out I got to the point where i could get the bars set and moving across, but when the timer reset so did the bars.  The problem was that I could pass information down the script by referencing strings:&lt;br /&gt;num1=number&lt;br /&gt;num2=num1&lt;br /&gt;num3=num2&lt;br /&gt;num4=num3&lt;br /&gt;But to get the table working i needed this:&lt;br /&gt;A-&gt;B-&gt;C-&gt;D-&gt;a-&gt;b-&gt;c-&gt;d&lt;br /&gt;B-&gt;C-&gt;D-&gt;a-&gt;b-&gt;c-&gt;d-&gt;A&lt;br /&gt;C-&gt;D-&gt;a-&gt;b-&gt;c-&gt;d-&gt;A-&gt;B&lt;br /&gt;D-&gt;a-&gt;b-&gt;c-&gt;d-&gt;A-&gt;B-&gt;C&lt;br /&gt;&lt;br /&gt;So that I get a full cycle, so that the next step I can reset back top the beginning.  But going from dABC which existed at the bottom of the script back to the top for ABCD, I had to take the information for ABC (from dABC) and move it up the script so that ABC in ABCD is the same ABC from dABC.  That makes sense right?&lt;br /&gt;&lt;br /&gt;So I needed a function. Functions are how you move information from the bottom of the script to the top!&lt;br /&gt;&lt;br /&gt;Anyway.  Look &lt;a href="http://crunchbanglinux.org/forums/post/55012/#p55012"&gt;here&lt;/a&gt; at the code on the crunchbang forum and you will see what I ended up with.  The script is pretty long.  The reason for this is that, as you can see from the above example, for a 4  step animation you actually need 8 steps, each step containing 4 bits of information.  So for 4 steps you need 32 bits of information.&lt;br /&gt;&lt;br /&gt;I ended up with a 10 step graph which needed 200 bits of information.  If i wanted a 20 step graph then that is 20x2x20=800 bits of info.&lt;br /&gt;&lt;br /&gt;If anyone has an easier way then I would be only too glad to hear it!&lt;br /&gt;&lt;br /&gt;The other drawback with the graph drawing function, as I have written it, is that you can only feed it one set of information.  Unlike other functions where you can feed it say cpu info and settings and also feed it memperc information and settings and get 2 outputs.  This function you cant do that...something just doesn't work.  It would be easy enough to copy the function, and change its name, then call the newly named function with different information in the conky display function.  However, it is also the case that there arent many other conky outputs that are suited to a graph.&lt;br /&gt;&lt;br /&gt;Downspeed and upspeed graphs can be generated by conky, and could be generated from my graph drawing script... but extra steps would need to be taken to adjust for the changing units... B to KiB to MiB.&lt;br /&gt;&lt;br /&gt;Maybe I'll find a more compact way of doing this... although running this script, total "resting" cpu usage on my system is around the 2's or 3's so it is hardly intensive even for it's size.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-1402404500203889461?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/1402404500203889461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/these-two-graphs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1402404500203889461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/1402404500203889461'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/these-two-graphs.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S3TkJ7lOIBI/AAAAAAAAADM/SBGOgKv4EIQ/s72-c/cpugraph.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2752764962196923368</id><published>2010-02-10T13:25:00.000-08:00</published><updated>2010-02-15T17:31:12.413-08:00</updated><title type='text'></title><content type='html'>Hot on the heels of my custom bars lua comes another script for drawing bars and rings.  And after figuring out most of what goes into making a settings table work with cairo in a lua script... I decided to go with another approach.&lt;br /&gt;&lt;br /&gt;Instead of setting up a settings table at the beginning of the script, then parsing the table with one function and feeding the parsed information into another function which converts the table values into local strings... I went with defining the values when calling the draw function.  It maybe isn't as user friendly as the settings table way but in less than half the lines of my custom bars lua I have created a script that can generate the same bars and also generate ring meters.&lt;br /&gt;&lt;br /&gt;Also I think the way that I have set up the code will make it easier to inset these meters into another Lua script.  All it requires is that the meter drawing functions are placed above the function to be called in conky.  Then you can use the functions with just a couple of setup lines.&lt;br /&gt;&lt;br /&gt;Of course the ring meters are taken from londonali1010's ring meter script &lt;a href="http://conky.linux-hardcore.com/?page_id=2800"&gt;here&lt;/a&gt;.  Many thanks to londonali1010 for all her excellent and inspirational work!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S3Mlzp_DdSI/AAAAAAAAACc/OvHtvcaOTpA/s1600-h/boundedcircbar.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 221px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3Mlzp_DdSI/AAAAAAAAACc/OvHtvcaOTpA/s320/boundedcircbar.png" alt="" id="BLOGGER_PHOTO_ID_5436730744540198178" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have also enabled the addition of boundary rings for the ring meters.  The outer and inner boundary rings can be set values for width, color and alpha individually.&lt;br /&gt;&lt;br /&gt;The code in posted in the crunchbanglinux forum conky config thread &lt;a href="http://crunchbanglinux.org/forums/post/54938/#p54938"&gt;here&lt;/a&gt;.&lt;br /&gt;I have just updated the code to allow much easier use of rotation with the bars.  Bars rotate in place and not relative to 0,0 in the new code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2752764962196923368?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2752764962196923368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/hot-on-heels-of-my-custom-bars-lua.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2752764962196923368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2752764962196923368'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/hot-on-heels-of-my-custom-bars-lua.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/S3Mlzp_DdSI/AAAAAAAAACc/OvHtvcaOTpA/s72-c/boundedcircbar.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-4738919844509702444</id><published>2010-02-10T09:43:00.000-08:00</published><updated>2010-02-15T21:08:47.253-08:00</updated><title type='text'></title><content type='html'>Here is the annotated Lua script for my custom bars.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S3LwdNv753I/AAAAAAAAACU/45tqEwHEAjs/s1600-h/transpbaer.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 196px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S3LwdNv753I/AAAAAAAAACU/45tqEwHEAjs/s320/transpbaer.png" alt="" id="BLOGGER_PHOTO_ID_5436672084887201650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For simplicity I have put in the settings for only 1 bar.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;require "cairo"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So first we have the table below.&lt;br /&gt;The table has a format like this:&lt;br /&gt;table={{A1=1,B1=2,C1=3,D1=4},{A2=1,B2=2,C2=3,D2=4},{A3=1,B3=2,C3=3,D3=4}}&lt;br /&gt;but for ease of use and so that the settings can be edited easily the table is split up line by line as follows:&lt;br /&gt;BUT you still have to have all of the brackets (I'm not sure that they have to be curly brackets, but they certainly work.) and all of the commas or you will get an error.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;table = {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;{&lt;/span&gt;&lt;br /&gt;I have used comments throughout the table so that each setting is easily identified.  The comments do not interrupt the format of the table.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--conky object for output&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;co='cpu',&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--rectangle width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rw=150,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--rectangle height&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rh=50,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--NOTE about width and height.  For a bordered rectangle with line width lw (specified below)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--the border is drawn 1/2 lw inside and 1/2 lw outside the boundary of the rectangle, so that&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--final width=rw+lw and final height=rh+lw.  I did not automate this below as it is possible &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--to specify a line width (lw) greater than either width (rw) or height (rh).  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--eg if you want a rectangle 200 pixels long and a border line width of 8, then rw=100-8=92&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;&lt;/span&gt;Above is a note about how to set up the heights and widths.  If something isn't obvious to anyone who might use the script it's nice to explain things,&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--background rectangle color set&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;bg_red=1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;bg_green=0,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;bg_blue=0,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--background rectangle alpha&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rab=0.5,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--indicator rectangle color set&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;in_red=0,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;in_green=1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;in_blue=0,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--indicator rectangle alpha&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rai=1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--border line width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;lw=40,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--border line color set&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;l_red=1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;l_green=0,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;l_blue=1,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--border line alpha&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;la=0.2,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--position, x and y&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rx=200,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;ry=150,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--set rotation in degrees (will require x and y to be reconfigured)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;rot=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;},&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;So we have all of the variables set.  Each variable will be passed into the various functions and applied to the bars when they are drawn.&lt;br /&gt;&lt;br /&gt;There are 2 functions and one sub function in this script.  From looking at my last annotated script a function is written and then called below, and then when it is called information is passed up to the function.  Here, to see how the information is passed I'll look at the second function first.  This is the function that we will be calling in conky:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function conky_draw_shape()&lt;/span&gt;&lt;br /&gt;this is the name of the function&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local updates=conky_parse('${updates}')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;update_num=tonumber(updates)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if update_num &gt; 5 then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if conky_window==nil then return end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local w=conky_window.width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local h=conky_window.height&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cr=cairo_create(cs)&lt;/span&gt;&lt;br /&gt;The above should be familiar.  It sets the 5 cycle delay and the surface onto which cairo will draw.  Next comes a local function.  This function called "parse" which takes the table entry "co" (the conky object whose output will be displayed by the bar) and performs the conky_parse command on it.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local function parse(cr,pt)&lt;/span&gt;&lt;br /&gt;Here is the local function name and the strings that will be set when the function is used below.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local str=''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local value=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;str=string.format('${%s}',pt['co'])&lt;/span&gt;&lt;br /&gt;The pt part is the important part (note that there is nothing important about the term pt, it is just the name of a string and could be anything.  Perhaps pt stands for parse table).  pt is one of the strings that is set by the parse function from information fed to the function when it is called.  Also you should remember 'co' as one of the variables we set in the settings table.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;str=conky_parse(str)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;value=tonumber(str)&lt;/span&gt;&lt;br /&gt;The function is parsing 'co' the conky object, running that through the tonumber command and then storing the information in a string named "value"&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if value == nil then value = 0 end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;draw_table(cr,pt,value)&lt;/span&gt;&lt;br /&gt;The line above is calling the first function in the script, and feeding the function 3 things: cr, pt and value.  As we saw the "value" string is generated above and it is that string that will be passed to the draw_table function.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;Here is the end of the local function.  Below is the remaining commands of the "global" function called "draw_shape"&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;br /&gt;for i in pairs(table) do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;parse(cr, table[i])&lt;/span&gt;&lt;br /&gt;These 2 lines is where the "magic" happens :)  These lines read the contents of the table, and pass each set of variables to the parse function.  In this case the letter "i" is extremely important and cannot be substituted.  Perhaps "i" stands for "instance" or "index", I don't know exactly.  So basically what is being done is that for every  set of data ie {A1=1,B1=2,C1=3,D1=4}  in the settings table the "parse" function is being called and fed the cr string as well as every string that the set contains ( A1, B1, C1, D1).&lt;br /&gt;&lt;br /&gt;As you can see the parse function is being sent 2 things cr and table[i].  Then as we saw the parse function (&lt;span style="color: rgb(255, 102, 102);"&gt;local function parse(cr,pt)&lt;/span&gt;) takes cr and stores it as cr and takes the output of table[i] and stores it as pt.  Then in the parse function we see &lt;span style="color: rgb(255, 102, 102);"&gt;pt['co'] &lt;/span&gt;which is the same as "table['co']".  So the table is being searched for the string co, and the value of co is being formatted (&lt;span style="color: rgb(255, 102, 102);"&gt;str=string.format('${%s}',pt['co'])&lt;/span&gt;)  and stored in the string called "str".&lt;br /&gt;&lt;br /&gt;So for the data set "table= {A1=1,B1=2,C1=3,D1=4}"&lt;br /&gt;table['A1']=1&lt;br /&gt;table['B1']=2&lt;br /&gt;table['C1']=3&lt;br /&gt;table['D1']=4&lt;br /&gt;&lt;br /&gt;and as in the parse function table[i] = pt[i] so that&lt;br /&gt;&lt;br /&gt;table['A1']=1=pt['A1']&lt;br /&gt;table['B1']=2=pt['B1']&lt;br /&gt;table['C1']=3=pt['C1']&lt;br /&gt;table['D1']=4=pt['D1']&lt;br /&gt;&lt;br /&gt;I hope that all makes sense.&lt;br /&gt;So to recap...&lt;br /&gt;&lt;ul&gt;&lt;li&gt;function draw_shape is generating the strings: cr and table[i]&lt;/li&gt;&lt;li&gt;function parse is being fed cr (but not doing anything with it) and table[i] and renaming table[i] as the string pt.&lt;/li&gt;&lt;li&gt;parse is looking through the string "pt" for the table setting 'co'  then parsing and formatting the output and storing it as the string "value".&lt;/li&gt;&lt;/ul&gt;parse is then feeding the strings "cr", "pt" and the new string "value" up to the function settings_table.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now we are going back to the point after the settings table (confused yet? :) )&lt;br /&gt;Here we have the first function in the Lua script and we have already seen where the strings cr, pt and value are being fed from.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function draw_table(cr, pt, value)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local width=pt['rw']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local height=pt['rh']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local bgalpha=pt['rab']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local indalpha=pt['rai']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local across=pt['rx']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local down=pt['ry']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local lwide=pt['lw']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local lalpha=pt['la']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local bgcolr=pt['bg_red']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local bgcolg=pt['bg_green']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local bgcolb=pt['bg_blue']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local incolr=pt['in_red']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local incolg=pt['in_green']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local incolb=pt['in_blue']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local lcolr=pt['l_red']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local lcolg=pt['l_green']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local lcolb=pt['l_blue']&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local rotate=pt['rot']&lt;/span&gt;&lt;br /&gt;Above are a number of lines that are searching the table information (stored in the string pt) for the various bits and pieces of information.  Then when the specific bit of information is found, that information is being set as a local string. For example:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local width=pt['rw']&lt;/span&gt;&lt;br /&gt;string pt is being searched for the table setting "rw" (rectangle width) and storing the value of this setting in the local string "width".&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--indicator calculation&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local inum=(((width-lwide)/100)*value)&lt;/span&gt;&lt;br /&gt;The above calculation allows the bars to be resized while maintainig the correct proportions of the indicator line.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--set initial rotation&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, rotate*math.pi/180)&lt;/span&gt;&lt;br /&gt;Here we are applying the local string rotate (initially set in the settings table as "rot") and performing the rotation, if any.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--background bar&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rectangle (cr, (across+(lwide/2)), (down+(lwide/2)), (width-lwide), (height-lwide))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, bgcolr, bgcolg, bgcolb, bgalpha);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_fill (cr)&lt;/span&gt;&lt;br /&gt;Above we are drawing the background bar using the local strings we set above.  The calculations in the code are to account for the way that the outline of rhe rectangle is drawn.  This was explained towards the top of the script.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--indicator bar&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rectangle (cr, (across+(lwide/2)), (down+(lwide/2)), inum, (height-lwide))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, incolr, incolg, incolb, indalpha);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_fill (cr)&lt;/span&gt;&lt;br /&gt;Above we generate the indicator bar.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--border line&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_line_width (cr, lwide);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rectangle (cr, across, down, width, height)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, lcolr, lcolg, lcolb, lalpha);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_stroke (cr)&lt;/span&gt;&lt;br /&gt;And above we draw the outline, if any.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--resets rotation&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, (rotate*-1)*math.pi/180)&lt;/span&gt;&lt;br /&gt;Then we reset rotation.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;Below you can look through the functions that have been described above, but in the correct order.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function conky_draw_shape()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local updates=conky_parse('${updates}')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;update_num=tonumber(updates)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if update_num &gt; 5 then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if conky_window==nil then return end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local w=conky_window.width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local h=conky_window.height&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cr=cairo_create(cs)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local function parse(cr,pt)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local str=''&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local value=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;str=string.format('${%s}',pt['co'])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;str=conky_parse(str)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;value=tonumber(str)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if value == nil then value = 0 end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;draw_table(cr,pt,value)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;for i in pairs(table) do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;parse(cr, table[i])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;That's the end.&lt;br /&gt;&lt;a href="http://thepeachyblog.blogspot.com/2010/02/this-approach-has-advantage-of-being.html"&gt;Here&lt;/a&gt; is an approach that achieves the same result as a settings table, in that you can achieve multiple outputs from a single instance of a function.  But I think that this next approach is easier to implement and considerable shorter code wise. And &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-is-another-lua-script.html"&gt;here&lt;/a&gt; is my first take at explaining the use of arrays in a Lua script.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-4738919844509702444?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/4738919844509702444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-annotated-lua-script-for-my.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4738919844509702444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/4738919844509702444'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-annotated-lua-script-for-my.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S3LwdNv753I/AAAAAAAAACU/45tqEwHEAjs/s72-c/transpbaer.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-6327327987156189715</id><published>2010-02-09T18:58:00.000-08:00</published><updated>2010-02-09T19:12:10.195-08:00</updated><title type='text'></title><content type='html'>I thought it was time that I tried to get to grips with calling multiple instances of a function via a settings table.  I tried it out with something simple at first, and paying close attention to the ring meters script by londonali1010 as a reference here is the end result:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S3Ihy8WTiYI/AAAAAAAAACE/QX-dWgK842A/s1600-h/transpbaer.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 196px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S3Ihy8WTiYI/AAAAAAAAACE/QX-dWgK842A/s320/transpbaer.png" alt="" id="BLOGGER_PHOTO_ID_5436444859266468226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A script that generates indicator bars.  While not groundbreaking I thought it might add to the tools of the conky maker :)&lt;br /&gt;&lt;br /&gt;They are fully configurable and you can change:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;which output to display&lt;/li&gt;&lt;li&gt;background color and alpha&lt;/li&gt;&lt;li&gt;indicator color and alpha&lt;/li&gt;&lt;li&gt;border color and alpha&lt;/li&gt;&lt;li&gt;size&lt;/li&gt;&lt;li&gt;position&lt;/li&gt;&lt;li&gt;rotation&lt;/li&gt;&lt;/ul&gt;via a settings table&lt;br /&gt;&lt;br /&gt;Go &lt;a href="http://crunchbanglinux.org/forums/post/54759/#p54759"&gt;here&lt;/a&gt; for the code.  I shall probably be making some modifications in the future.&lt;br /&gt;I shall also post an annotated copy of the lua script and do my best to explain how the whole thing works&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-6327327987156189715?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/6327327987156189715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-thought-it-was-time-that-i-tried-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6327327987156189715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/6327327987156189715'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-thought-it-was-time-that-i-tried-to.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_bEV68MpI_n4/S3Ihy8WTiYI/AAAAAAAAACE/QX-dWgK842A/s72-c/transpbaer.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7204838397570946499</id><published>2010-02-09T17:17:00.000-08:00</published><updated>2010-02-09T18:29:27.635-08:00</updated><title type='text'></title><content type='html'>Tips for writing Lua scripts and getting them working in conky&lt;br /&gt;&lt;br /&gt;Some of these will be very basic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt;  Always launch your conkyrc through the terminal.  You will  get feedback about errors here that are invaluable for fixing them.  More on this later&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; Setup a folder where you are going to keep all of your conky configs and create a conky_start shell script&lt;br /&gt;mine contains the following:&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;conky -c ~/.conky/.conkyrc_tabletest&lt;br /&gt;&lt;br /&gt;You need to make this script executable.  I do this through my file manager as I'm not familiar with the terminal commands to do this.&lt;br /&gt;&lt;br /&gt;This script will launch the conky I have saved as conkyrc_tabletest in the folder ".conky" in my home directory.  Obviously you muct have created a conky before you can try and launch it!&lt;br /&gt;&lt;br /&gt;Then launch the conky in the terminal as follows:&lt;br /&gt;&lt;br /&gt;$ /home/mcdowall/.conky/conky_start&lt;br /&gt;&lt;br /&gt;I have my regular conky config launch on startup, but I always launch a config I'm working on by editing this conky_start file.  Just make sure that if you have a conky (or more than 1) running on your system that the conky you are about to launch will not interfere.  My everyday conky is set to top_right... so I set a conky I'm working on to open elsewhere.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3.&lt;/span&gt;  You are going to have to stop and restart the conkyrc *alot*&lt;br /&gt;&lt;br /&gt;a command like:&lt;br /&gt;&lt;br /&gt;$ killall conky&lt;br /&gt;&lt;br /&gt;should do the trick.  If your conky quits on you and just disappears always perform the above command.  Don't just start it up again or you will get multiple instances on conky running and things will start to slow down.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4. &lt;/span&gt; Regarding Lua scripts in general, use the print function to troubleshoot when something isn't working right.&lt;br /&gt;&lt;br /&gt;for example I have the following code:&lt;br /&gt;&lt;br /&gt;cpunum=conky_parse ('${cpu}')&lt;br /&gt;cpu=tonumber(cpunumber)&lt;br /&gt;&lt;br /&gt;but for some reason things aren't working as expected.   So put in the print command as so:&lt;br /&gt;&lt;br /&gt;cpunum=conky_parse ('${cpu}')&lt;br /&gt;cpu=tonumber(cpunumber)&lt;br /&gt;print (cpu)&lt;br /&gt;&lt;br /&gt;If the above code is correct then you will get the output of cpu printed only in the terminal window.  Of course if there is something wrong above this point that has broken the script, you won't get anything printed out.&lt;br /&gt;&lt;br /&gt;The above code is probably too simple to go wrong, but when you are trying more complicated things, like string editing with gsub or the string:split function or trying to work out some tricky mathematics, the print command is invaluable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5.&lt;/span&gt;  Put enough comments into the script so you know whats going on.&lt;br /&gt;When you go back to a script and want to edit something, it's much easier if you have divided your script and functions into descriptive sections with comments.  -- before text makes the text a comment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;6.&lt;/span&gt; Try and use descriptive names to your strings.&lt;br /&gt;As above, when you come back to look at a script, a string names cpu_num gives you a good clue about what the string is about... while something more arbitrary like  "a18" doesn't.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Terminal Output&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometimes the terminal output is very helpful, sometimes it's not.  I would say the most common thing I see in the terminal is this:&lt;br /&gt;&lt;br /&gt;Conky: llua_do_call: function conky_draw_shape execution failed: attempt to call a nil value&lt;br /&gt;&lt;br /&gt;This happens particularly because  I don't have enough end's in my scripts.  I should get into the habit of writing my scripts out properly like this:&lt;br /&gt;&lt;br /&gt;function&lt;br /&gt;&lt;span&gt;              if x==y then&lt;br /&gt;                         ...................return z&lt;br /&gt;            ..............else&lt;br /&gt;                         ...................return a&lt;br /&gt;            .............end&lt;br /&gt;end&lt;br /&gt;(ignore the ... thats just so the format is preserved!)&lt;br /&gt;But I don't.&lt;br /&gt;&lt;br /&gt;Another thing about the above error is that if you go to your Lua script and edit the script so that you think you have corrected the error, many times when you save the Lua script the terminal just keeps on repeating the error making you think that it isn't fixed.  When you get the &lt;/span&gt;attempt to call a nil value error it is a good idea to issue the killall conky command.  Then restart the conkyrc.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;But before you restart,&lt;span style="font-weight: bold;"&gt; scroll back&lt;/span&gt; through the error messages&lt;/span&gt; and look at the lines just after the conkyrc was launched... this is where the terminal will tell you why it's giving the errors.  For example:&lt;br /&gt;&lt;br /&gt;mcdowall@mcdowall-desktop:~$ /home/mcdowall/.conky/conky_start&lt;br /&gt;Conky: llua_load: /home/mcdowall/lua/table.lua:176: 'end' expected (to close 'function' at line 151) near '&lt;eof&gt;'&lt;br /&gt;Conky: forked to background, pid is 16955&lt;br /&gt;mcdowall@mcdowall-desktop:~$&lt;br /&gt;Conky: desktop window (87) is root window&lt;br /&gt;Conky: window type - desktop&lt;br /&gt;Conky: drawing to created window (0x2c00001)&lt;br /&gt;Conky: drawing to double buffer&lt;br /&gt;Conky: llua_do_call: function conky_draw_shape execution failed: attempt to call a nil value&lt;br /&gt;&lt;br /&gt;and we see:&lt;br /&gt;Conky: llua_load: /home/mcdowall/lua/table.lua:176: 'end' expected (to close 'function' at line 151) near '&lt;eof&gt;&lt;br /&gt;&lt;br /&gt;eof = end of function which means that indeed there is a missing end ( 'end' expected).&lt;br /&gt;&lt;br /&gt;Go to the line in question (here it's telling us that the function which begins on line 151 should have an end on line 176) and fix the problem and try again.&lt;br /&gt;&lt;br /&gt;mcdowall@mcdowall-desktop:~$ /home/mcdowall/.conky/conky_start&lt;br /&gt;Conky: llua_load: /home/mcdowall/lua/table.lua:92: '}' expected (to close '{' at line 76) near 'in_blue'&lt;br /&gt;&lt;br /&gt;this error is because of a missing comma on line 76.&lt;br /&gt;&lt;br /&gt;So the terminal is invaluable!&lt;br /&gt;&lt;br /&gt;Sometimes the helpful part of the error gets repeated in the terminal, and usually when this happens, fixing the problem in the Lua script and saving the script are enough to get past it.&lt;/eof&gt;&lt;/eof&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7204838397570946499?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7204838397570946499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/tips-for-writing-lua-scripts-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7204838397570946499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7204838397570946499'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/tips-for-writing-lua-scripts-and.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-986487791734446228</id><published>2010-02-09T08:42:00.000-08:00</published><updated>2010-08-01T08:53:08.541-07:00</updated><title type='text'></title><content type='html'>I was reading through the crunchbanglinux&lt;a href="http://crunchbanglinux.org/forums/"&gt; forum&lt;/a&gt; and there was a thread &lt;a href="http://crunchbanglinux.org/forums/topic/6313/vector-graphics-formats-and-guitar-amp-schematics/"&gt;here&lt;/a&gt; that began as a question about vector graphics formats but went onto become a discussion of guitar amp schematics.  I looked at the linked &lt;span style="text-decoration: underline;"&gt;schematics&lt;/span&gt; and I immediately saw the potential to use the scematic, or at least part of it, for the basis of a conky setup!&lt;br /&gt;&lt;br /&gt;And here it is...&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S3GQeiNakRI/AAAAAAAAAB0/JaD_B-brE64/s1600-h/schematic+conky.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 163px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S3GQeiNakRI/AAAAAAAAAB0/JaD_B-brE64/s320/schematic+conky.png" alt="" id="BLOGGER_PHOTO_ID_5436285079466447122" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I recreated the schematic with cairo and then placed the various graphs bars and text outputs around it.  I used the conkyrc to generate the upspeed and downspeed graphs and the memory usage bar.   Everything else was made in lua.  I took alot of the code from my full screen conky setup &lt;a href="http://thepeachyblog.blogspot.com/2010/02/this-lua-conky-went-bit-further-than.html"&gt;here&lt;/a&gt;.  In the screen.lua I had already worked on formatting many of the conky object outputs, and I needed the same approach here so that I could be as faithful to the original schematic as possible.&lt;br /&gt;&lt;br /&gt;The lua script is rather long so it's probably best that I link to my crunchbang forum post that contains the code &lt;a href="http://crunchbanglinux.org/forums/post/54692/#p54692"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-986487791734446228?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/986487791734446228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-was-reading-through-crunchbanglinux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/986487791734446228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/986487791734446228'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/i-was-reading-through-crunchbanglinux.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S3GQeiNakRI/AAAAAAAAAB0/JaD_B-brE64/s72-c/schematic+conky.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7801219674914163400</id><published>2010-02-07T15:45:00.000-08:00</published><updated>2010-02-10T11:22:21.129-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S29nLslU08I/AAAAAAAAABE/pj9dMTW0sew/s1600-h/2010-02-03--1265249296_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S29nLslU08I/AAAAAAAAABE/pj9dMTW0sew/s320/2010-02-03--1265249296_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5435676725903414210" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here is an annotated copy of my screen.lua&lt;br /&gt;&lt;br /&gt;First off, this Lua uses more than 1 function.  I can still only call a single function in conky, but in that function (called conky_draw_it below) I can use other functions.&lt;br /&gt;&lt;br /&gt;This first 2 functions are simple enough, but show an important principal of using functions.  What these functions do is to add zeros to numbers.  So that percentages are always 3 digits so that when cpu usage is 5 % then 005 is displayed.  Similarly time in hours, for example, is always 2 digits so that 2am is displayed as 02.  This is important otherwise the changing number of digits will move everything around or overlap.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function addzero100(num)&lt;/span&gt;&lt;br /&gt;The (num) part is important.  This is a string that will be set later when the function is used.  Here is an example of how this function will be called "cairo_show_text (cr, (addzero100(swap)));"  As you can see the place of (num) has been taken by (swap) when the function is used.  The information stored in the string "swap" is given to the addzero100 function and is stored as "num".  Then the function operates on the information stored in "num" and returns the result in the place of (addzero100(swap)).   So if the information is "swap" was 8 (ie 8% of swap was in used) then 008 will be displayed.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if tonumber(num) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return "00" .. num&lt;/span&gt;&lt;br /&gt;So if a number can have 3 digits, but has only a 1 digit value, 2 zeros are added.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;elseif tonumber(num) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return "0" .. num&lt;/span&gt;&lt;br /&gt;Otherwise if it has a 2 digit value 1 zero is added&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return num&lt;/span&gt;&lt;br /&gt;Otherwise if it has a 3 digit value nothing is added.  The function below shold be self explanatory. :)&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function addzero10(num)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if tonumber(num) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return "0" .. num&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return num&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is another function.  I found this &lt;a href="http://www.wellho.net/resources/ex.php4?item=u108/split"&gt;here&lt;/a&gt;.  It performs a very useful function in that it takes a string and splits it up into bits and puts the bits into a table.  I'm a little hazy about how it works, but it works.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function string:split(delimiter)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local result = { }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local from  = 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local delim_from, delim_to = string.find( self, delimiter, from  )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;while delim_from do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;table.insert( result, string.sub( self, from , delim_from-1 ) )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;from  = delim_to + 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;delim_from, delim_to = string.find( self, delimiter, from  )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;table.insert( result, string.sub( self, from  ) )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;return result&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;Ok, here we get to the function that contains all the stuff that I want displayed.  This function will be using the functions above.  Note that you cant use a function until it has been written... meaning that the function you are going to use must be above the function in which you want to use it.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;function conky_draw_it()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local updates=conky_parse('${updates}')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;update_num=tonumber(updates)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if update_num &gt; 5 then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if conky_window==nil then return end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local w=conky_window.width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local h=conky_window.height&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cr=cairo_create(cs)&lt;/span&gt;&lt;br /&gt;The above sets the delay and the "canvas".&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--sets font,  font size and color&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_font_size (cr, 200);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, 1);&lt;/span&gt;&lt;br /&gt;In this case I initially wanted to use the same font, font size and color for all the text so I set that all up above.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section generates numbers only uptime ddhhmm&lt;/span&gt;&lt;br /&gt;This section takes the output of the conky object ${uptime} which would normally be, for example, "1d 3h 25m 12s" and turns it into "010325" (no seconds)&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local uptime=conky_parse("${uptime}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utdcalc=string.gsub(uptime, "[%d ]", "")&lt;/span&gt;&lt;br /&gt;string.gsub was anew Lua command for me.  The above takes the string "uptime" finds all numerical digits and spaces and replaces them with nothing... ie it deletes them.  This is what is being looked for:  "[%d ]".  %d means any digit, and when placed in [] it finds digits &lt;span style="font-weight: bold;"&gt;and&lt;/span&gt; spaces.  It would be different if the search was for "%d ".  Without the [] it is now searching for a digit followed by a space only.  The end result is 1d 3h 25m 12s -&gt; dhms.  This will be used in an if command below.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utime=string.split(uptime, "%a ")&lt;/span&gt;&lt;br /&gt;Above I'm using the string split function as defined earlier in the script.  As you can see, I am feeding the split string function 2 things... a string (uptime)  and a search object "%a ".   %a matches any letter.  I am searching for a letter followed by a space.  So it takes "1d 3h 25m 12s" and turns it into:&lt;br /&gt;1&lt;br /&gt;3&lt;br /&gt;25&lt;br /&gt;12&lt;br /&gt;so that:&lt;br /&gt;utime[1] = 1 (days)&lt;br /&gt;utime[2] = 3 (hours)&lt;br /&gt;utime[3] = 25 (minutes)&lt;br /&gt;utime[4]=  12 (seconds)&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if utdcalc=="hms" then &lt;/span&gt;&lt;br /&gt;If uptime is less than 24 hours there will be no days in the output and therefore the following will be set as strings...&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utd="00"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;uth=addzero10(utime[1])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utm=addzero10(utime[2])&lt;/span&gt;&lt;br /&gt;Also here we are using the addzero10 function, so that 3 (hours) -&gt; 03&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;else&lt;/span&gt;&lt;br /&gt;If there is a day component to uptime then "utdcalc" will not be "hms" (it will be dhms), so instead the following strings will be set.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utd=addzero10(utime[1])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;uth=addzero10(utime[2])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utm=addzero10(utime[3])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;Kernel, Down speed and Up speed uses a similar process as used for uptime; a combination of string.gsub and string.split.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section prints number only kernel information &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local kernel1=conky_parse("${kernel}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;kernel=string.gsub(kernel1, "[%a .-]", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section formats downspeed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local downspeed=conky_parse("${downspeed}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;downnum=string.gsub(downspeed, "[%a ]", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dwnspcalc=string.split(downnum, "%p")&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dwnumunit1=string.gsub(downspeed, "[%p%d]", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dwnumunit=string.gsub(dwnumunit1, "iB", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;if dwnumunit=="M" then&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dspmb=string.gsub(downnum, ".$", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dsnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;Here is a feature of the conky that I implimented later on.  math.random(5,20) generates a random number between 5 and 20 every cycle.  I used this number divided by 100 in the line below to adjust the aplha of the text cairo displays.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, dsnum);&lt;/span&gt;&lt;br /&gt;                                                     .................................................^ here is the random number string dsnum&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 784, 800);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (dspmb) .. (dwnumunit));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;dsnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, dsnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 784, 800);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(dwnspcalc[1]) .. dwnumunit));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section formats upspeed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local upspeed=conky_parse("${upspeed}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;upnum=string.gsub(upspeed, "[%a ]", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;upspcalc=string.split(upnum, "%p")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;upumunit1=string.gsub(upspeed, "[%p%d]", "")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;upumunit=string.gsub(upumunit1, "iB", "")&lt;/span&gt;&lt;br /&gt;Below is the section that formats the name of the top process, as measured by cpu usage so that only the first 4 characters of the name are displayed, as I only had space for 4 characters in the conky.  This one gave me some trouble as when you use the string:split function, the search criteria used to delineate the splits is deleted when the string is split.  But I discovered a string.gsub trick below that solved the problem.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section formats top process&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local topproc1=conky_parse("${top name 1}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;topproc=string.gsub(topproc1, "[%p]", "")&lt;/span&gt;&lt;br /&gt;First I removed all the punctuation characters.  %p matches all punctuation.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;top1=string.upper(topproc)&lt;/span&gt;&lt;br /&gt;Then I put all the text into uppercase&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;top2=string.gsub(top1, "%a", "%1-")&lt;/span&gt;&lt;br /&gt;Abpve is the gsub trick... it matches all letters (%a) and puts a hyphen (-) between them.  So that CONKY becomes C-O-N-K-Y-&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;top=string.split(top2, "%p")&lt;/span&gt;&lt;br /&gt;I was then able to split the string based on punctuation and turn the resulted split into a table.&lt;br /&gt;&lt;br /&gt;Time outputs below use Lua os.date rather than conky_parse('${time}')&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this section formats time outputs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--hours&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;hrs=os.date("%H")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--minutes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;min=os.date("%M")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;sec=os.date("%S")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--year&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;yr=os.date("%y")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--month&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;mnt=os.date("%m")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--day&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;day=os.date("%d")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Below are all the common conky outputs to parse&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--this sectiion formats common conky outputs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--cpu&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local cpunum=conky_parse("${cpu}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cpu=tonumber(cpunum)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--mem&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local memnum=conky_parse("${memperc}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;mem=tonumber(memnum)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--hdd&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local hddnum=conky_parse("${fs_used_perc /}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;hdd=tonumber(hddnum)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--swap&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local swapnum=conky_parse("${swapperc}")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;swap=tonumber(swapnum)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Below is the section that displays all of the above pieces through cairo.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--prints text&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--uptime&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;utmnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;Above is the random alpha generator in use again.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, utmnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 261, 480);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (utd .. uth .. utm))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--kernel&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;knum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, knum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 800);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (kernel))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--upspeed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;upsdnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, upsdnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 261, 320);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(upspcalc[1]) .. upumunit));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--top process&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;tpnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, tpnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 640);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (top[1]) .. (top[2]) .. (top[3]) .. (top[4]));&lt;/span&gt;&lt;br /&gt;Above is how to print the first 4 characters from the name of the top process.  In cairo a space followed by 2 periods and then another space, such as above, basically means print next to.  So that if the top process is conky,  top[1]=C, top[2]=O, top[3]=N and top[4]=K and cairo is told to display this as "CONK"&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--time hours&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;thnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, thnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 160);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (hrs));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--swapperc&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;swnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, swnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 261, 160);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(swap)));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--month&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;monnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, monnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 653, 160);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (mnt));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--cpu&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, cnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 915, 160);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(cpu)));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--time minutes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, thnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 320);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (min));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--day&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, monnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 784, 320);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (day));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--year 20&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;yrnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, yrnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 1043, 320);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, "20");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--time seconds&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, thnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 0, 480);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (sec));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--year 10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, yrnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 1043, 480);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (yr));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--hdd used&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;hdnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, hdnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 522, 640);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(hdd)));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--memory&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;mnum=(math.random(5,20))/100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, 1, 1, 1, mnum);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, 915, 640);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, (addzero100(mem)));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;ebd&lt;br /&gt;end&lt;/span&gt;&lt;br /&gt;And that is that Lua!&lt;br /&gt;For more information you can go &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-is-annotated-lua-script-for-my.html"&gt;here&lt;/a&gt; and look at another annotated script that deals with the use of a settings table and uses multiple functions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7801219674914163400?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7801219674914163400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-are-few-parts-of-my-screen-lua.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7801219674914163400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7801219674914163400'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-are-few-parts-of-my-screen-lua.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S29nLslU08I/AAAAAAAAABE/pj9dMTW0sew/s72-c/2010-02-03--1265249296_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2436593595055409202</id><published>2010-02-07T15:37:00.000-08:00</published><updated>2010-02-22T21:10:58.529-08:00</updated><title type='text'></title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_bEV68MpI_n4/S29O66wQ_cI/AAAAAAAAAA8/T9BXvI1JmhY/s1600-h/2010-02-03--1265249296_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_bEV68MpI_n4/S29O66wQ_cI/AAAAAAAAAA8/T9BXvI1JmhY/s320/2010-02-03--1265249296_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5435650049370553794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This Lua conky went a bit further than the RGB lines.&lt;br /&gt;Heres the Lua:&lt;br /&gt;EDIT - I've been wondering about the validity of some of the lines in this code.&lt;br /&gt;in particular the instances of&lt;br /&gt;&lt;br /&gt;for index,today in pairs(utime) do&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;When I was first writing the code it seemed that I couldn't get the tables working without putting this in but then I began thinking that there is nothing between the do and the end, so what exactly is it doing?  I just used the print function both before and after the line and got the same result.  Consider those lines deleted!  All part of the learning experience :)&lt;br /&gt;&lt;br /&gt;Go to my post in the crunchbanglinux website for the code &lt;a href="http://crunchbanglinux.org/forums/post/54018/#p54018"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;An annotated version of this script is &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-are-few-parts-of-my-screen-lua.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2436593595055409202?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2436593595055409202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-lua-conky-went-bit-further-than.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2436593595055409202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2436593595055409202'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-lua-conky-went-bit-further-than.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_bEV68MpI_n4/S29O66wQ_cI/AAAAAAAAAA8/T9BXvI1JmhY/s72-c/2010-02-03--1265249296_1440x900_scrot.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-7953250585124208205</id><published>2010-02-07T10:22:00.000-08:00</published><updated>2010-02-09T18:28:45.935-08:00</updated><title type='text'></title><content type='html'>Here is my line lua script again, but I'll tell you what everything means this time (at least as best as I understand it).&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;require 'cairo'&lt;/span&gt;&lt;br /&gt;This calls in the cairo library.  Cairo is the vector graphics application that will be used to display anything you want displayed.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;function&lt;/span&gt; conky_draw_lines()&lt;/span&gt;&lt;br /&gt;This is the name of my function.  In conky I call "draw_line".  This function contains everything that is going to be displayed in conky&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt; local&lt;/span&gt; updates=conky_parse('${updates}')&lt;/span&gt;&lt;br /&gt;Conky_parse is what makes the whole thing work.  Here we tell Lua to perform the conky ${updates} object.  The first "  updates"  is a string (or maybe it's technically a variable, which holds a string, but for simplicity I'm going to call it a string).   You may wonder what the "local" means, and I have to say I'm a bit hazy on the use of local as opposed to global strings (global string would be just &lt;span style="color: rgb(255, 102, 102);"&gt;updates=conky_parse('${updates}') &lt;/span&gt;) .  From the Lua documents it's to do with &lt;a href="http://www.lua.org/manual/5.1/manual.html#2.6"&gt;visibility&lt;/a&gt;.&lt;br /&gt;Lua uses strings to hold information and in this case updates holds the output of conky_parse('${updates}')&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;update_num=&lt;span style="font-weight: bold; color: rgb(102, 204, 204);"&gt;tonumber&lt;/span&gt;(updates)&lt;/span&gt;&lt;br /&gt;The (updates) is the same as the updates string from the line above.  The "tonumber" part tells Lua to read the information stored in the string "updates" and turn it into a "readable" output.  This output is stored in the update_num string.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;if&lt;/span&gt; update_num &gt; 5 &lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;then&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;This part looks at the information stored in the "update_num" string and asks if the number is greater than 5.  If it is then the lines below are performed.&lt;br /&gt;The reason for this is:&lt;br /&gt;"if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away.  Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num &gt; 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num &gt; 3; conversely if you update Conky every 0.5s, you should use update_num &gt; 10".  From londonali1010's rings Lua.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;if&lt;/span&gt; conky_window==nil &lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;then&lt;/span&gt; return &lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Not to sure why this one is needed... I would assume that if your trying to run a Lua script in conky then there will always be a conky window.  Most likely this prevents something from going wrong.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;local&lt;/span&gt; w=conky_window.width&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;local&lt;/span&gt; h=conky_window.height&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;local&lt;/span&gt; cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cr=cairo_create(cs)&lt;/span&gt;&lt;br /&gt;This section sets up the surface onto which cairo will draw.  It sets the "canvas" to the height and width of the conky window.  I just put this into my functions at the beginning.  I can't say that I fully understand all the terms :) .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);&lt;/span&gt;&lt;br /&gt;Here we are getting into the cairo drawing part of the script.  A cairo function in Lua will always start with "cairo".  Following the cairo function are the variables for that function in brackets.  The first variable is always cr.  In this line I am setting the font with which I shall be displaying text later. The cairo documentation about the options for fonts &lt;a href="http://www.cairographics.org/manual/cairo-text.html#cairo-select-font-face"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_font_size (cr, 12.0);&lt;/span&gt;&lt;br /&gt;This sets the font size to 12.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--Line 1 settings&lt;/span&gt;&lt;br /&gt;A double hyphyn -- denotes a comment in Lua.  This lets you write things into the script to designate sections and help to remind you of things.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_arg=conky_parse('${cpu}')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_thick=10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_red=1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_green=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_blue=0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_alpha=1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;local a_start=10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--line 1 settings end&lt;/span&gt;&lt;br /&gt;Here I am setting up strings that will be used below.  They will all be used to set the parameters of the lines that will be drawn.  The reason to do this is so that the settings for a function can be defined in one area instead of looking through the cairo code and trying to change parameters.  a_arg stores the information from the conky abject I'm parsing.  This info will be later read by tonumber as above.  a_thick sets line thickness,  a_red, a_green and a_blue sets the color parameters.  a_alpha sets the transparency and a_start sets where I want my line to start.&lt;br /&gt;NOTE about color - cairo uses a system of  red, green, blue to set color.  Each color is a number from 0 to 1.  Many other applications that define colors, GIMP, for example uses an RGB system that sets each color a number from 0 to 255.  I typically used GIMP to find out the numbers for my colors.  So when I take my RGB numbers I have to divide them by 255. You can do this calculation directly in the Lua script itself if you like... e.g.  a_red=100/255.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;local&lt;/span&gt; a_num=&lt;span style="font-weight: bold; color: rgb(102, 204, 204);"&gt;tonumber&lt;/span&gt;(a_arg)&lt;br /&gt;&lt;/span&gt;tonumber reads a_arg and stores the output in a_num.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--line 1 background&lt;/span&gt;&lt;br /&gt;another comment, telling me that the next section will set the background lines&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, 0.5);&lt;/span&gt;&lt;br /&gt;here you can see the strings that we defined above being placed into a cairo function, in this case we are setting the color for the background line.  the 0.5 is the alpha value I shall use for this line.  This 0.5 gives the background line a 50% transparency.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_line_width (cr, a_thick);&lt;/span&gt;&lt;br /&gt;here line width is being set via the string a_thick.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, a_start, a_start);&lt;/span&gt;&lt;br /&gt;the cairo_move_to sets the starting position for any drawing function of cairo.  In this case my start position is set by the a_start string.  The variables for the cairo_move_to are (cr, x-position, y-position).  x and y position are in pixels (x is horizontal and y is vertical).  In conky 0,0 is the top left corner of the window.  100, 100 moves 100 pixels across and 100 pixels down.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rel_line_to (cr, 100, 100);&lt;/span&gt;&lt;br /&gt;cairo_rel_line tells cairo to draw a line to the coordinates given.  The "rel" part stands for relative and means that the coordinates are plotted relative to the start position set by cairo_move_to.  cairo_line_to would draw a line starting from cairo_move_to but the end coordinates are relative to 0,0 instead.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_stroke (cr);&lt;/span&gt;&lt;br /&gt;cairo_stroke tells cairo to actually display the line that we have defined above.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--line 1 indicator&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, a_alpha);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_line_width (cr, a_thick);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, a_start, a_thick);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rel_line_to (cr, a_num, a_num);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_stroke (cr);&lt;/span&gt;&lt;br /&gt;This sets up the "indicator" line.  Unlike the background line, which always has a set length, the length of the "indicator" line is set by the string a_num (which holds the output of the conky object ${cpu}).  Therefore this line is directly proportional to current cpu usage and as max cpu usage is 100%, at 100% the indicator line will completely cover the background line.  The string  a_alpha is also used to define the transparecy of the indicator line.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;--line 1 title&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, a_alpha);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_move_to (cr, a_start+a_thick, a_thick);&lt;/span&gt;&lt;br /&gt;Above we set the color and start position for the title text for the line.  To get the position right there is a calculation to set the x coordinate "a_start+a_thick".&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, 45*math.pi/180)&lt;/span&gt;&lt;br /&gt;This is one of the avaialble transformations in cairo.  The rotate function in cairo works on radians (who knows why degrees aren't the unit of choice, but I guess there is a reason.)  Anyway the calculation "45*math.pi/180" converts 45 degrees to radians.  The "math." part tells Lua to read pi as the number pi.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_show_text (cr, "CPU");&lt;/span&gt;&lt;br /&gt;This part tells cairo to display the text "CPU" and due to the above rotation function, the text is rotated 45 degrees clockwise, to sit along side the indicator bar.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;cairo_rotate (cr, -45*math.pi/180)&lt;/span&gt;&lt;br /&gt;this part is important if anything else is coming in the function (such as subsequent bars).  Transformation functions in cairo are relative, in that everything below the above "rotate" command will be rotated.  So in this line we rotate cairo's "reference" back to normal.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;This first end closes the &lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;if&lt;/span&gt; update_num &gt; 5 &lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;then &lt;/span&gt;&lt;/span&gt;from the beginning of the function&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;end&lt;/span&gt;&lt;br /&gt;This second end closes the function.  I am always getting tripped up by having either too few or too many ends.&lt;br /&gt;&lt;br /&gt;And that's it!  You have yourself a function. &lt;a href="http://thepeachyblog.blogspot.com/2010/02/tips-for-writing-lua-scripts-and.html"&gt;Here&lt;/a&gt; are a few basic tips that help me work with Lua and conky.  And you can go &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-are-few-parts-of-my-screen-lua.html"&gt;here&lt;/a&gt; and take a look at a more complicated script that I have annotated.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-7953250585124208205?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/7953250585124208205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-my-line-lua-script-again-but.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7953250585124208205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/7953250585124208205'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/here-is-my-line-lua-script-again-but.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-2320131224653312589</id><published>2010-02-07T09:52:00.000-08:00</published><updated>2010-02-07T11:50:55.444-08:00</updated><title type='text'></title><content type='html'>Getting started with Lua and Cairo.&lt;br /&gt;&lt;br /&gt;I have no programming background, and hadn't written a single script before a couple of months ago when I installed crunchbang linux on my computer.  I began writing simple shell script in bash to get some things working in conky (using the exec and execi conky functions).   Mostly my scripts were just if x=y then z elif etc etc etc.  I also learnt  how to use sed grep and awk functions which proved very useful for a number of aplications such as &lt;a href="http://crunchbanglinux.org/forums/post/51330/#p51330"&gt;here&lt;/a&gt;.  This conky takes the html code from a page in the crunchbanglinux site and extracts the information, displaying the active topics on the forum in conky.&lt;br /&gt;&lt;br /&gt;Calling scripts in conky with execpi is fine, except that if you need to call the script every second or so, cpu usage gets too high to justify.&lt;br /&gt;&lt;br /&gt;So the solution is Lua scripts and Cairo.  All the functions of conky plus the ability to perform calculations and complex functions in the same place while minimising cpu usage.&lt;br /&gt;&lt;br /&gt;But, it was certainly a daunting prospect and at first, looking at some of the Lua scripts I had come across,  it seemed like too big of an undertaking.  But then I just decided that I would have have a go anyway!&lt;br /&gt;&lt;br /&gt;So I turned to google with such inquiries as "How to get started with lua cairo".&lt;br /&gt;One of the first pages I came to was &lt;a href="http://blog.conky.be/2009/09/28/lua-cairo-bindings-getting-started/"&gt;this&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Th advice by londonali1010 on that page was very helpful.  In particular this:&lt;br /&gt;"The easiest way to start is to modify someone else's work, just to get used to the syntax. Just find a script you like and start tweaking. Maybe change colours or shapes, placement of objects, or combine elements from different scripts."&lt;br /&gt;&lt;br /&gt;I took this advice and downloaded the &lt;a href="http://conky.linux-hardcore.com/?page_id=2800"&gt;rings lua script.&lt;/a&gt;  And I looked through it.  In conjunction to this I read through the &lt;a href="http://cairographics.org/tutorial/"&gt;Cairo tutorial.  &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I managed to decipher some of the Lua script and applied the parts I understood to a script myself.  This is what I came up with...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S28EGd3HbhI/AAAAAAAAAAc/1R5q-oP1m18/s1600-h/lua+with+text.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 294px; height: 168px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S28EGd3HbhI/AAAAAAAAAAc/1R5q-oP1m18/s320/lua+with+text.png" alt="" id="BLOGGER_PHOTO_ID_5435567784401006098" border="0" /&gt;&lt;/a&gt;and heres the script below: for simplicity I have only included 1 bar.&lt;br /&gt;&lt;br /&gt;bars.lua&lt;br /&gt;require 'cairo'&lt;br /&gt;function conky_draw_lines()&lt;br /&gt;local updates=conky_parse('${updates}')&lt;br /&gt;update_num=tonumber(updates)&lt;br /&gt;if update_num &gt; 5 then&lt;br /&gt;if conky_window==nil then return end&lt;br /&gt;local w=conky_window.width&lt;br /&gt;local h=conky_window.height&lt;br /&gt;local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;br /&gt;cr=cairo_create(cs)&lt;br /&gt;cairo_select_font_face (cr, "White Rabbit", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);&lt;br /&gt;cairo_set_font_size (cr, 12.0);&lt;br /&gt;&lt;br /&gt;--Line 1 settings&lt;br /&gt;local a_arg=conky_parse('${cpu}')&lt;br /&gt;local a_thick=10&lt;br /&gt;local a_red=1&lt;br /&gt;local a_green=0&lt;br /&gt;local a_blue=0&lt;br /&gt;local a_alpha=1&lt;br /&gt;local a_start=10&lt;br /&gt;--line 1 settings end&lt;br /&gt;local a_num=tonumber(a_arg)&lt;br /&gt;--line 1 background&lt;br /&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, 0.5);&lt;br /&gt;cairo_set_line_width (cr, a_thick);&lt;br /&gt;cairo_move_to (cr, a_start, a_start);&lt;br /&gt;cairo_rel_line_to (cr, 100, 100);&lt;br /&gt;cairo_stroke (cr);&lt;br /&gt;--line 1 indicator&lt;br /&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, a_alpha);&lt;br /&gt;cairo_set_line_width (cr, a_thick);&lt;br /&gt;cairo_move_to (cr, a_start, a_thick);&lt;br /&gt;cairo_rel_line_to (cr, a_num, a_num);&lt;br /&gt;cairo_stroke (cr);&lt;br /&gt;--line 1 title&lt;br /&gt;cairo_set_source_rgba (cr, a_red, a_green, a_blue, a_alpha);&lt;br /&gt;cairo_move_to (cr, a_start+a_thick, a_thick);&lt;br /&gt;cairo_rotate (cr, 45*math.pi/180)&lt;br /&gt;cairo_show_text (cr, "CPU");&lt;br /&gt;cairo_rotate (cr, -45*math.pi/180)&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;My first Lua Cairo thing.  Go &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-is-my-line-lua-script-again-but.html"&gt;here&lt;/a&gt; and I'll talk you through it line by line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-2320131224653312589?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/2320131224653312589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/getting-started-with-lua-and-cairo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2320131224653312589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/2320131224653312589'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/getting-started-with-lua-and-cairo.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_bEV68MpI_n4/S28EGd3HbhI/AAAAAAAAAAc/1R5q-oP1m18/s72-c/lua+with+text.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-5293019088437345500</id><published>2010-02-06T21:28:00.000-08:00</published><updated>2010-02-06T21:51:35.551-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conkyrc_flower'/><title type='text'></title><content type='html'>conkyrc_flower&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;##############################################&lt;br /&gt;#  Settings&lt;br /&gt;##############################################&lt;br /&gt;max_specials 10000&lt;br /&gt;max_user_text 150000&lt;br /&gt;background yes&lt;br /&gt;use_xft yes&lt;br /&gt;xftfont mono:size=12&lt;br /&gt;xftalpha 1&lt;br /&gt;update_interval 1&lt;br /&gt;total_run_times 0&lt;br /&gt;own_window yes&lt;br /&gt;own_window_transparent yes&lt;br /&gt;own_window_type desktop&lt;br /&gt;own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager&lt;br /&gt;double_buffer yes&lt;br /&gt;minimum_size 600, 640&lt;br /&gt;maximum_width 600&lt;br /&gt;draw_shades no&lt;br /&gt;draw_outline no&lt;br /&gt;draw_borders no&lt;br /&gt;draw_graph_borders yes&lt;br /&gt;default_color white&lt;br /&gt;default_shade_color black&lt;br /&gt;default_outline_color white&lt;br /&gt;alignment top_right&lt;br /&gt;gap_x 10&lt;br /&gt;gap_y 40&lt;br /&gt;no_buffers yes&lt;br /&gt;uppercase no&lt;br /&gt;cpu_avg_samples 2&lt;br /&gt;override_utf8_locale yes&lt;br /&gt;default_color 000000&lt;br /&gt;color1 735046&lt;br /&gt;&lt;br /&gt;lua_load /home/mcdowall/lua/flower.lua&lt;br /&gt;lua_draw_hook_pre draw_flower&lt;br /&gt;&lt;br /&gt;TEXT&lt;br /&gt;${goto 239}${voffset 270}${font clockfaces:size=90}Q&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I found that i had to have this empty space in the conky rc so that the lua graphics would all be displayed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-5293019088437345500?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/5293019088437345500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/conkyrcflower-settings-maxspecials.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5293019088437345500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/5293019088437345500'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/conkyrcflower-settings-maxspecials.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-8220379314156408336</id><published>2010-02-06T21:23:00.000-08:00</published><updated>2010-02-22T21:13:54.692-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flower.lua'/><title type='text'></title><content type='html'>flower.lua&lt;br /&gt;--[[valentine flowers by mrpeachy (2010)]]&lt;br /&gt;require 'cairo'&lt;br /&gt;function string:split(delimiter)&lt;br /&gt;local result = { }&lt;br /&gt;local from  = 1&lt;br /&gt;local delim_from, delim_to = string.find( self, delimiter, from  )&lt;br /&gt;while delim_from do&lt;br /&gt;table.insert( result, string.sub( self, from , delim_from-1 ) )&lt;br /&gt;from  = delim_to + 1&lt;br /&gt;delim_from, delim_to = string.find( self, delimiter, from  )&lt;br /&gt;end&lt;br /&gt;table.insert( result, string.sub( self, from  ) )&lt;br /&gt;return result&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;function circlewriting(text, char, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, variable)&lt;br /&gt;local textcut=string.gsub(text, ".", "%1@@@")&lt;br /&gt;texttable=string.split(textcut, "@@@")&lt;br /&gt;for i=1,char do&lt;br /&gt;--calculations&lt;br /&gt;deg=360/((char-1)*2)&lt;br /&gt;text_arc=(2*math.pi/((char-1)*2)*(i)+variable)&lt;br /&gt;txs=1+radi*(math.sin(text_arc))&lt;br /&gt;tys=1-radi*(math.cos(text_arc))&lt;br /&gt;--print (deg)&lt;br /&gt;cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);&lt;br /&gt;cairo_set_font_size (cr, fsize);&lt;br /&gt;cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);&lt;br /&gt;cairo_move_to (cr, txs+horiz, tys+verti);&lt;br /&gt;cairo_rotate (cr, ((270+(deg*(i-1)))*math.pi/180))&lt;br /&gt;cairo_show_text (cr, (texttable[i]))&lt;br /&gt;cairo_rotate (cr, ((-270-(deg*(i-1)))*math.pi/180))&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;function conky_draw_flower()&lt;br /&gt;local updates=conky_parse('${updates}')&lt;br /&gt;update_num=tonumber(updates)&lt;br /&gt;if update_num &gt; 5 then&lt;br /&gt;if conky_window==nil then return end&lt;br /&gt;local w=conky_window.width&lt;br /&gt;local h=conky_window.height&lt;br /&gt;local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)&lt;br /&gt;cr=cairo_create(cs)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--FLOWER 1----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 1&lt;br /&gt;--color&lt;br /&gt;f1r=1&lt;br /&gt;f1g=0&lt;br /&gt;f1b=0&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 0.5, 0.5)&lt;br /&gt;--position&lt;br /&gt;cairo_translate (cr, 500, 250)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f1r, f1g, f1b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl1num=conky_parse('${cpu}')&lt;br /&gt;fl1=tonumber(fl1num)&lt;br /&gt;circrad=(fl1*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, 1, 0, 0, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--FLOWER 2----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 2&lt;br /&gt;--color&lt;br /&gt;f2r=0&lt;br /&gt;f2g=1&lt;br /&gt;f2b=1&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 1, 1)&lt;br /&gt;--position across then up (translate is relative to last translate position)&lt;br /&gt;cairo_translate (cr, 350, 200)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f2r, f2g, f2b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl2num=conky_parse('${memperc}')&lt;br /&gt;fl2=tonumber(fl2num)&lt;br /&gt;circrad=(fl2*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f2r, f2g, f2b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--FLOWER 3----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 3&lt;br /&gt;--color&lt;br /&gt;f3r=0.6&lt;br /&gt;f3g=0.0&lt;br /&gt;f3b=1&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 1, 1)&lt;br /&gt;--position across then up (translate is relative to last translate position)&lt;br /&gt;cairo_translate (cr, -700, 0)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f3r, f3g, f3b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl3num=conky_parse('${fs_used_perc /}')&lt;br /&gt;fl3=tonumber(fl3num)&lt;br /&gt;circrad=(fl3*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f3r, f3g, f3b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--FLOWER 4----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 4&lt;br /&gt;--color&lt;br /&gt;f4r=1&lt;br /&gt;f4g=0&lt;br /&gt;f4b=1&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 1, 1)&lt;br /&gt;--position across then up (translate is relative to last translate position)&lt;br /&gt;cairo_translate (cr, 0, 400)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f4r, f4g, f4b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl4num=conky_parse('${swapperc}')&lt;br /&gt;fl4=tonumber(fl4num)&lt;br /&gt;circrad=(fl4*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f4r, f4g, f4b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--FLOWER 5----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 5&lt;br /&gt;--color&lt;br /&gt;f5r=1&lt;br /&gt;f5g=1&lt;br /&gt;f5b=0&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 1, 1)&lt;br /&gt;--position across then up (translate is relative to last translate position)&lt;br /&gt;cairo_translate (cr, 350, 200)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f5r, f5g, f5b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl5num=conky_parse('${cpu}')&lt;br /&gt;fl5=tonumber(fl5num)&lt;br /&gt;circrad=(fl5*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f5r, f5g, f5b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--FLOWER 6----------------------------------------------------------------------------&lt;br /&gt;--FLOWER 6&lt;br /&gt;--color&lt;br /&gt;f6r=1&lt;br /&gt;f6g=.5&lt;br /&gt;f6b=0&lt;br /&gt;--size&lt;br /&gt;cairo_scale (cr, 1, 1)&lt;br /&gt;--position across then up (translate is relative to last translate position)&lt;br /&gt;cairo_translate (cr, 350, -200)&lt;br /&gt;--draw background circle&lt;br /&gt;circrad=200&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f6r, f6g, f6b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw indicator circle&lt;br /&gt;local fl6num=conky_parse('${cpu}')&lt;br /&gt;fl6=tonumber(fl6num)&lt;br /&gt;circrad=(fl5*1.5)+50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_source_rgba (cr, f6r, f6g, f6b, .5);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--flower shape&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 200, 173, 200, 173);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 187, 50, 187, 50);&lt;br /&gt;cairo_curve_to (cr, 230, 75, 300, 0, 300, 0);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 187, -50, 187, -50);&lt;br /&gt;cairo_curve_to (cr, 230, -75, 200, -173, 200, -173);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 100, -100, 100, -100);&lt;br /&gt;cairo_curve_to (cr, 100, -150, 0, -173, 0, -173);&lt;br /&gt;cairo_curve_to (cr, -30, -75, 13, -50, 13, -50);&lt;br /&gt;cairo_curve_to (cr, -30, -75, -100, 0, -100, 0);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 13, 50, 13, 50);&lt;br /&gt;cairo_curve_to (cr, -30, 75, 0, 173, 0, 173);&lt;br /&gt;cairo_curve_to (cr, 100, 150, 100, 100, 100, 100);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;--draw circle&lt;br /&gt;circrad=205&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_new_sub_path (cr); cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_new_sub_path (cr); cairo_close_path(cr)&lt;br /&gt;--fill&lt;br /&gt;cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);&lt;br /&gt;cairo_set_source_rgba (cr, 0, 0, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;--draw center circle&lt;br /&gt;circrad=50&lt;br /&gt;circx=100&lt;br /&gt;circy=0&lt;br /&gt;cairo_move_to (cr, 100, 100);&lt;br /&gt;cairo_arc(cr,circx,circy,circrad,0,2*math.pi)&lt;br /&gt;cairo_close_path(cr)&lt;br /&gt;cairo_set_source_rgba (cr, 1, 1, 0, 1);&lt;br /&gt;cairo_fill (cr);&lt;br /&gt;&lt;br /&gt;-----description of variables for circlewriting function&lt;br /&gt;--eg circlewriting(A, B, C, D, E, F, G, H, I, J, K, L)&lt;br /&gt;--A = text to be written, place straight text in quotes.&lt;br /&gt;--B = total number of characters, including spaces and punctuation&lt;br /&gt;--C = font, place font in quotes&lt;br /&gt;--D = font size&lt;br /&gt;--E = radius of the circle&lt;br /&gt;--F = horizontal position&lt;br /&gt;--G = vertical position&lt;br /&gt;--H = color red&lt;br /&gt;--I = color green&lt;br /&gt;--J = color blue&lt;br /&gt;--K = a variable to get the text lined up.  I havn't quite figured out how this number is generated!&lt;br /&gt;--but without it the text will no line up correctly.  For text along top of circle this number is -ve&lt;br /&gt;--start at about half of B, increasing negative moves text counter clockwise&lt;br /&gt;--circlewriting("TEXT TEXT TEXT", 14, "Mono", 18, 100, 150, 150, 1, 1, 1, 1, -8.16)&lt;br /&gt;&lt;br /&gt;--FLOWER 1 TITLE&lt;br /&gt;cairo_translate (cr, -260, -590)&lt;br /&gt;test=circlewriting("PROCESSOR", 9, "White Rabbit", 30, 205, 7, -10, f1r, f1g, f1b, 0.8, -2)&lt;br /&gt;--FLOWER 2 TITLE&lt;br /&gt;cairo_translate (cr, 348, 200)&lt;br /&gt;test=circlewriting("MEMORY", 6, "White Rabbit", 30, 205, 9, -10, f2r, f2g, f2b, 0.8, -2.24)&lt;br /&gt;--FLOWER 3 TITLE&lt;br /&gt;cairo_translate (cr, -698, 0)&lt;br /&gt;test=circlewriting("FILESYSTEM USED", 15, "White Rabbit", 30, 205, 7, -10, f3r, f3g, f3b, 0.8, -8.12)&lt;br /&gt;--FLOWER 4 TITLE&lt;br /&gt;cairo_translate (cr, 0, 400)&lt;br /&gt;test=circlewriting("SWAP PARTITION", 14, "White Rabbit", 30, 205, 7, -11, f4r, f4g, f4b, 0.8, -8.13)&lt;br /&gt;--FLOWER 5 TITLE&lt;br /&gt;cairo_translate (cr, 350, 200)&lt;br /&gt;test=circlewriting("BATTERY", 7, "White Rabbit", 30, 205, 7, -10, f5r, f5g, f5b, 0.8, -8.41)&lt;br /&gt;--FLOWER 6 TITLE&lt;br /&gt;cairo_translate (cr, 350, -200)&lt;br /&gt;test=circlewriting("CONNECTION", 10, "White Rabbit", 30, 205, 7, -10, f6r, f6g, f6b, 0.8, -8.25)&lt;br /&gt;--draw center clock heart&lt;br /&gt;scale=1.75&lt;br /&gt;cairo_set_source_rgba (cr, 255/255, 100/255, 130/255, 1)&lt;br /&gt;cairo_translate (cr, -690, -570)&lt;br /&gt;cairo_move_to (cr, 200*scale, 150*scale);&lt;br /&gt;cairo_curve_to (cr, 210*scale, 90*scale, 290*scale, 90*scale, 300*scale, 150*scale);&lt;br /&gt;cairo_curve_to (cr, 300*scale, 150*scale, 320*scale, 250*scale, 200*scale, 300*scale);&lt;br /&gt;cairo_curve_to (cr, 200*scale, 300*scale, 80*scale, 250*scale, 100*scale, 150*scale);&lt;br /&gt;cairo_curve_to (cr, 110*scale, 90*scale, 190*scale, 90*scale, 200*scale, 150*scale);&lt;br /&gt;cairo_close_path (cr);&lt;br /&gt;cairo_fill (cr)&lt;br /&gt;&lt;br /&gt;--clock&lt;br /&gt;local clock_r=85&lt;br /&gt;local xc=350&lt;br /&gt;local yc=390&lt;br /&gt;shadow_width=5&lt;br /&gt;shadow_xoffset=0&lt;br /&gt;shadow_yoffset=2&lt;br /&gt;show_seconds=true&lt;br /&gt;-- Grab time&lt;br /&gt;local hours=os.date("%I")&lt;br /&gt;local mins=os.date("%M")&lt;br /&gt;local secs=os.date("%S")  &lt;br /&gt;secs_arc=(2*math.pi/60)*secs&lt;br /&gt;mins_arc=(2*math.pi/60)*mins&lt;br /&gt;hours_arc=(2*math.pi/12)*hours+mins_arc/12&lt;br /&gt;&lt;br /&gt;-- Draw hour hand&lt;br /&gt;xh=xc+0.7*clock_r*math.sin(hours_arc)&lt;br /&gt;yh=yc-0.7*clock_r*math.cos(hours_arc)&lt;br /&gt;cairo_move_to(cr,xc,yc)&lt;br /&gt;cairo_line_to(cr,xh,yh)&lt;br /&gt; &lt;br /&gt;cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)&lt;br /&gt;cairo_set_line_width(cr,5)&lt;br /&gt;cairo_set_source_rgba(cr,0,0,0,0.5)&lt;br /&gt;cairo_stroke(cr)&lt;br /&gt; &lt;br /&gt;-- Draw minute hand&lt;br /&gt;xm=xc+0.9*clock_r*math.sin(mins_arc)&lt;br /&gt;ym=yc-0.9*clock_r*math.cos(mins_arc)&lt;br /&gt;cairo_move_to(cr,xc,yc)&lt;br /&gt;cairo_line_to(cr,xm,ym)&lt;br /&gt; &lt;br /&gt;cairo_set_line_width(cr,3)&lt;br /&gt;cairo_stroke(cr)&lt;br /&gt; &lt;br /&gt;-- Draw seconds hand&lt;br /&gt;if show_seconds then&lt;br /&gt;xs=xc+0.9*clock_r*math.sin(secs_arc)&lt;br /&gt;ys=yc-0.9*clock_r*math.cos(secs_arc)&lt;br /&gt;cairo_move_to(cr,xc,yc)&lt;br /&gt;cairo_line_to(cr,xs,ys)&lt;br /&gt; &lt;br /&gt;cairo_set_line_width(cr,1)&lt;br /&gt;cairo_stroke(cr)&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-8220379314156408336?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/8220379314156408336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/flower.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8220379314156408336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/8220379314156408336'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/flower.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-456388347137284126.post-3525891587940730509</id><published>2010-02-06T21:16:00.000-08:00</published><updated>2010-02-22T10:00:33.231-08:00</updated><title type='text'></title><content type='html'>This blog is a place to refer to regarding conky and lua setups that I have been working on.&lt;br /&gt;&lt;br /&gt;Here is an alternative version of my flower conky.  Read my blog post &lt;a href="http://thepeachyblog.blogspot.com/2010/02/conky-flowers-revisited.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LGL0AYcKI/AAAAAAAAAF8/WYLsulcRsjA/s1600-h/2010-02-22--1266861418_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S4LGL0AYcKI/AAAAAAAAAF8/WYLsulcRsjA/s320/2010-02-22--1266861418_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5441129206058086562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a conky setup, inspired by the Conky of the Month competition on the Conky Blog &lt;a href="http://blog.conky.be/"&gt;here.&lt;/a&gt;   I'm not sure about the pink heart...  Plus I "cheated" a little as I am actually using a desktop computer with a wired internet connection.  That is why the "BATTERY" and "CONNECTION" flowers seem to be non functional ("SWAP" really is 0% which is why that flower doesn't show anything).  The code however works just fine when run on a setup that has such things.  I just needed 6 conky outputs for the 6 flowers, since I only have the one processor and the one filesystem partition :)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_bEV68MpI_n4/S25NpZjKtnI/AAAAAAAAAAM/WzcN2dRNaKg/s1600-h/2010-02-06--1265514952_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_bEV68MpI_n4/S25NpZjKtnI/AAAAAAAAAAM/WzcN2dRNaKg/s320/2010-02-06--1265514952_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5435367173911131762" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This conky was created almost exclusively through a lua script and it is by far the most complicated script i have written to date.   I am particularly pleased with the circle writing function I came up with. &lt;a href="http://thepeachyblog.blogspot.com/2010/02/flower.html"&gt;Here&lt;/a&gt; is the lua script.&lt;br /&gt;In the conky rc you need &lt;a href="http://thepeachyblog.blogspot.com/2010/02/conkyrcflower-settings-maxspecials.html"&gt;this. &lt;/a&gt;&lt;br /&gt;I set up the clock face in the conkyrc.&lt;br /&gt;&lt;br /&gt;This isn't my first attempt at a valentines conky :)&lt;br /&gt;This one has an animated border of hearts.  But after I finished the border I wasn't sure what to do with the middle... which ended up going all "goth" on me!&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_bEV68MpI_n4/S25WPkl3-iI/AAAAAAAAAAU/nC2HZyjFlo4/s1600-h/valentineconky.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 278px;" src="http://2.bp.blogspot.com/_bEV68MpI_n4/S25WPkl3-iI/AAAAAAAAAAU/nC2HZyjFlo4/s320/valentineconky.png" alt="" id="BLOGGER_PHOTO_ID_5435376625803328034" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;You can see the details &lt;a href="http://crunchbanglinux.org/forums/post/54141/#p54141"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The next thing I need to learn about Lua is how to get multiple graphics from a single instance of a function through the use of a settings table.   I think I'm most of the way there in understanding how this is done, but I haven't tried it yet.&lt;br /&gt;&lt;br /&gt;I would also like to direct your attention to the crunchbanglinux forum.&lt;br /&gt;It was through crunchbang that I first started using conky and you can see, through the conky config thread, how I have developed my ideas and knowledge.  You can go to the crunchbanglinux website &lt;a href="http://crunchbanglinux.org/"&gt;here&lt;/a&gt; and the conky config thread &lt;a href="http://crunchbanglinux.org/forums/topic/59/my-conky-config/"&gt;here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My first conky post is on page 25 &lt;a href="http://crunchbanglinux.org/forums/post/44887/#p44887"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And I have the honor of having one of my conky setups on &lt;a href="http://conky.linux-hardcore.com/"&gt;conky hardcore&lt;/a&gt; &lt;a href="http://conky.linux-hardcore.com/?page_id=3784"&gt;here&lt;/a&gt;. :)&lt;br /&gt;&lt;br /&gt;And &lt;a href="http://thepeachyblog.blogspot.com/2010/02/getting-started-with-lua-and-cairo.html"&gt;here&lt;/a&gt; and &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-is-my-line-lua-script-again-but.html"&gt;here&lt;/a&gt; is a short tutorial I have written on getting started with Lua.  This tutorial goes through how I wrote my first Lua cairo script for this conky.&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S29NS2GyGTI/AAAAAAAAAAs/hwGK7qPmX3Q/s1600-h/lua+with+text.png"&gt;&lt;img style="cursor: pointer; width: 294px; height: 168px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S29NS2GyGTI/AAAAAAAAAAs/hwGK7qPmX3Q/s320/lua+with+text.png" alt="" id="BLOGGER_PHOTO_ID_5435648261416425778" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Another Lua cairo conky I made is &lt;a href="http://thepeachyblog.blogspot.com/2010/02/this-lua-conky-went-bit-further-than.html"&gt;&lt;span style="text-decoration: underline;"&gt;here&lt;/span&gt;&lt;/a&gt;.    And produces this conky.   I have annotated the Lua script for this conky &lt;a href="http://thepeachyblog.blogspot.com/2010/02/here-are-few-parts-of-my-screen-lua.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_bEV68MpI_n4/S29Nv_IqqeI/AAAAAAAAAA0/XngofpDSjhg/s1600-h/2010-02-03--1265249296_1440x900_scrot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_bEV68MpI_n4/S29Nv_IqqeI/AAAAAAAAAA0/XngofpDSjhg/s320/2010-02-03--1265249296_1440x900_scrot.png" alt="" id="BLOGGER_PHOTO_ID_5435648762056452578" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/456388347137284126-3525891587940730509?l=thepeachyblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thepeachyblog.blogspot.com/feeds/3525891587940730509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-blog-is-place-to-refer-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/3525891587940730509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/456388347137284126/posts/default/3525891587940730509'/><link rel='alternate' type='text/html' href='http://thepeachyblog.blogspot.com/2010/02/this-blog-is-place-to-refer-to.html' title=''/><author><name>mrpeachy</name><uri>http://www.blogger.com/profile/10876689355976519597</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_bEV68MpI_n4/S4LGL0AYcKI/AAAAAAAAAF8/WYLsulcRsjA/s72-c/2010-02-22--1266861418_1440x900_scrot.png' height='72' width='72'/><thr:total>2</thr:total></entry></feed>
