<?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-3213850822469958395</id><updated>2012-02-05T00:53:18.836-08:00</updated><category term='imlib'/><category term='calendar'/><category term='conky'/><category term='bash script'/><category term='python'/><category term='deviantart'/><category term='smiley'/><category term='openbox'/><category term='cairo'/><category term='lua'/><category term='widget'/><category term='ring'/><category term='scripts'/><category term='memory leaks'/><category term='bargraph'/><category term='equalizer'/><category term='audio spectrum'/><title type='text'>Useful and useless scripts</title><subtitle type='html'>Some of my scripts for daily use on a linux desktop</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>wlourf</name><uri>http://www.blogger.com/profile/06479004851003967010</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>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-3078278462449391311</id><published>2011-02-18T14:25:00.000-08:00</published><updated>2011-02-18T15:09:47.179-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>HowTo run multiple Lua scripts in a Conky</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Here is a little HOWTO for running more than one Lua script at the same time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;1. Method for two scripts with Conky objects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This can be done for two scripts with the two functions of Conky : &lt;code&gt;lua_draw_hook_pre&lt;/code&gt; and &lt;code&gt;lua_draw_hook_post&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;lua_load /home/wlourf/lua/scriptA.lua&lt;br /&gt;lua_draw_hook_pre functionA&lt;br /&gt;&lt;br /&gt;lua_load /home/wlourf/lua/scriptB.lua&lt;br /&gt;lua_draw_hook_post functionB&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;lua_draw_hook_pre&lt;/code&gt; is called before Conky parse the TEXT section and &lt;code&gt;lua_draw_hook_post&lt;/code&gt; is called after the Conky parse the TEXT section. So effects are not very nice because the two calls are not synchronized.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2. Method with a Lua script for 2 or more scripts&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, here is an example for 2 scripts, but you can modify it for three, four ... scripts  :&lt;br /&gt;Save the two scripts (&lt;code&gt;scriptA.lua&lt;/code&gt; with &lt;code&gt;conky_functionA()&lt;/code&gt; and &lt;code&gt;scriptB.lua&lt;/code&gt; with &lt;code&gt;conky_functionB()&lt;/code&gt; in the same folder : &lt;code&gt;/home/wlourf/multi/&lt;/code&gt; for my example :&lt;br /&gt;Create a third script &lt;code&gt;loadAll.lua&lt;/code&gt;, and paste that :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;package.path = "/home/wlourf/multi/?.lua"&lt;br /&gt;require 'scriptA' --for scriptA.lua ".lua" is not required here&lt;br /&gt;require 'scriptB'&lt;br /&gt;&lt;br /&gt;function conky_main()&lt;br /&gt;     conky_functionA()&lt;br /&gt;     conky_functionB()&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and in the conkyrc, call the &lt;code&gt;conky_main&lt;/code&gt; function with &lt;code&gt;lua_draw_hook_pre&lt;/code&gt; or &lt;code&gt;lua_draw_hook_post&lt;/code&gt;, like this :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3. With some variables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, sometimes, we need to use the same parameters in more than one script (colours, x and y position ...). So we have to write them in the conky_main() function so they can be used in the functions &lt;code&gt;conky_functionA()&lt;/code&gt; and &lt;code&gt;conky_functionB()&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To avoid &lt;a href="http://u-scripts.blogspot.com/2011/01/memory-leaks-in-conkyluacairo.html"&gt;memory leaks&lt;/a&gt;, we have to declare the variables in &lt;code&gt;local&lt;/code&gt;, so these variables will be available only for the conky_main() function, then we have to "pass" them to the functions, like that :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function conky_main()&lt;br /&gt;    local varX = 25&lt;br /&gt;    local varY = 50&lt;br /&gt;    conky_functionA(varX,varY)&lt;br /&gt;    conky_functionB(varX,varY)&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and in the functions :&lt;br /&gt;&lt;pre&gt;function conky_functionA(varX,varY)&lt;br /&gt;table_config ={...,&lt;br /&gt;     x=varX,&lt;br /&gt;     y=varY,..&lt;br /&gt;}&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ok, passing functions from the &lt;code&gt;conky_main()&lt;/code&gt; function to other functions can be boring when we have a lot of parameters. The easiest way to pass the parameters is to group them into a table and to pass the table :&lt;br /&gt;&lt;pre&gt;function conky_main()&lt;br /&gt;    local table_param={&lt;br /&gt;        varX = 25,&lt;br /&gt;        varY = 50&lt;br /&gt;    }&lt;br /&gt;    conky_functionA(table_param)&lt;br /&gt;    conky_functionB(table_param)&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and in the functions :&lt;br /&gt;&lt;pre&gt;function conky_functionA(t)&lt;br /&gt;table_config ={...,&lt;br /&gt;    x=t.varX, &lt;br /&gt;    y=t.varY, ...&lt;br /&gt;}&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;t.varX&lt;/code&gt; is the variable &lt;code&gt;varX&lt;/code&gt; from the table &lt;code&gt;t&lt;/code&gt;, it can be written &lt;code&gt;t.["varX"]&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That's all. I hope this little HowTo will help you to use multiple Lua scripts. This is my own way to manage multiple scripts, it can be done with others methods &lt;code&gt;dofile&lt;/code&gt;, &lt;code&gt;loadfile&lt;/code&gt; or instances !&lt;br /&gt;&lt;br /&gt;Happy Conkying ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-3078278462449391311?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/3078278462449391311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2011/02/howto-run-multiple-lua-scripts-in-conky.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3078278462449391311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3078278462449391311'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2011/02/howto-run-multiple-lua-scripts-in-conky.html' title='HowTo run multiple Lua scripts in a Conky'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-3594093971396710481</id><published>2011-01-27T13:15:00.000-08:00</published><updated>2011-01-30T09:35:57.524-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Box widget</title><content type='html'>Back to basics with Lua and Cairo! This widget draws only a customizable box. It is inspired from Londonali's Background script.&lt;br /&gt;&lt;br /&gt;The script can be downloaded on deviantArt : &lt;a target="_new" href="http://wlourf.deviantart.com/art/Box-widget-for-conky-1-1-195130450"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As usual, the widget uses a table to get the parameters : &lt;code&gt;boxes_settings&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The minimum setup is an empty table :&lt;br /&gt;&lt;pre&gt;local boxes_settings={&lt;br /&gt; {},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This one draws a box with the default parameters : same size of the conky window, white background with opacity set to 50 %.&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQbZgdBdI/AAAAAAAAAqI/o1B24N5TkXk/box01.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Parameters for positioning the box are &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt; and &lt;code&gt;h&lt;/code&gt;, relatives to the top-left corner of the Conky's window.&lt;br /&gt;The same box as above but with a shorter height:&lt;br /&gt;&lt;pre&gt;local boxes_settings={&lt;br /&gt; {h=130},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQbYstZmI/AAAAAAAAAqM/WFFwpH6jkdM/box02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Another box with the 4 parameters :&lt;br /&gt;&lt;pre&gt;local boxes_settings={&lt;br /&gt; {x=3,y=35,h=95,w=85},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxQbfQCxbI/AAAAAAAAAqQ/ubSDLRxLGb8/box03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;It's quite easy to use more than one box :&lt;br /&gt;&lt;pre&gt;local boxes_settings={&lt;br /&gt; {x=3,y=35,h=95,w=85},&lt;br /&gt; {x=92,y=35,h=95,w=117},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQbp6IBEI/AAAAAAAAAqU/MwapSibqN8c/box04.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Tha &lt;a href="http://conky.sourceforge.net/lua.html"&gt;Lua API&lt;/a&gt; for Conky can get some informations about Conky's window, for example, to get the window's height or width, use &lt;code&gt;conky_window.height&lt;/code&gt; or &lt;code&gt;conky_window.width&lt;/code&gt; in the Lua scripts :&lt;br /&gt;&lt;pre&gt;local boxes_settings={&lt;br /&gt; {x=3,h=25,w=&lt;span style="color: rgb(255, 0, 0);"&gt;conky_window.width&lt;/span&gt;-6},&lt;br /&gt; {x=3,y=35,h=95,w=85},&lt;br /&gt; {x=92,y=35,h=95,w=117},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxQbrydLwI/AAAAAAAAAqY/Icv_Ws57qRk/box05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;So, with the above code, when the Conky's window increases, the top box is still nice :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxQjCVsCBI/AAAAAAAAAqc/LaJ3mpcy5Gg/box06.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Each corner of a box can be set individually in a table &lt;code&gt;{shape,radius}&lt;/code&gt;&lt;br /&gt;The four corners are join into a table named &lt;code&gt;corners&lt;/code&gt;:&lt;br /&gt;&lt;pre&gt;corners={ {shape-top-left,radius-top-left},&lt;br /&gt; {shape-top-right,radius-top-right},&lt;br /&gt; {shape-bottom-left,radius-bottom-left},   &lt;br /&gt; {shape-bottom-right,radius-bottom-right}&lt;br /&gt; }&lt;/pre&gt;&lt;br /&gt;Available shapes are : &lt;code&gt;"curve"&lt;/code&gt;, &lt;code&gt;"circle"&lt;/code&gt; and &lt;code&gt;"line"&lt;/code&gt;  &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQjAiJbvI/AAAAAAAAAqg/B4_pbguMCvU/box07.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;If the &lt;code&gt;corners&lt;/code&gt; table has less than 4 elements, the last element is used for missing elements:&lt;br /&gt;Box with one corner defined:&lt;br /&gt;&lt;pre&gt;{w=400,h=120, corners={ {"circle",40} } }&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQjeUA7TI/AAAAAAAAAqk/-pKP49YK758/box08.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxQjcBGi2I/AAAAAAAAAqo/-vAtNx8tWzg/box09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxQjZFC5zI/AAAAAAAAAqs/vDpBQLbe0rg/box10.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxQrt_i28I/AAAAAAAAAqw/4OEP_sa9Y2M/box11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The boxes can be draw with only a border if the &lt;code&gt;border&lt;/code&gt; parameter is greater than zero :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQrscT53I/AAAAAAAAAq0/fGiRqnRlTPI/box12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Some dashes can be added to the border if the &lt;code&gt;dash&lt;/code&gt; parameter is greater than zero:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQrsicreI/AAAAAAAAAq4/UrzEsS09ywI/box13.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The box can be rotated around his top-left corner with the &lt;code&gt;angle&lt;/code&gt; parameter :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxQsVFbL0I/AAAAAAAAAq8/3v2OJxX5fnI/box14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The rotation can be arround the x axis or the y axis with the &lt;code&gt;skew_x&lt;/code&gt; and &lt;code&gt;skew_y&lt;/code&gt; parameters :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQstmw6mI/AAAAAAAAArA/x9FNrsEFP3E/box15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;An interesting feature of Cairo is the &lt;a href="http://www.blogger.com/%20http://cairographics.org/operators/"&gt;compositing operator&lt;/a&gt; :&lt;br /&gt;In this script, the compositing operator is called with the &lt;code&gt;operator&lt;/code&gt; parameter, and the available arguments are &lt;code&gt;"clear"&lt;/code&gt;, &lt;code&gt;"source"&lt;/code&gt;, &lt;code&gt;"over"&lt;/code&gt;, &lt;code&gt;"in"&lt;/code&gt;, &lt;code&gt;"out"&lt;/code&gt;, &lt;code&gt;"atop"&lt;/code&gt;, &lt;code&gt;"dest"&lt;/code&gt;, &lt;code&gt;"dest_over"&lt;/code&gt;, &lt;code&gt;"dest_in"&lt;/code&gt;, &lt;code&gt;"dest_out"&lt;/code&gt;, &lt;code&gt;"dest_atop"&lt;/code&gt;, &lt;code&gt;"xor"&lt;/code&gt;, &lt;code&gt;"add"&lt;/code&gt;, &lt;code&gt;"saturate"&lt;/code&gt;. Default is &lt;code&gt;"over"&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTE&lt;/span&gt; : in your conkyrc, you need the parameter &lt;pre style="color: rgb(255, 0, 0);"&gt;own_window_argb_visual yes&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's start with theses two boxes :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=150,h=90, },&lt;br /&gt; {x=50,y=20,w=60,h=150, corners={{ "curve",10}} },&lt;/pre&gt;&lt;br /&gt;for this output :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxQ2Jrg3FI/AAAAAAAAArE/jlrOwaX5_ak/box16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The &lt;code&gt;"clear"&lt;/code&gt; operator :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=150,h=90, },&lt;br /&gt; {x=50,y=20,w=60,h=150, corners={{ "curve",10}} , &lt;span style="color: rgb(255, 0, 0);"&gt;operator="clear"&lt;/span&gt; },&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQ2dwhW2I/AAAAAAAAArI/Ttbb_BP0vpM/box17.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The &lt;code&gt;"out"&lt;/code&gt; operator :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=150,h=90, },&lt;br /&gt; {x=50,y=20,w=60,h=150, corners={{ "curve",10}} , &lt;span style="color: rgb(255, 0, 0);"&gt;operator="out&lt;/span&gt;" },&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQ2RQQIRI/AAAAAAAAArM/VLEYZzwl7p4/box18.png" /&gt;&lt;/center&gt;&lt;br /&gt;The &lt;code&gt;"add"&lt;/code&gt; operator :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=150,h=90, },&lt;br /&gt; {x=50,y=20,w=60,h=150, corners={{ "curve",10}} , &lt;span style="color: rgb(255, 0, 0);"&gt;operator="add"&lt;/span&gt; },&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxQ2fCS9yI/AAAAAAAAArQ/lboal0zqcGk/box19.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;and so on ...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Last part of the boxes are the colour, colours are set in the &lt;code&gt;colour&lt;/code&gt; tables.&lt;br /&gt;Each "table colour" contains one or more tables which defines the colours of a gradient :&lt;br /&gt;table={P,C,A}&lt;br /&gt;P = position inside the linear gradient (0 = start of the gradient, 1= end of the gradient)&lt;br /&gt;C = hexadecimal colour&lt;br /&gt;A = alpha (opacity) of colour (0=invisible,1=opacity 100%)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, for a single colour table:&lt;br /&gt;&lt;pre&gt;colour={{0,0x0000ff,1}}&lt;/pre&gt;&lt;br /&gt;for a 2-colours table :&lt;br /&gt;&lt;pre&gt;colour={&lt;br /&gt;{0,0x0000ff,1},&lt;br /&gt;{1,0xff00ff,1}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;for a 3-colours table:&lt;br /&gt;&lt;pre&gt;colour={&lt;br /&gt;{0,0x0000ff,1},&lt;br /&gt;{0.5,0xff00ff,1},&lt;br /&gt;{1,0xff00ff,1}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The output of this box :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=250,h=90, colour={ {0,0xFFFF00,1} } }&lt;/pre&gt;&lt;br /&gt;is a yellow rectangle :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQ2YvMpLI/AAAAAAAAArU/n2C26YrbKYU/box20.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The output of this box&lt;br /&gt;&lt;pre&gt;   {x=10,y=10,w=250,h=90, colour={ {0,0xFFFF00,1}, {1,0xFF0000,1}  } }&lt;/pre&gt;&lt;br /&gt;is a yellow rectangle again because we haven't set up the gradient to use.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Gradients are defined with one of this parameters &lt;code&gt;linear_gradient&lt;/code&gt; or &lt;code&gt;radial_gradient&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;linear_gradient - table with the coordinates of two points to define a linear gradient,&lt;br /&gt;              points are relative to top-left corner of the box, (not the conky's window)&lt;br /&gt;              {x1,y1,x2,y2}&lt;br /&gt;radial_gradient - table with the coordinates of two circle to define a radial gradient,&lt;br /&gt;              points are relative to top-left corner of the box, (not the conky window)&lt;br /&gt;              {x1,y1,r1,x2,y2,r2} (r=radius)&lt;/pre&gt;&lt;br /&gt;This code :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=250,h=&lt;span style="color: rgb(255, 0, 0);"&gt;100&lt;/span&gt;,&lt;br /&gt; colour={ {0,0xFFFF00,1}, {1,0xFF0000,1}} ,&lt;br /&gt; linear_gradient={0,0,0,&lt;span style="color: rgb(255, 0, 0);"&gt;100&lt;/span&gt;}  }&lt;/pre&gt;&lt;br /&gt;gives this output:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxQ_6wyTQI/AAAAAAAAArY/CWWMh5kj8Fg/box21.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;This code :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=250,h=&lt;span style="color: rgb(255, 0, 0);"&gt;100&lt;/span&gt;,&lt;br /&gt; colour={ {0,0xFFFF00,1}, {1,0xFF0000,1}} ,&lt;br /&gt; linear_gradient={0,0,0,&lt;span style="color: rgb(255, 0, 0);"&gt;50&lt;/span&gt;}  }&lt;/pre&gt;&lt;br /&gt;gives this output:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxRAW6tnGI/AAAAAAAAArc/lYFT1DIT4Gw/box22.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;This code :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=250,h=100,&lt;br /&gt; colour={ {0,0xFFFF00,1}, {&lt;span style="color: rgb(255, 0, 0);"&gt;0.5&lt;/span&gt;,0xFF0000,1}} ,&lt;br /&gt; linear_gradient={0,0,0,&lt;span style="color: rgb(255, 0, 0);"&gt;50&lt;/span&gt;}  }&lt;/pre&gt;&lt;br /&gt;gives this output:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxRASu3rMI/AAAAAAAAArg/ns85rBx9wi0/box23.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;This code, with a radial gradient :&lt;br /&gt;&lt;pre&gt;     {x=10,y=10,w=250,h=90,&lt;br /&gt; colour={ {0,0xFFFF00,1}, {1,0xFF0000,1}} ,&lt;br /&gt; radial_gradient={0,0,0,0,0,90}  }&lt;/pre&gt;&lt;br /&gt;gives this output :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TTxbGDBuJbI/AAAAAAAAAsA/3vhfP1r1QiM/box28.png" /&gt;&lt;/center&gt;     &lt;br /&gt;&lt;br /&gt;This code:&lt;br /&gt;&lt;pre&gt;     {x=10,y=110,w=300,h=10,&lt;br /&gt; colour={ {0,0x0000FF,0}, {0.5,0x00FF00,1}, {1,0x0000FF,0},} ,&lt;br /&gt; radial_gradient={0,5,0,0,5,300}  }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;gives this output :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TTxctfHQTGI/AAAAAAAAAsQ/rP4UBX5LzWU/box25.png" /&gt;&lt;/center&gt;     &lt;br /&gt;&lt;br /&gt;Other parameters added recently, while writing this note :&lt;br /&gt;&lt;code&gt;scale_x&lt;/code&gt; and &lt;code&gt;scale_y&lt;/code&gt; to rescale the box, useful for drawing elipses&lt;br /&gt;&lt;code&gt;draw_me&lt;/code&gt; : if set to false, box is not drawn (default = true or 1)&lt;br /&gt;    it can be used with a conky string, if the string returns 1, the box is drawn :&lt;br /&gt;    example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some examples of amazing setup :&lt;br /&gt;&lt;pre&gt;     {x=300,y=70,w=250,h=100,&lt;br /&gt;    linear_gradient={0,80,0,100},&lt;br /&gt;    colour={{0,0x000000,1},{0.5,0xFFFFFF,1}},&lt;br /&gt;    },&lt;br /&gt;&lt;br /&gt;    {x=200,y=70,w=100,h=100,&lt;br /&gt;    radial_gradient={100,100,0,100,100,20},&lt;br /&gt;    colour={{0.5,0xFFFFFF,1},{1,0x000000,1}},&lt;br /&gt;    },&lt;br /&gt;&lt;br /&gt;    {x=200,y=170,w=100,h=100,&lt;br /&gt;    linear_gradient={80,0,100,0},&lt;br /&gt;    colour={{0.5,0xFFFFFF,1},{0,0x000000,1}},&lt;br /&gt;     },     &lt;br /&gt;    {x=200,y=270,w=100,h=100,&lt;br /&gt;    radial_gradient={100,0,0,100,0,20},&lt;br /&gt;    colour={{0.5,0xFFFFFF,1},{1,0x000000,1}},&lt;br /&gt;    },&lt;br /&gt;    {x=300,y=270,w=250,h=100,&lt;br /&gt;    linear_gradient={0,0,0,20},&lt;br /&gt;    colour={{1,0x000000,1},{0.5,0xFFFFFF,1}},&lt;br /&gt;    },        &lt;br /&gt;    {x=290,y=160,h=120,&lt;br /&gt;    corners={{"circle",10}},&lt;br /&gt;    operator="clear"  }&lt;/pre&gt;&lt;br /&gt;for this output :     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TTxRG7Otp1I/AAAAAAAAArs/PWsS3utWl5s/box26.png" /&gt;&lt;/center&gt;&lt;center&gt;&lt;br /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A button :&lt;br /&gt;&lt;pre&gt; local gradient = { {0,0x858585,1}, {1,0x000000,1}}&lt;br /&gt;local table_settings={&lt;br /&gt; &lt;br /&gt; {w=200,h=200,&lt;br /&gt; colour=gradient,&lt;br /&gt; linear_gradient= {0,0,0,200}  },&lt;br /&gt; &lt;br /&gt; {x=10,y=10,w=180,h=180,&lt;br /&gt; corners={ {"circle",90} },&lt;br /&gt; colour=gradient ,&lt;br /&gt; linear_gradient= {180,180,10,10}  },&lt;br /&gt; &lt;br /&gt; {x=20,y=20,w=160,h=160,&lt;br /&gt; corners={ {"circle",80} },&lt;br /&gt; colour=gradient ,&lt;br /&gt; linear_gradient= {20,20,160,160}  },&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;for this output :     &lt;br /&gt;&lt;center&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TTxRG_fEc4I/AAAAAAAAArw/M4juUOsy0PA/box27.png" /&gt;&lt;/center&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;If you create some nice conkys with this widget, or any other, feel free to post a link in the comments ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-3594093971396710481?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/3594093971396710481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2011/01/box-widget_27.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3594093971396710481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3594093971396710481'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2011/01/box-widget_27.html' title='Box widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_yHDbHcEhK7A/TTxQbZgdBdI/AAAAAAAAAqI/o1B24N5TkXk/s72-c/box01.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-5276072829574655399</id><published>2011-01-13T14:45:00.000-08:00</published><updated>2011-01-14T14:28:15.667-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='memory leaks'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Memory Leaks in Conky/Lua/Cairo</title><content type='html'>A user named "Creamy Goodness" of Nokia N900 phone uses conky on his phone and this phone does not have much memory. He looked at my scripts a little closer and gave me some pointers to reduce memory leaks :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;1. Avoid global variables.&lt;/span&gt;&lt;br /&gt;If you don't specify local in front of a variable, the variable is set to global. When conky runs the script, the global variable is set but it is not destroy at the end of the script (even if you set the variable to nil). At each loop a variable is created so memory usage increase !&lt;br /&gt;&lt;br /&gt;But, it can be very interesting to have global variables with conky because each time a Lua script is called (ie at every update of the conky), the variable is still in memory and you can use it. This is the way I do when I draw &lt;a href="http://wlourf.deviantart.com/#/d31vd5m"&gt;graphs&lt;/a&gt; : the script start with an empty table and at each loop a new element popup the values in the table. Not very efficient but it works.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;2. Declare variables in local&lt;/span&gt;&lt;br /&gt;It's a good habit to declare variables in local, even in a local function, so they are destroyed when the script exits. I'm not sure but a local variable outside a function is OK too.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;3. Don't forget "cairo_pattern_destroy"&lt;/span&gt;&lt;br /&gt;When creating patterns, dont' forget to destroy them when the drawing is finished with &lt;code&gt;cairo_pattern_destroy(pat)&lt;/code&gt; and of course destroy contexts and surfaces with &lt;code&gt;cairo_destroy(cr)&lt;/code&gt; and &lt;code&gt;cairo_surface_destroy(cs)&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;4. Use strict.lua to check use of undeclared variables&lt;/span&gt;&lt;br /&gt;The script strict.lua can be found &lt;a href="http://metalua.luaforge.net/src/lib/strict.lua.html"&gt;here&lt;/a&gt; or &lt;a href="http://thomaslauer.com/comp/LuaStrict"&gt;here&lt;/a&gt; or in the Lua5.1 package.&lt;br /&gt;Creamy Godness made a modified version of this script to print a warning when it finds undeclared variables :&lt;br /&gt;&lt;pre&gt;--&lt;br /&gt;-- strict.lua&lt;br /&gt;-- checks uses of undeclared global variables&lt;br /&gt;-- All global variables must be 'declared' through a regular assignment&lt;br /&gt;-- (even assigning nil will do) in a main chunk before being used&lt;br /&gt;-- anywhere or assigned to inside a function.&lt;br /&gt;--&lt;br /&gt;-- From Lua distribution (etc/strict.lua)&lt;br /&gt;--&lt;br /&gt;&lt;br /&gt;local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget&lt;br /&gt;&lt;br /&gt;local mt = getmetatable(_G)&lt;br /&gt;if mt == nil then&lt;br /&gt;mt = {}&lt;br /&gt;setmetatable(_G, mt)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;mt.__declared = {}&lt;br /&gt;&lt;br /&gt;local function what ()&lt;br /&gt;local d = getinfo(3, "S")&lt;br /&gt;return d and d.what or "C"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;mt.__newindex = function (t, n, v)&lt;br /&gt;if not mt.__declared[n] then&lt;br /&gt; local w = what()&lt;br /&gt; if w ~= "main" and w ~= "C" then&lt;br /&gt;   print("assign to undeclared variable '"..n.."'")&lt;br /&gt; end&lt;br /&gt; mt.__declared[n] = true&lt;br /&gt;end&lt;br /&gt;rawset(t, n, v)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;mt.__index = function (t, n)&lt;br /&gt;if not mt.__declared[n] and what() ~= "C" then&lt;br /&gt; print("variable '"..n.."' is not declared")&lt;br /&gt;end&lt;br /&gt;return rawget(t, n)&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To use it, simply call the script in the script you want to check with &lt;pre&gt;require 'strict'&lt;/pre&gt; if both scripts are in the same folder.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;5. Workaround&lt;/span&gt;&lt;br /&gt;You can use a cron job to run a script that will killall conky and restarts your conkys.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;6. Further reading :&lt;/span&gt;&lt;br /&gt;Lua documentation : &lt;a href="http://lua-users.org/wiki/DetectingUndefinedVariables"&gt;Detecting Undefined Variables&lt;/a&gt;&lt;br /&gt;The conky for the phone with the comments of Creamy Goodness, on &lt;a href="http://ubuntuforums.org/showpost.php?p=10258350&amp;amp;postcount=269"&gt;Ubuntu Forums&lt;/a&gt; or on &lt;a href="http://talk.maemo.org/showthread.php?t=64434"&gt;Mameo.org&lt;/a&gt;&lt;br /&gt;Memory Leaks with Cairo and imlib2 on &lt;a href="http://mylittledesktop.blogspot.com/2009/11/memory-usage-with-imlib2-for-lua.html"&gt;londonali's blog&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-5276072829574655399?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/5276072829574655399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2011/01/memory-leaks-in-conkyluacairo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5276072829574655399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5276072829574655399'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2011/01/memory-leaks-in-conkyluacairo.html' title='Memory Leaks in Conky/Lua/Cairo'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-5921079884138719075</id><published>2010-10-31T05:22:00.000-07:00</published><updated>2010-10-31T07:19:52.222-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Graph Widget</title><content type='html'>After some months, here is a new widget.&lt;br /&gt;This one draw graphs like *_graph variables in conky (cpugraph, downspeedgraph, ...) but with some amazing options.&lt;br /&gt;&lt;br /&gt;The widget use a lot of parameters but only three are mandatory, others are optional. If they are missing, default values are used.&lt;br /&gt;&lt;br /&gt;Link to download on deviantArt : &lt;a href="http://wlourf.deviantart.com/art/Graph-Widget-for-Conky-1-184541530"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As usual, settings are made through tables :&lt;br /&gt;&lt;pre&gt;graph_settings={&lt;br /&gt; {table_setting for ring1},&lt;br /&gt; {table_setting for ring2},&lt;br /&gt; {table_setting for ring3},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For each table, the 3 mandatory parameters are &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;arg&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;In a conky, you write: &lt;code&gt;${cpu cpu1}&lt;/code&gt;, In the script, you will write :&lt;br /&gt;&lt;pre&gt;graph_settings={&lt;br /&gt; {&lt;br /&gt; name="cpu",&lt;br /&gt; arg="cpu1",&lt;br /&gt; max=100,&lt;br /&gt; --(max is set to 100 because maximum value of $cpu is 100% but you can set it to 50% if you want)&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For my next examples, I will use this table :&lt;br /&gt;&lt;pre&gt;graph_settings={&lt;br /&gt; {&lt;br /&gt; name="time",&lt;br /&gt; arg="%S",&lt;br /&gt; max=60,&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;and &lt;code&gt;update_interval 1&lt;/code&gt; in conkyrc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This simple table will draw this kind of graph in the bottom-left corner of the conky window:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TM1elMayAUI/AAAAAAAAAoE/EbF8VWMiA_0/graph01.png" /&gt;&lt;/center&gt;&lt;br /&gt;You can see a gradient on the background and a gradient on the graph itself.&lt;br /&gt;&lt;br /&gt;The default size of the graph is 100x20 pixels but we can change the size and position with &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; parameters.&lt;br /&gt;&lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; are the bottom-left corner of the graph, they are relative to the top-left corner of the conky window&lt;br /&gt;&lt;br /&gt;Let zoom in the graph for the next screenshots :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="time",&lt;br /&gt;     arg="%S",&lt;br /&gt;     max=60,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;width=250,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;height=75,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;x=20,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;y=200,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TM1elYgahCI/AAAAAAAAAoI/Dqn9RK_tfUQ/graph02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;On the above image, the width is set to 250 pixels, it means , with a conky update of 1 s, that the graph duration is 250 seconds. (each triangle is for one minute)&lt;br /&gt;&lt;br /&gt;The same graph with &lt;code&gt;update_interval 0.5&lt;/code&gt; will display half the previous one.&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TM1elZk2Z3I/AAAAAAAAAoM/Z1K7TQjTnZE/graph03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;By default, the graph displays one value per pixel, but we can change that with the &lt;code&gt;nb_values&lt;/code&gt; parameter : it sets the number of values to display&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="time",&lt;br /&gt;     arg="%S",&lt;br /&gt;     max=60,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;nb_values=60,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here, we display 60 values, with &lt;code&gt;update_interval 1&lt;/code&gt;, it display values for one minute :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1elZP0G2I/AAAAAAAAAoQ/oyazfTzzn68/graph04.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Ok, theses triangle are boring, let play with a cpu graph :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;name="cpu",&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;arg="",&lt;/span&gt;&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     },&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;With the maximum value set to 100% (&lt;code&gt;max=100&lt;/code&gt;), this graph is not useful :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1elrd_gWI/AAAAAAAAAoU/Q6gcxfl-XYE/graph05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;For a better view, we can use the &lt;code&gt;autoscale&lt;/code&gt; parameter, if set to true &lt;code&gt;true&lt;/code&gt;, the script calculate the maximum value to use (and do not use the &lt;code&gt;max&lt;/code&gt; parameter)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;autoscale=true,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1eq8CtuPI/AAAAAAAAAoY/-kJ0PLhSwqg/graph06.png" /&gt;&lt;/center&gt;  &lt;br /&gt;&lt;br /&gt;Others ways to change the layout of the output are &lt;code&gt;angle&lt;/code&gt;, &lt;code&gt;skew_x&lt;/code&gt; and &lt;code&gt;skew_y&lt;/code&gt; parameters&lt;br /&gt;For &lt;code&gt;angle&lt;/code&gt; :&lt;br /&gt;&lt;pre&gt;   graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;x=50,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;angle=-35,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;      &lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1eqzQVCeI/AAAAAAAAAoc/8xdTPvEAJLA/graph07.png" /&gt;&lt;/center&gt; &lt;br /&gt;&lt;br /&gt;For &lt;code&gt;skew_x&lt;/code&gt; :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;x=175,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;skew_x=-15,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;      &lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TM1erDcufqI/AAAAAAAAAog/fuAB6LH8DEI/graph08.png" /&gt;&lt;/center&gt;  &lt;br /&gt;&lt;br /&gt;For &lt;code&gt;skew_y&lt;/code&gt; :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;skew_y=-15,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1erEIBTcI/AAAAAAAAAok/8pMRllRw22g/graph09.png" /&gt;&lt;/center&gt;   &lt;br /&gt;&lt;br /&gt;For both &lt;code&gt;skew_x&lt;/code&gt; and &lt;code&gt;skew_y&lt;/code&gt; :  &lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;x=175,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;skew_y=-25,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;skew_x=-15,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TM1erTXWBvI/AAAAAAAAAoo/77S43_f_UvA/graph10.png" /&gt;&lt;/center&gt;   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another parameter is &lt;code&gt;inverse&lt;/code&gt;, if set to &lt;code&gt;true&lt;/code&gt;, the graph is drawn from right to left&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, some parameters to change the output of the graph :&lt;br /&gt;&lt;code&gt;background&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt; to not display the background :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;background=false,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1eyV5wn-I/AAAAAAAAAow/N_f55e5KM6o/graph12.png" /&gt;&lt;/center&gt;   &lt;br /&gt;&lt;br /&gt;&lt;code&gt;foreground&lt;/code&gt; set to &lt;code&gt;false&lt;/code&gt; to not display the graph! (Wait, you will see that is useful soon !):&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;foreground=false,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TM1eyVFpR1I/AAAAAAAAAo0/5RGrIXMMGRk/graph13.png" /&gt;&lt;/center&gt;&lt;br /&gt;But ... we can add a border to the graph with &lt;code&gt;fg_bd_size&lt;/code&gt;. If set to zero, no border is drawn&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     foreground=false,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;fg_bd_size=5,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1eycZjhrI/AAAAAAAAAo4/_2fYTyTxXRk/graph14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;And a border can be added to the background with &lt;code&gt;bg_bd_size&lt;/code&gt;&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=60,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;fg_bd_size=2,&lt;/span&gt;&lt;br /&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;bg_bd_size=2,&lt;/span&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;with &lt;code&gt;foreground&lt;/code&gt; back to &lt;code&gt;true&lt;/code&gt;, the default value, we can have that :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1ey6Wi_pI/AAAAAAAAAo8/WyK7kksYxAk/graph15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Now have a look on the colours.&lt;br /&gt;Each colours for background, foreground, background_border, graph border  are set in theses parameters :&lt;br /&gt;&lt;code&gt;bg_colour&lt;/code&gt;, &lt;code&gt;fg_colour&lt;/code&gt;, &lt;code&gt;bg_bd_colour&lt;/code&gt; and &lt;code&gt;fg_bd_colour&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;For example, for a single colour table:&lt;br /&gt;&lt;pre&gt;bg_colour={{0,0x0000ff,1}}&lt;/pre&gt;&lt;br /&gt;for a 2-colours table :&lt;br /&gt;&lt;pre&gt;bg_colour={&lt;br /&gt; {0,0x0000ff,1},&lt;br /&gt; {1,0xff00ff,1}&lt;br /&gt; }&lt;/pre&gt;&lt;br /&gt;for a 3-colours table:&lt;br /&gt;&lt;pre&gt;bg_colour={&lt;br /&gt; {0,0x0000ff,1},&lt;br /&gt; {0.5,0xff00ff,1},&lt;br /&gt; {1,0xff00ff,1}&lt;br /&gt; }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and so on ...&lt;br /&gt;&lt;br /&gt;Each "table colour" above contains one or more tables which defines the colours of a gradient :&lt;br /&gt;table={P,C,A}&lt;br /&gt;P = position inside the linear gradient (0 = start of the gradient, 1= end of the gradient)&lt;br /&gt;C = hexadecimal colour&lt;br /&gt;A = alpha (opacity) of colour (0=invisible,1=opacity 100%)&lt;br /&gt;&lt;br /&gt;Some examples with the background only :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1e6wd5CnI/AAAAAAAAApA/p_uXlSqFQpA/graph16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;As the gradient is linear, I add an orientation parameter, for the four colours :&lt;br /&gt;&lt;code&gt;bg_orientation&lt;/code&gt;, &lt;code&gt;bg_bd_orientation&lt;/code&gt;, &lt;code&gt;fg_orientation&lt;/code&gt; and &lt;code&gt;fg_bd_orientation&lt;/code&gt;.&lt;br /&gt;The values of the parameter are the starting point of the gradient, like in this picture :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1e64TxkbI/AAAAAAAAApE/5hUIMT9Uqrs/graph17.png" /&gt;&lt;/center&gt;&lt;br /&gt;and, in use :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1e63a6ejI/AAAAAAAAApI/y5Lo11mvEII/graph18.png" /&gt;&lt;/center&gt;&lt;br /&gt;On the above image, the difference between &lt;code&gt;nw&lt;/code&gt; and &lt;code&gt;ww&lt;/code&gt; is not obvious but if we decrease the width of the graph, the effect is more visible, like this, for the 8 possible values : "nn","ne","ee","se","ss","sw","ww","nw" :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1e7MfkSaI/AAAAAAAAApM/oNbn_KmHTh4/graph19.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Stop playing now, try to draw a real graph with some gradients :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     bg_bd_size=1,&lt;br /&gt;     fg_bd_size=3,&lt;br /&gt;     bg_colour = {{0,0xFFFFFF,1}},&lt;br /&gt;     bg_bd_colour = { {0,0x00000,1}},       &lt;br /&gt;&lt;br /&gt;     fg_colour = { {0,0xFF0000,1},&lt;br /&gt;                     {0.66,0xFFFF00,1},&lt;br /&gt;                     {1,0x00FF00,1},&lt;br /&gt;                   },&lt;br /&gt;     fg_bd_colour = { {0,0x000000,1}},       &lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TM1e7Plm_RI/AAAAAAAAApQ/BMr0v9Ig_kU/graph20.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Another one:&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     bg_bd_size=0,&lt;br /&gt;     fg_bd_size=0,&lt;br /&gt;     bg_colour = { {0,0x00000,1},&lt;br /&gt;             {0.5,0xFFFFFF,1},&lt;br /&gt;             {1,0x00000,1}},&lt;br /&gt;&lt;br /&gt;     fg_colour = { {0,0x000000,1},&lt;br /&gt;         {0.5,0x0000FF,0.5},&lt;br /&gt;         {1,0x000000,1}},&lt;br /&gt;&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1fB3pq_lI/AAAAAAAAApU/leOknaFOQ8g/graph21.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;One more :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     bg_bd_size=2,&lt;br /&gt;     fg_bd_size=0,&lt;br /&gt;     bg_colour = { {0,0x00000,0},&lt;br /&gt;             {0.5,0xFFFFFF,1},&lt;br /&gt;             {1,0x00000,0}},&lt;br /&gt;&lt;br /&gt;     bg_bd_colour = { {0,0x00000,0},&lt;br /&gt;             {0.5,0x000000,1},&lt;br /&gt;             {1,0x00000,0}},&lt;br /&gt;&lt;br /&gt;     fg_colour = { {0,0x000000,0},&lt;br /&gt;         {0.5,0xFF0000,0.5},&lt;br /&gt;         {1,0x000000,0}},&lt;br /&gt;&lt;br /&gt;     bg_bd_orientation="ww",&lt;br /&gt;     bg_orientation="ww",&lt;br /&gt;     fg_orientation="ww",                &lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1fCMCVD1I/AAAAAAAAApY/kNg_fkQ30YM/graph22.png" /&gt;&lt;/center&gt;       &lt;br /&gt;&lt;br /&gt;Again :&lt;br /&gt;&lt;pre&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     autoscale=true,&lt;br /&gt;     bg_bd_size=0,&lt;br /&gt;     fg_bd_size=3,&lt;br /&gt;&lt;br /&gt;     fg_bd_colour = { {0,0x000000,1},&lt;br /&gt;                     {.75,0x00000,0},&lt;br /&gt;                     },&lt;br /&gt;&lt;br /&gt;     foreground=false,&lt;br /&gt;     background=false&lt;br /&gt;     },&lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;     &lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TM1fCY6kOBI/AAAAAAAAApc/aR4NTSAfAuU/graph23.png" /&gt;&lt;/center&gt;         &lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Now, we will draw more that one graph. Remember, the script can draw as many graph as you want! So, to draw overlaping graphs, we first draw the main graph with the background on it and then we add others graphs, like this, for a quad core cpu :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; graph_settings={&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="cpu1",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     fg_bd_size=1,&lt;br /&gt;     bg_colour={{0,0xeeeeee,0.5}},&lt;br /&gt;     fg_bd_colour = { {0,0xFF0000,1}, },&lt;br /&gt;     foreground=false,&lt;br /&gt;     },&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="cpu2",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     fg_bd_size=1,&lt;br /&gt;     fg_bd_colour = { {0,0x00FF00,1}, },&lt;br /&gt;     background=false,&lt;br /&gt;     foreground=false,&lt;br /&gt;     },&lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="cpu3",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     fg_bd_size=1,&lt;br /&gt;     fg_bd_colour = { {0,0x0000FF,1}, },&lt;br /&gt;     background=false,&lt;br /&gt;     foreground=false,&lt;br /&gt;     },    &lt;br /&gt;     {&lt;br /&gt;     name="cpu",&lt;br /&gt;     arg="cpu4",&lt;br /&gt;     max=100,&lt;br /&gt;     width=250,&lt;br /&gt;     height=75,&lt;br /&gt;     nb_values=100,&lt;br /&gt;     fg_bd_size=1,&lt;br /&gt;     fg_bd_colour = { {0,0xFFFF00,1}, },&lt;br /&gt;     background=false,&lt;br /&gt;     foreground=false,&lt;br /&gt;     },    &lt;br /&gt;      }&lt;/pre&gt;&lt;br /&gt;While running avidemux :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TM1fCcdFNRI/AAAAAAAAApg/ojBOg2uL6Ss/graph24.png" /&gt;&lt;/center&gt;  &lt;br /&gt;&lt;br /&gt;One of the nice feature in conky is transparancy :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TM1eyAB06pI/AAAAAAAAAos/Eax7d-gvjIg/graph11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;That's all for today !&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;A new website about Conky is starting &lt;a href="http://conky-pitstop.wikidot.com/"&gt;here&lt;/a&gt;. It's name is Conky PitStop and you will fine some Conky's addicts on it. I'm working on the french translation, if anyone is interested to join, drop me a note! &lt;br /&gt;There are also translation ion german and spanish but more languages can be added.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-5921079884138719075?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/5921079884138719075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/10/graph-widget.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5921079884138719075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5921079884138719075'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/10/graph-widget.html' title='Graph Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_yHDbHcEhK7A/TM1elMayAUI/AAAAAAAAAoE/EbF8VWMiA_0/s72-c/graph01.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-4697211853122592802</id><published>2010-08-08T06:37:00.000-07:00</published><updated>2011-01-26T12:24:16.369-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ring'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Rings + Sectors Widget</title><content type='html'>Another widget, after the bar cut into blocks, here is a circle cut into sectors.&lt;br /&gt;This widget use a lot of parameters but only 3 parameters are mandatory, others are optional. If they are missing, default values are used.&lt;br /&gt;&lt;br /&gt;Link to download on deviantArt : &lt;a href="http://wlourf.deviantart.com/art/Rings-And-Sectors-for-Conky-2-174493100"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As usual, settings are made through tables :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;rings_settings={&lt;br /&gt;{table_setting for ring1},&lt;br /&gt;{table_setting for ring2},&lt;br /&gt;{table_setting for ring3},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The 3 mandatory parameters are &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;arg&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;In a conky, you write: &lt;code&gt;${cpu cpu1}&lt;/code&gt;, In the script, you will write :&lt;br /&gt;&lt;pre&gt;rings_settings={&lt;br /&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;--(max is set to 100 because maximum value of $cpu is 100% but you can set it to 50% if you want)&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This simple table will draw this kind of circle in the center of the conky window (the radius will be a quarter of the conky's window width):&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tDTNroJI/AAAAAAAAAkg/tjBb2tQwKGg/rings01.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Defaults colours used in the script have to be used with a dark background.&lt;br /&gt;You can set the colour of the conky window with&lt;br /&gt;&lt;code&gt;own_window_colour 000000&lt;br /&gt;own_window_transparent no&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Position and appearance can be changed with &lt;code&gt;xc&lt;/code&gt;, &lt;code&gt;yc&lt;/code&gt;, &lt;code&gt;thickness&lt;/code&gt; and &lt;code&gt;radius&lt;/code&gt;.&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu0",&lt;br /&gt;max=100,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;xc=100,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;yc=100,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;thickness=20,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;radius=60&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tDgcUEII/AAAAAAAAAkk/kWi25dTkL0U/rings02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Number of sectors is set with &lt;code&gt;sectors&lt;/code&gt;.&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;sectors=50,&lt;/span&gt;&lt;br /&gt;radius=90&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TF6tDtn3hNI/AAAAAAAAAko/Q5N4j7RIh5I/rings03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;If you look at the first circle above, you will see a gap at the top of the ring, it's because the script draw only sectors, and the parameter &lt;code&gt;gap_sectors&lt;/code&gt; is set to 1 by default. So the &lt;code&gt;gap_sectors&lt;/code&gt; parameter set the space in pixels between two sectors :&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=5,&lt;br /&gt;thickness=20,&lt;br /&gt;radius=75,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;gap_sectors=5&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tDxEdOfI/AAAAAAAAAks/EgdCkR4FrnI/rings04.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;There is two way to close a sector, this is done with the &lt;code&gt;cap&lt;/code&gt; parameter.&lt;br /&gt;&lt;code&gt;cap="p"&lt;/code&gt; for parallel (default value)&lt;br /&gt;&lt;code&gt;cap="r"&lt;/code&gt; for radial&lt;br /&gt;See picture :&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=5,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=15,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;cap="r"&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tEPnUnQI/AAAAAAAAAkw/aHtNeDCiK2Q/rings05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another way to change the shape of a ring is to change the angles with &lt;code&gt;start_angle&lt;/code&gt; and &lt;code&gt;end_angle&lt;/code&gt;.&lt;br /&gt;Values are in degrees and default values are :&lt;br /&gt;&lt;code&gt;start_angle=0&lt;/code&gt;&lt;br /&gt;&lt;code&gt;end_angle=360&lt;/code&gt;&lt;br /&gt;&lt;code&gt;end_angle&lt;/code&gt; has to be greater than &lt;code&gt;start_angle&lt;/code&gt; but both can be negatives&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=6,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;start_angle=45,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;end_angle=315&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tNN5EEFI/AAAAAAAAAk0/d6gX5t3BOqA/rings06.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Of course, arcs can be inversed with &lt;code&gt;inverse_arc&lt;/code&gt; parameter (default value is false).&lt;br /&gt;If &lt;code&gt;inverse_arc=true&lt;/code&gt; arc will be anticlockwise.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=12,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=10,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;inverse_arc=true&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tNsbwYHI/AAAAAAAAAlE/t0W0wpyBgdY/rings10.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Another parameter used to change the shape is the &lt;code&gt;border_size&lt;/code&gt; parameter. Default is set to zero (i.e. "no border").&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=6,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=10,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;border_size=5&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tNZ9B0OI/AAAAAAAAAk8/hBJVT8NrDdQ/rings08.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Next paramater is &lt;code&gt;fill_sector&lt;/code&gt;, default value is &lt;code&gt;false&lt;/code&gt;.&lt;br /&gt;If set to &lt;code&gt;true&lt;/code&gt;, each sector will be completely filled (like in the next picture)&lt;br /&gt;Of course, this parameter is inoperate with &lt;code&gt;sectors=1&lt;/code&gt;&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=12,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=300,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=10,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;fill_sector=true,&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tNjZ-4NI/AAAAAAAAAlA/Ct6jLD04dUs/rings09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I forgot these two parameters &lt;code&gt;background&lt;/code&gt; and &lt;code&gt;foreground&lt;/code&gt; which can be useful sometimes. If set to &lt;code&gt;false&lt;/code&gt;, background or foreground are not drawn.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=6,&lt;br /&gt;thickness=30,&lt;br /&gt;radius=75,&lt;br /&gt;xc=300,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=10,&lt;br /&gt;border_size=2,&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;background=false&lt;/span&gt;&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tNZ9B0OI/AAAAAAAAAk8/hBJVT8NrDdQ/rings08.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well, I think I didn't forgot anything. I think I will add more parameters in the future...&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Now, I will explain the colours parameters.&lt;br /&gt;Each colours for background, foreground and border are set in theses parameters :&lt;br /&gt;&lt;code&gt;bg_colour1&lt;/code&gt;, &lt;code&gt;fg_colour1&lt;/code&gt; and &lt;code&gt;bd_colour1&lt;/code&gt;&lt;br /&gt;For example, for a single colour table:&lt;br /&gt;&lt;code&gt;bg_colour1={{0,0x0000ff,1}}&lt;/code&gt;&lt;br /&gt;for a 2-colours table :&lt;br /&gt;&lt;pre&gt;bg_colour1={&lt;br /&gt;{0,0x0000ff,1},&lt;br /&gt;{1,0xff00ff,1}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;for a 3-colours table:&lt;br /&gt;&lt;pre&gt;bg_colour1={&lt;br /&gt;{0,0x0000ff,1},&lt;br /&gt;{0.5,0xff00ff,1},&lt;br /&gt;{1,0xff00ff,1}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;and so on ...&lt;br /&gt;&lt;br /&gt;Each "table colour" above contains one or more tables which defines the colours of a gradient :&lt;br /&gt;&lt;code&gt;table={P,C,A}&lt;/code&gt;&lt;br /&gt;P = position inside the gradient (0 = internal radius, 1= external radius)&lt;br /&gt;C = hexadecimal colour&lt;br /&gt;A = alpha (opacity) of colour (0=invisible,1=opacity 100%)&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tUM6UXHI/AAAAAAAAAlI/NJJ55gNaUMs/rings11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;With 5 colours for background and 3 colours for foreground :&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=10,&lt;br /&gt;thickness=40,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;gap_sectors=5,&lt;br /&gt;bg_colour1={{0,0xFF6600,0.5},{0.25,0xFFFF00,1},{0.5,0xdddddd,1},{0.75,0X99CCFF,1},{1,0X0000FF,0.5}},&lt;br /&gt;fg_colour1={{0,0xFF6600,0.5},{0.5,0xFF0000,1},{1,0x0000FF,0.5}},&lt;br /&gt;},    &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TF6tUTpSA_I/AAAAAAAAAlM/FclQHsoqkII/rings12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Another example :&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="time",&lt;br /&gt;arg="%S",&lt;br /&gt;max=60,&lt;br /&gt;sectors=10,&lt;br /&gt;thickness=40,&lt;br /&gt;radius=75,&lt;br /&gt;xc=500,&lt;br /&gt;yc=85,&lt;br /&gt;end_angle=270,&lt;br /&gt;gap_sectors=5,&lt;br /&gt;fg_colour1={{0,0xFFff00,0.8},{0.5,0xFF0000,0.8},{1,0xffff00,0.8}},&lt;br /&gt;bd_colour1={{0,0xFF0000,0.8},{0.5,0xFFff00,0.8},{1,0xff0000,0.8}},&lt;br /&gt;background=false,&lt;br /&gt;border_size=2,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TF6tUfIyFdI/AAAAAAAAAlQ/9IidOw3aYEw/rings13.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;With the previous setup, each sectors have the same color.&lt;br /&gt;But, for each colour (background, foreground and border), a gradient can be created with &lt;code&gt;fg_colour2&lt;/code&gt;, &lt;code&gt;bg_colour2&lt;/code&gt; and &lt;code&gt;bd_colour2&lt;/code&gt; parameters.&lt;br /&gt;This is the most interesting part of this script, if we have two colours&lt;br /&gt;&lt;pre&gt;fg_colour1={{P1,colour1,alpha1}}&lt;br /&gt;fg_colour2={{P2,0xcolour2,alpha2}}&lt;/pre&gt;&lt;br /&gt;For each sector a colour will be calculated with the "gradient" from  &lt;code&gt;P1&lt;/code&gt; to &lt;code&gt;P2&lt;/code&gt;, for each red, green and blue composantes from &lt;code&gt;colour1&lt;/code&gt; to &lt;code&gt;colour2&lt;/code&gt; and from &lt;code&gt;alpha1&lt;/code&gt; to &lt;code&gt;alpha2&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Some examples in picture for a better understanding 8-)&lt;br /&gt;&lt;br /&gt;Two tables with same colours and same alpha but with P1 and P2 differents : this has no effects because colours and alpha are the same.&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tUmzQZDI/AAAAAAAAAlU/UYYJ7oG-E3I/rings14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Two differents colours with same alpha:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tUgFYIvI/AAAAAAAAAlY/xH7NgG4MK3U/rings15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Two colours, same colours and differents alpha :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TF6tnOUVBcI/AAAAAAAAAlc/7sINPI0sVeg/rings16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Two colours, differents colours and differents alpha :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TF6tnLxjaAI/AAAAAAAAAlg/Bf3nwj1udhA/rings17.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Now, just start a new rings with 2 colours (a 2-colours table):&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tnYYV5DI/AAAAAAAAAlk/y2v45h3liDo/rings18.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;If I change the first parameter of the yellow colour which is the starting position of the gradient, we got that :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TF6tnimfxqI/AAAAAAAAAlo/iXYB_R748B8/rings19.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Adding a second 2-colours table &lt;code&gt;bg_colour2&lt;/code&gt; with the same blue&lt;br /&gt;&lt;pre&gt;   bg_colour1={{0,0xffff00,1},{1,0xff0000,1}},&lt;br /&gt;bg_colour2={{0,0x0000ff,1},{1,0x0000ff,1}},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6tnnVwueI/AAAAAAAAAls/wZGYELQ6Q8k/rings20.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;and with a 2-colours table with two differents colours&lt;br /&gt;&lt;pre&gt;   bg_colour1={{0,0xffff00,1},{1,0xff0000,1}},&lt;br /&gt;bg_colour2={{0,0x0000ff,1},{1,0x00ffff,1}},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6twKGKLYI/AAAAAAAAAlw/HM528bODwUM/rings21.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;With 3 colours :&lt;br /&gt;&lt;pre&gt;    bg_colour1={{0,0x0000ff,1},{0.5,0xffffff,1},{1,0xff0000,1}},&lt;br /&gt; bg_colour2={{0,0xff0000,1},{0.5,0xffffff,1},{1,0x0000ff,1}},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6twZFjNYI/AAAAAAAAAl0/fctRWmUBRs0/rings22.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Tweaking with alpha parameters :&lt;br /&gt;&lt;pre&gt;   bg_colour1={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},&lt;br /&gt;bg_colour2={{0,0xff0000,1},{0.5,0xffffff,1},{1,0xff0000,1}},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6twWHtFpI/AAAAAAAAAl4/uXgnju8m_G8/rings23.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Playing with alpha parameters and position parameters :&lt;br /&gt;&lt;pre&gt;   bg_colour1={{0,0x000000,0},{0.5,0xffffff,1},{1,0x000000,0}},&lt;br /&gt;bg_colour2={{0.49,0xff0000,1},{0.5,0xffffff,1},{0.51,0xff0000,1}},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TF6twsAlj6I/AAAAAAAAAl8/dI1RXAugbSE/rings24.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;or this one :&lt;br /&gt;&lt;pre&gt;   bg_colour1={{0.49,0xffffff,0},{0.5,0xffffff,1},{0.51,0xffffff,0}},&lt;br /&gt;bg_colour2={{0,0xffffff,0},{0.5,0xffffff,1},{1,0xffffff,0}},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF6twlNgCzI/AAAAAAAAAmA/ej0AHtPSUyc/rings25.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;As you can see, tweaking with colours, positions and alpha parameters are endless !&lt;br /&gt;&lt;br /&gt;Two of my favorites rings :&lt;br /&gt;This one to display CPU temperature and fan speed :&lt;br /&gt;&lt;pre&gt;    {&lt;br /&gt;name="exec",&lt;br /&gt;arg="sensors | grep 'CPU Temp' | cut -c15-16",&lt;br /&gt;max=60,&lt;br /&gt;xc=100,&lt;br /&gt;yc=100,&lt;br /&gt;radius=90,&lt;br /&gt;thickness=20,&lt;br /&gt;start_angle=-120,&lt;br /&gt;end_angle=120,&lt;br /&gt;sectors=20,&lt;br /&gt;bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},&lt;br /&gt;fg_colour1={{0,0XffFF00,0},{0.5,0xffFF00,1}, {1,0xffFF00,0}},&lt;br /&gt;fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;name="exec",&lt;br /&gt;arg="sensors | grep 'CPU Fan' | cut -c12-16",&lt;br /&gt;max=1500,&lt;br /&gt;xc=100,&lt;br /&gt;yc=100,&lt;br /&gt;radius=70,&lt;br /&gt;thickness=20,&lt;br /&gt;start_angle=-120,  &lt;br /&gt;end_angle=120,&lt;br /&gt;sectors=20,&lt;br /&gt;bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},&lt;br /&gt;fg_colour1={{0,0XFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},&lt;br /&gt;fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},&lt;br /&gt;bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6uG0FNYEI/AAAAAAAAAmE/AKLwQMj98R8/rings26.png" /&gt;&lt;/center&gt;&lt;br /&gt;With a text widget :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TF6uGxLCr8I/AAAAAAAAAmI/SBhdRAUpzs4/rings27.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;And this one, made of two vertical rings of 180 degrees. Each ring has colours inverted.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;name="fs_used_perc",&lt;br /&gt;arg="/home",&lt;br /&gt;max=50,&lt;br /&gt;xc=350,&lt;br /&gt;yc=150,&lt;br /&gt;radius=90,&lt;br /&gt;thickness=30,&lt;br /&gt;start_angle=0,&lt;br /&gt;end_angle=180,&lt;br /&gt;inverse_arc=false,&lt;br /&gt;border_size=0,&lt;br /&gt;sectors=50,&lt;br /&gt;gap_sectors=-1,&lt;br /&gt;fill_sector=true,&lt;br /&gt;bg_colour1={{0,0X111111,1},{0.5,0x111111,1}, {1,0x888888,1}},&lt;br /&gt;bg_colour2={{0,0X888888,1},{0.5,0x888888,1}, {1,0x111111,1}},&lt;br /&gt;&lt;br /&gt;fg_colour1={{0,0XFF4500,1},{0.5,0xFF4500,1}, {1,0xFFFFFF,1}},&lt;br /&gt;fg_colour2={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFF4500,1}},&lt;br /&gt;&lt;br /&gt;bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},&lt;br /&gt;},       &lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;name="",&lt;br /&gt;arg=conky_parse("${fs_used_perc /home}")-50,&lt;br /&gt;max=50,&lt;br /&gt;xc=350,&lt;br /&gt;yc=150,&lt;br /&gt;radius=90,&lt;br /&gt;thickness=30,&lt;br /&gt;start_angle=180,   &lt;br /&gt;end_angle=360,&lt;br /&gt;sectors=50,&lt;br /&gt;gap_sectors=-1,&lt;br /&gt;fill_sector=true,&lt;br /&gt;bg_colour2={{0,0X111111,1},{0.5,0x111111,1}, {1,0x888888,1}},&lt;br /&gt;bg_colour1={{0,0X999999,1},{0.5,0x888888,1}, {1,0x111111,1}},&lt;br /&gt;&lt;br /&gt;fg_colour2={{0,0XFF4500,1},{0.5,0xFF4500,1}, {1,0xFFFFFF,1}},&lt;br /&gt;fg_colour1={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFF4500,1}},&lt;br /&gt;&lt;br /&gt;bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note the use of conky_parse in the second ring. This ring has to start at 50 but the script doesn't have the &lt;code&gt;min&lt;/code&gt; parameter, so I have to "translate" the starting point at 50 and set the &lt;code&gt;max&lt;/code&gt; to 100-50=50.&lt;br /&gt;And I use &lt;code&gt;gap_sectors=-1&lt;/code&gt; to draw a plain circle.&lt;br /&gt;In this picture, left ring is for a zero-value,&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TF6uG7uxRKI/AAAAAAAAAmM/j18hDS3Arbs/rings28.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The same with the default value for &lt;code&gt;gap_sectors&lt;/code&gt;, &lt;code&gt;gap_sectors=1&lt;/code&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TF6uHPN9fOI/AAAAAAAAAmQ/bzyWhSFwQDI/rings29.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;That's all for the moment !&lt;br /&gt;&lt;br /&gt;Edit :&lt;br /&gt;The widget in real use :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TF7TskuA9dI/AAAAAAAAAm4/n0C_9zwrzB4/capture1.png" /&gt;&lt;/center&gt;&lt;br /&gt;A palette of differents rings :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TF7TsjstCEI/AAAAAAAAAm0/Gtb9W9xRQ78/s512/capture2.png" /&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-4697211853122592802?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/4697211853122592802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4697211853122592802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4697211853122592802'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html' title='Rings + Sectors Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_yHDbHcEhK7A/TF6tDTNroJI/AAAAAAAAAkg/tjBb2tQwKGg/s72-c/rings01.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-3928772568547889750</id><published>2010-07-14T14:00:00.000-07:00</published><updated>2011-01-16T14:16:32.993-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Bargraph widget</title><content type='html'>This is a big update of the bargraph widget I wrote some weeks ago.&lt;br /&gt;&lt;br /&gt;The script can be downloaded on my deviantArt page : &lt;a href="http://wlourf.deviantart.com/gallery/#/d2jj1rz"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The settings are now made through a table &lt;code&gt;bars_settings&lt;/code&gt; and I add some news effects.&lt;br /&gt;The &lt;code&gt;bars_settings&lt;/code&gt; contains as many bars as you want:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;bars_settings={&lt;br /&gt;{settings for bar 1 here},&lt;br /&gt;{settings for bar 2 here},&lt;br /&gt;{settings for bar 3 here},&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this script, 3 parameters are madatory : &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;arg&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In a conky, you write: &lt;code&gt;${cpu cpu1}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the script, you will write&lt;br /&gt;&lt;pre&gt;bars_settings={&lt;br /&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;--(max is set to 100 because maximum value of $cpu is 100%)&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This 3 parameters will draw a single bar with 10 blocks in the middle of the conky window :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iYAg0ujI/AAAAAAAAAho/DMJRM3jIYOw/bar01.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Of course, you can place the bar with &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; parameters, the dot (x,y) is the red dot in this image :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TD4iYJLhvHI/AAAAAAAAAhs/oHSojopQRt0/bar02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Line caps can be changed with &lt;code&gt;cap&lt;/code&gt; parameter, values can be :&lt;br /&gt;&lt;code&gt;b&lt;/code&gt; for line cap "butt" (the default value)&lt;br /&gt;&lt;code&gt;s&lt;/code&gt; for line Cap "square"&lt;br /&gt;&lt;code&gt;r&lt;/code&gt; for line Cap "round"&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TD4iYdHR-5I/AAAAAAAAAhw/vCvyPaWQyMQ/bar03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Code for the second bar in the above picture :&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;cap="s",&lt;br /&gt;x=150,&lt;br /&gt;y=200,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some transformation can be added :&lt;br /&gt;&lt;code&gt;angle&lt;/code&gt; is the angle of rotation of the bar (0 is a vertical bar)&lt;br /&gt;&lt;code&gt;skew_x&lt;/code&gt; to skew around x axis&lt;br /&gt;&lt;code&gt;skew_y&lt;/code&gt; to skew around y axis&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;x=100,&lt;br /&gt;y=220,&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;x=150,&lt;br /&gt;y=200,&lt;br /&gt;skew_x=-10&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;x=200,&lt;br /&gt;y=200,&lt;br /&gt;skew_y=15&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iYXvTPwI/AAAAAAAAAh0/L8n1FLRTl_k/bar04.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The shape and number of blocks can be set with&lt;br /&gt;&lt;code&gt;blocks&lt;/code&gt; : number of blocks (default = 10)&lt;br /&gt;&lt;code&gt;width&lt;/code&gt; : width of a block (default = 20 pixels)&lt;br /&gt;&lt;code&gt;height&lt;/code&gt; : height of a block (default = 10 pixels)&lt;br /&gt;&lt;code&gt;space&lt;/code&gt; : space betwwen two blocks (default = 2 pixels)&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TD4iYo8_EBI/AAAAAAAAAh4/q10cnvqkmx8/bar05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;As you can see, a block is filled or empty, except for the special case where &lt;code&gt;blocks=1&lt;/code&gt;, the bar will have a single block and this block will be partially filled.&lt;br /&gt;Also a numerical value can be passed to the script (instead of a conky variable), with &lt;code&gt;name=""&lt;/code&gt; and &lt;code&gt;arg=30&lt;/code&gt;, second table bellow :&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="cpu",&lt;br /&gt;arg="cpu1",&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;blocks=1,&lt;br /&gt;height=200,&lt;br /&gt;width=10,&lt;br /&gt;space=10,&lt;br /&gt;x=10,&lt;br /&gt;y=300&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=30,&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;blocks=1,&lt;br /&gt;height=200,&lt;br /&gt;width=10,&lt;br /&gt;space=10,&lt;br /&gt;x=10,&lt;br /&gt;y=320&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4idP-L3AI/AAAAAAAAAh8/6v7pV_xYLuM/bar06.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Also a bar can be ... a circle (well I know this is not clever !) with the &lt;code&gt;angle_bar&lt;/code&gt; parameter.&lt;br /&gt;With &lt;code&gt;angle_bar&lt;/code&gt;, the parameter &lt;code&gt;width&lt;/code&gt; is not used :&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;blocks=20,&lt;br /&gt;height=10,&lt;br /&gt;space=1,&lt;br /&gt;angle_bar=45,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4idUTeDMI/AAAAAAAAAiA/lR4Iw6HJA0k/bar07.png" /&gt;&lt;/center&gt;&lt;br /&gt;and a radius can be applied like this:&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;blocks=20,&lt;br /&gt;height=10,&lt;br /&gt;space=1,&lt;br /&gt;angle_bar=45,&lt;br /&gt;radius=50,&lt;br /&gt;x=20,&lt;br /&gt;y=200,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;The red dot is the (x,y) dot :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4iddrKMYI/AAAAAAAAAiE/9uxLPKrMyhU/bar08.png" /&gt;&lt;/center&gt;&lt;br /&gt;Of course, some transformation can also be used, like &lt;code&gt;skew_x&lt;/code&gt; and &lt;code&gt;skew_y&lt;/code&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;blocks=10,&lt;br /&gt;height=5,&lt;br /&gt;space=5,&lt;br /&gt;angle_bar=45,&lt;br /&gt;radius=50,&lt;br /&gt;x=20,&lt;br /&gt;y=400,&lt;br /&gt;skew_y=20,&lt;br /&gt;skew_x=20,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4idcOalMI/AAAAAAAAAiI/NDrDsSotPU8/bar09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Let put some colours !&lt;br /&gt;In this script, colors are defined in tables with two elements, coulour and alpha (opacity) :&lt;br /&gt;&lt;pre&gt;{colour,alpha}&lt;/pre&gt;&lt;br /&gt;As you've noticed, there is actually two colours, one for the background (when a block is OFF), and when a block is "ON", call it foreground.&lt;br /&gt;The names of the parameters are &lt;code&gt;bg_colour&lt;/code&gt; and &lt;code&gt;fg_colour&lt;/code&gt;.&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;angle=90,&lt;br /&gt;bg_colour={0x3300FF,0.7},&lt;br /&gt;fg_colour={0xFF0033,0.7},&lt;br /&gt;x=200,y=200&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x0033FF,0},&lt;br /&gt;fg_colour={0x00FF00,0.7},&lt;br /&gt;blocks=1,&lt;br /&gt;height=100,&lt;br /&gt;x=200,y=300&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;The verical block has no background because alpha is set to 0.&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4idigxyII/AAAAAAAAAiM/0wlJaX-cne8/bar10.png" /&gt;&lt;/center&gt;&lt;br /&gt;Theses colours are "flat" isn't it ? So I add colours to create "LED" effects, each blocks is now define with is colour and a second colour (if desired)&lt;br /&gt;The names of the parameters are &lt;code&gt;bg_led&lt;/code&gt; and &lt;code&gt;fg_led&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Theses parameters have no effect unless they are used with the &lt;code&gt;led_effect&lt;/code&gt; parameter. Possible values are :&lt;br /&gt;&lt;code&gt;r&lt;/code&gt; for rounded effect in the middle of the block&lt;br /&gt;&lt;code&gt;a&lt;/code&gt; for parallel effect&lt;br /&gt;&lt;code&gt;e&lt;/code&gt; for perpendicular effect&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ff00,0},&lt;br /&gt;fg_colour={0xFF0000,0},&lt;br /&gt;led_effect="r",&lt;br /&gt;bg_led={0x00ff00,1},&lt;br /&gt;fg_led={0xFF0000,1},&lt;br /&gt;x=200,y=200&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ff00,0},&lt;br /&gt;fg_colour={0xFF0000,0},&lt;br /&gt;led_effect="e",&lt;br /&gt;bg_led={0x00ff00,1},&lt;br /&gt;fg_led={0xFF0000,1},&lt;br /&gt;x=250,y=200&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ff00,0},&lt;br /&gt;fg_colour={0xFF0000,0},&lt;br /&gt;led_effect="a",&lt;br /&gt;bg_led={0x00ff00,1},&lt;br /&gt;fg_led={0xFF0000,1},&lt;br /&gt;x=300,y=200&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4iiZPyt_I/AAAAAAAAAiQ/f9MpyhiHr5g/bar11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;I used same colors for &lt;code&gt;fg and bg led&lt;/code&gt; and &lt;code&gt;fg and bg colour&lt;/code&gt; but with differents alpha.&lt;br /&gt;Here's the same with different colours and same alpha :&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0xffff00,1},&lt;br /&gt;fg_colour={0xffff00,1},&lt;br /&gt;led_effect="r",&lt;br /&gt;bg_led={0xff0000,1},&lt;br /&gt;fg_led={0x0000ff,1},&lt;br /&gt;x=200,y=200&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0xffff00,1},&lt;br /&gt;fg_colour={0xffff00,1},&lt;br /&gt;led_effect="e",&lt;br /&gt;bg_led={0x0000660,1},&lt;br /&gt;fg_led={0x660066,1},&lt;br /&gt;x=250,y=200&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="50",&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0xffff00,1},&lt;br /&gt;fg_colour={0xffff00,1},&lt;br /&gt;led_effect="a",&lt;br /&gt;bg_led ={0x0000ff,1},&lt;br /&gt;fg_led ={0xff0000,1},&lt;br /&gt;x=300,y=200&lt;br /&gt;},&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4iifQaSUI/AAAAAAAAAiU/oV1jkGZ75Vo/bar12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;A third colour : with a threshold &lt;code&gt;alarm&lt;/code&gt;, the color of a block can change if value is over threshold.&lt;br /&gt;Colour can be defined with &lt;code&gt;alarm_colour&lt;/code&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="80",&lt;br /&gt;max=100,&lt;br /&gt;alarm=70,&lt;br /&gt;bg_colour={0x00ff00,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;x=200,y=200,&lt;br /&gt;blocks=10,&lt;br /&gt;cap="r",&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iiVtHqEI/AAAAAAAAAiY/Op3EG5lj09M/bar13.png" /&gt;&lt;/center&gt;&lt;br /&gt;Led effect can also be applied on alarm color with &lt;code&gt;alarm_led&lt;/code&gt;.&lt;br /&gt;In this example, led effect is applied only on the alarm values:&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg="80",&lt;br /&gt;max=100,&lt;br /&gt;alarm=70,&lt;br /&gt;bg_colour={0x00ff00,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,0},&lt;br /&gt;alarm_led={0xff0000,1},&lt;br /&gt;led_effect="r",&lt;br /&gt;x=200,y=200,&lt;br /&gt;blocks=10,&lt;br /&gt;cap="r",&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4iiuepI3I/AAAAAAAAAic/A7U9Z8uIGTg/bar14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Another interesting parameter is &lt;code&gt;smooth&lt;/code&gt;.&lt;br /&gt;This one create a gradient from bottom (with &lt;code&gt;fg_colour&lt;/code&gt;) to top (with &lt;code&gt;alarm_colour&lt;/code&gt;) of the bar.&lt;br /&gt;Default value is &lt;code&gt;false&lt;/code&gt; and when used, &lt;code&gt;led_effect&lt;/code&gt; is inoperate&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=20,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;smooth=true,&lt;br /&gt;led_effect="r",&lt;br /&gt;x=200,y=200,&lt;br /&gt;blocks=10,&lt;br /&gt;cap="r",&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;smooth=true,&lt;br /&gt;led_effect="r",&lt;br /&gt;x=200,y=250,&lt;br /&gt;blocks=10,&lt;br /&gt;cap="r",&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=95,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;smooth=true,&lt;br /&gt;led_effect="r",&lt;br /&gt;x=200,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;cap="r",&lt;br /&gt;angle=90,&lt;br /&gt;}, &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4iinhl0fI/AAAAAAAAAig/1glRpwSUpag/bar15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;But if you think that 2 colours are not enough for a gradient, you can add some colours with &lt;code&gt;mid_colour&lt;/code&gt;.&lt;br /&gt;&lt;code&gt;mid_colour&lt;/code&gt; is a table containing one or more sub-table of three values.&lt;br /&gt;Example:&lt;br /&gt;&lt;pre&gt;mid_colour= {{0.5,0xFF0000,1}}&lt;br /&gt;mid_colour= {{0.25,0xFF0000,1},&lt;br /&gt;{0.75,0x00FF00,1}}&lt;/pre&gt;&lt;br /&gt;First line will add some red with opacity of 1 at 50 % in the gradient&lt;br /&gt;Second line will add some red at 25% and some green at 75%.&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=20,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;smooth=true,&lt;br /&gt;x=20,y=200,&lt;br /&gt;blocks=20,&lt;br /&gt;height=20,width=20,&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;smooth=true,&lt;br /&gt;x=20,y=222,&lt;br /&gt;blocks=20,&lt;br /&gt;height=20,width=20,&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=95,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;smooth=true,&lt;br /&gt;x=20,y=244,&lt;br /&gt;blocks=20,&lt;br /&gt;height=20,width=20,&lt;br /&gt;angle=90,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=77,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0x00ff00,0.25},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;smooth=true,&lt;br /&gt;x=10,y=256,&lt;br /&gt;blocks=1,&lt;br /&gt;height=438,width=20,&lt;br /&gt;angle=90,&lt;br /&gt;}, &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TD4uMrLzFwI/AAAAAAAAAkE/9XLIg5kc4dU/bar16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Finally, reflection can be added with (only for bars) :&lt;br /&gt;&lt;code&gt;reflection_alpha&lt;/code&gt; set the alpha at the beginning of the reflection (ends with alpha=0)&lt;br /&gt;&lt;code&gt;reflection_length&lt;/code&gt; set the length of the reflection, a percentage of the original bar (values 0 to 1)&lt;br /&gt;&lt;code&gt;reflection_scale&lt;/code&gt; set the scale of the reflection, a percentage of the original bar (values 0 to 1)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0xff00ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;x=120,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;height=20,width=20,&lt;br /&gt;reflection_alpha=0.5,&lt;br /&gt;smooth=true,&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0xff00ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;x=150,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;height=20,width=20,&lt;br /&gt;reflection_alpha=0.5,&lt;br /&gt;reflection_length=0.5,&lt;br /&gt;smooth=true&lt;br /&gt;},&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=020,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0xff00ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;mid_colour={{0.25,0xffff00,1},&lt;br /&gt; {0.5,0x00ffff,1},&lt;br /&gt; {0.75,0xffff00,1}&lt;br /&gt; },&lt;br /&gt;x=180,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;height=20,width=20,&lt;br /&gt;reflection_alpha=0.5,&lt;br /&gt;reflection_scale=0.5,&lt;br /&gt;smooth=true&lt;br /&gt;}, &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4koh7tMjI/AAAAAAAAAjY/4z7Z1Zr7l7A/bar17.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Last parameter is the position of the bar's reflection (&lt;code&gt;reflection&lt;/code&gt;), it has four parameters &lt;code&gt;b,t,l,r&lt;/code&gt; for bottom, top, left and right but theses parameters are always relative to a verical bar.&lt;br /&gt;The next 2 bars have &lt;code&gt;reflection="r"&lt;/code&gt; but the second has &lt;code&gt;angle=90&lt;/code&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0xff00ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;x=150,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;height=20,width=20,&lt;br /&gt;reflection_alpha=0.8,&lt;br /&gt;smooth=true,&lt;br /&gt;reflection="r",&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=50,&lt;br /&gt;max=100,&lt;br /&gt;alarm=80,&lt;br /&gt;bg_colour={0xff00ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;alarm_colour={0xff0000,1},&lt;br /&gt;x=220,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;height=20,width=20,&lt;br /&gt;reflection_alpha=0.8,&lt;br /&gt;smooth=true,&lt;br /&gt;reflection="r",&lt;br /&gt;angle=90&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TD4sOoTsZ_I/AAAAAAAAAjk/kZh4dCBPLmQ/bar27.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;And now, some amazing setups :&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=80,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x0000ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},&lt;br /&gt;x=25,y=300,&lt;br /&gt;blocks=50,&lt;br /&gt;space=1,&lt;br /&gt;height=10,width=10,&lt;br /&gt;angle=90,&lt;br /&gt;smooth = true,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TD4in-AsbfI/AAAAAAAAAis/gZ5gdu3Et98/bar18.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=80,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x0000ff,0.5},&lt;br /&gt;fg_colour={0x00ff00,1},&lt;br /&gt;mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},&lt;br /&gt;x=25,y=300,&lt;br /&gt;blocks=50,&lt;br /&gt;space=1,&lt;br /&gt;height=10,width=0,&lt;br /&gt;angle=90,&lt;br /&gt;smooth = true,&lt;br /&gt;cap="r",&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4inylpMMI/AAAAAAAAAiw/SnsZWN2c2xM/bar19.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0xff00ff,0},&lt;br /&gt;fg_colour={0x00ff00,0},&lt;br /&gt;bg_led={0xff00ff,0.5},&lt;br /&gt;fg_led={0x00ff00,1},&lt;br /&gt;led_effect="r",&lt;br /&gt;x=25,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;space=5,&lt;br /&gt;height=50,width=40,&lt;br /&gt;angle=90,&lt;br /&gt;cap="r",&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TD4ioEZSXQI/AAAAAAAAAi0/YjuV_E0NW_8/bar20.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ffff,0},&lt;br /&gt;fg_colour={0x00ffff,0},&lt;br /&gt;bg_led={0xff0000,0.5},&lt;br /&gt;fg_led={0xffff00,1},&lt;br /&gt;led_effect="r",&lt;br /&gt;x=50,y=300,&lt;br /&gt;blocks=10,&lt;br /&gt;space=1,&lt;br /&gt;height=50,width=40,&lt;br /&gt;angle=90,&lt;br /&gt;cap="r",&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4itzvdWZI/AAAAAAAAAi4/bth18tNL_4c/bar21.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;alarm=50,&lt;br /&gt;bg_colour={0x00ff33,0},&lt;br /&gt;fg_colour={0xffff00,0},&lt;br /&gt;alarm_colour={0xFF0000,0},&lt;br /&gt;bg_led={0x00ff33,0.5},&lt;br /&gt;fg_led={0xffff00,1},&lt;br /&gt;alarm_led={0xFF0000,1},&lt;br /&gt;blocks=10,&lt;br /&gt;space=1,&lt;br /&gt;height=30,width=40,&lt;br /&gt;angle=90,&lt;br /&gt;cap="b",&lt;br /&gt;angle_bar=45,&lt;br /&gt;led_effect="a"&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iuNs8Y6I/AAAAAAAAAi8/wTliwwaA-2A/bar22.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;alarm=50,&lt;br /&gt;bg_colour={0x00ff33,0},&lt;br /&gt;fg_colour={0xffff00,0},&lt;br /&gt;alarm_colour={0xFF0000,0},&lt;br /&gt;bg_led={0x00ff33,0.5},&lt;br /&gt;fg_led={0xffff00,1},&lt;br /&gt;alarm_led={0xFF0000,1},&lt;br /&gt;blocks=10,&lt;br /&gt;height=30,width=40,&lt;br /&gt;angle=90-45/2,&lt;br /&gt;cap="r",&lt;br /&gt;angle_bar=45,&lt;br /&gt;led_effect="a",&lt;br /&gt;radius=30,&lt;br /&gt;skew_y=25&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TD4iuVpAN7I/AAAAAAAAAjA/dKDcyA_Uu3c/bar23.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ff33,0},&lt;br /&gt;fg_colour={0xffff00,0},&lt;br /&gt;bg_led={0x00ff33,0.5},&lt;br /&gt;fg_led={0xffff00,1},&lt;br /&gt;blocks=20,&lt;br /&gt;y=300,&lt;br /&gt;height=10,width=40,&lt;br /&gt;angle=90,&lt;br /&gt;led_effect="r",&lt;br /&gt;reflection_alpha=1,&lt;br /&gt;reflection="r"&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TD4iuRocuqI/AAAAAAAAAjE/lHiueev_dC4/bar24.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;{&lt;br /&gt;name="",&lt;br /&gt;arg=70,&lt;br /&gt;max=100,&lt;br /&gt;bg_colour={0x00ff33,0},&lt;br /&gt;fg_colour={0xffff00,0},&lt;br /&gt;bg_led={0x00ff33,0.5},&lt;br /&gt;fg_led={0xffff00,1},&lt;br /&gt;led_effect="r",&lt;br /&gt;blocks=20,&lt;br /&gt;y=300,&lt;br /&gt;height=10,width=40,&lt;br /&gt;angle=90,&lt;br /&gt;led_effect="e",&lt;br /&gt;reflection_alpha=1,&lt;br /&gt;reflection="r",&lt;br /&gt;space=0,&lt;br /&gt;skew_x=15,&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iuvaWgZI/AAAAAAAAAjI/COQM79XVuiY/bar25.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Enjoy ;-)&lt;br /&gt;&lt;br /&gt;PS : a big setup with the text widget (too many effects in this one, I agree):&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TD4tV_K36rI/AAAAAAAAAjs/4-j31n6XB2I/s576/bargraph%2Btext.png" /&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-3928772568547889750?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/3928772568547889750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/07/bargraph-widget.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3928772568547889750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3928772568547889750'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/07/bargraph-widget.html' title='Bargraph widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_yHDbHcEhK7A/TD4iYAg0ujI/AAAAAAAAAho/DMJRM3jIYOw/s72-c/bar01.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-5709388746721766643</id><published>2010-06-26T02:09:00.000-07:00</published><updated>2010-07-03T06:53:44.711-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Text widget, Part 2</title><content type='html'>I finnaly add some effects to the text widget.&lt;br /&gt;The reflection and the "skew".&lt;br /&gt;&lt;br /&gt;All these effects are based upon the &lt;a href="http://cairographics.org/matrix_transform/"&gt;cairo.Matrix transform&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Let start with a simple text displaying hour with a 3-colours and linear gradient:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   text_settings={&lt;br /&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  },  &lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The output :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TCe5SnmmzSI/AAAAAAAAAgA/hxj_kS5SHdY/text-17.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, I add some reflection :&lt;br /&gt;&lt;pre&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;reflection_alpha=1&lt;/b&gt;,&lt;br /&gt;  },&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The reflection start with an opacity of 1 (&lt;code&gt;reflection_alpha=1&lt;/code&gt;) and ends with a opacity of 0.&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TCe5SmkYfSI/AAAAAAAAAgE/28pWoivzKXA/text-18.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;But the reflection can start with an opacity less than 1 (&lt;code&gt;reflection_alpha=0.5&lt;/code&gt; here) :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;reflection_alpha=0.5&lt;/b&gt;,&lt;br /&gt;  },   &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TCe5S3sEnxI/AAAAAAAAAgI/JsxiCFSWrQY/text-19.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;With the abvoe parameters, reflection ends at the end of the text size, but it can end before with &lt;code&gt;reflection_length=0.5&lt;/code&gt;, it means 50% of the full height of the text&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  reflection_alpha=0.5,&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;reflection_length=0.5&lt;/b&gt;,&lt;br /&gt;  },   &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TCe5S_UEyOI/AAAAAAAAAgM/lL4at50hmCE/text-20.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The reflection length can be scaled, a scale of 1 (default value) means the same size of the text, a scale bigger than one means that the reflection is higher of the text:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  reflection_alpha=0.5,&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;reflection_scale=2&lt;/b&gt;,&lt;br /&gt;  },  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TCe5TpZfghI/AAAAAAAAAgQ/YwLfV49dLVc/text-21.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The skew parameter around x axis (I'm not sure of the units for that !):&lt;br /&gt;&lt;pre&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;skew_x=20&lt;/b&gt;,&lt;br /&gt;  },  &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TCe5dYKdFKI/AAAAAAAAAgU/wrywTSdbwQE/text-22.png" /&gt;&lt;/center&gt;&lt;br /&gt;The skew parameter around y axis &lt;br /&gt;&lt;pre&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;skew_y=20&lt;/b&gt;,&lt;br /&gt;  },  &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TCe5dl8GdQI/AAAAAAAAAgY/RPyf8gNV2WM/text-23.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;We can combine both&lt;br /&gt;&lt;pre&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=50,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;skew_y=-20,&lt;br /&gt;  skew_x=-50&lt;/b&gt;,&lt;br /&gt;  },  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TCe5dh_0jXI/AAAAAAAAAgc/MQTivLzV-IU/text-24.png" /&gt;&lt;/center&gt;&lt;br /&gt;Unfortunately, we can't have a real perspective with cairo .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally, we can combine reflection and skew:&lt;br /&gt;&lt;pre&gt;  {&lt;br /&gt;  text=conky_parse("${time %H:%M:%S}"),&lt;br /&gt;  font_name="Rasheeq",&lt;br /&gt;  x=50,  &lt;br /&gt;  y=900,&lt;br /&gt;  font_size=50,&lt;br /&gt;  colour={{0,0xFF0000,1},{0.5,0xFFFF00,1},{1,0x00FF00,1}},&lt;br /&gt;  orientation="nn",&lt;br /&gt;  &lt;b style="color: rgb(255, 0, 0);"&gt;skew_y=-20,&lt;br /&gt;  skew_x=-10,&lt;br /&gt;  reflection_alpha=0.5&lt;/b&gt;,&lt;br /&gt;  },  &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TCe5d4oDnUI/AAAAAAAAAgg/giJugRHx-Fo/text-25.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Links to the updated script :&lt;br /&gt;In English on ubuntu forums : &lt;a href="http://ubuntuforums.org/showthread.php?p=9518741#post9518741"&gt;here&lt;/a&gt;&lt;br /&gt;French link (copy/paste) : &lt;a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3540506#p3540506"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And, an example of real life use combined with the piechart widget:&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TCe-nljUolI/AAAAAAAAAg4/Bfm6Ubyv10Y/text_rings_example.png"&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-5709388746721766643?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/5709388746721766643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/06/text-widget-part-2.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5709388746721766643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5709388746721766643'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/06/text-widget-part-2.html' title='Text widget, Part 2'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_yHDbHcEhK7A/TCe5SnmmzSI/AAAAAAAAAgA/hxj_kS5SHdY/s72-c/text-17.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-4307281471579238017</id><published>2010-06-14T13:16:00.000-07:00</published><updated>2011-01-27T15:01:59.494-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Text Widget</title><content type='html'>Hello !&lt;br /&gt;&lt;br /&gt;Here is a new widget, it only displays text but with some parameters set in the &lt;span style="font-weight: bold;"&gt;text_settings table&lt;/span&gt;, effects can be nice as you will see in pictures below.&lt;br /&gt;&lt;br /&gt;Links to the script on deviantArt : &lt;a href="http://wlourf.deviantart.com/#/d36njc0"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;font-size:130%;" &gt;A little reminder&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;font-size:130%;" &gt; : tables&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt; in Lua&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Lua, tables (arrays) are written like that :&lt;br /&gt;&lt;pre&gt;table={a,b,c} --this one has 3 elements&lt;/pre&gt;&lt;br /&gt;elements can be named, like this :&lt;br /&gt;&lt;pre&gt;table={num1=a,number2=b,element3=c}&lt;/pre&gt;&lt;br /&gt;But an element in a table can be a table, like this :&lt;br /&gt;&lt;pre&gt;table={num1=a,table2={A,B,C},element3=c} --second element is a table of 3 elements&lt;/pre&gt;&lt;br /&gt;or like this :&lt;br /&gt;&lt;pre&gt;table={text="my text",&lt;br /&gt;colour={&lt;br /&gt;    {0.00,0xFF0000,0.5},&lt;br /&gt;    {0.50,0x00FF00,1},&lt;br /&gt;    {1.00,0x0000FF,0.5},&lt;br /&gt;    },&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Colours tables &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The last table above is an example of colour table defined in this script to obtain a gradient effect. Table colour contains 1 or more tables which defines colors of the gradient : &lt;code&gt;{P,C,A} &lt;/code&gt;:&lt;br /&gt;P = position of gradient (0 = beginning of text, 1= end of text)&lt;br /&gt;C = hexadecimal colour&lt;br /&gt;A = alpha (opacity) of color (0=invisible,1=opacity 100%)&lt;br /&gt;Examples :&lt;br /&gt;for a plain color : &lt;pre&gt;{{1,0x00FF00,0.5}}&lt;/pre&gt;&lt;br /&gt;for a gradient with two colours &lt;pre&gt;{{0,0x00FF00,0.5},{1,0x000033,1}}&lt;/pre&gt;&lt;br /&gt;or &lt;pre&gt;{{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle (P=0.5) of the text&lt;/pre&gt;&lt;br /&gt;for a gradient with three colours &lt;pre&gt;{{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}&lt;/pre&gt;&lt;br /&gt;and so on ...&lt;br /&gt;&lt;br /&gt;It sounds complicated but with a little practice there is no problem ! If you understand nothing, don't panic, examples with pictures are coming soon !&lt;br /&gt;&lt;br /&gt;NB : &lt;a target="_new" href="http://lua-users.org/wiki/TablesTutorial"&gt;Tables Tutorial in Lua wiki&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Radial gradient&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;For this script, I also use a table to define a radial gradient, if needed:&lt;br /&gt;&lt;pre&gt;radial={0,0,0,0,300,370}&lt;/pre&gt;&lt;br /&gt;Radial gradients are defined with two circles (start circle and stop circle) and the radial table contains these elements:&lt;br /&gt;&lt;pre&gt;x center of circle 1,&lt;br /&gt;y center of circle 1,&lt;br /&gt;radius of circle 1,&lt;br /&gt;x center of circle 2,&lt;br /&gt;y center of circle 2,&lt;br /&gt;radius of circle 2,&lt;/pre&gt;&lt;br /&gt;Here again, examples below will help you !&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;Orientation for linear gradient&lt;/span&gt;&lt;br /&gt;In case of linear gradient, "orientation" defines the starting point of the gradient, default is "&lt;code&gt;ww&lt;/code&gt;"&lt;br /&gt;There are 8 available starting points : &lt;code&gt;"nw","nn","ne","ee","se","ss","sw","ww"&lt;/code&gt;&lt;br /&gt;(n for north, w for west ...)&lt;br /&gt;Theses 8 points are the 4 corners + the 4 middles of text's outline&lt;br /&gt;so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)&lt;br /&gt;a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;Setting the widget&lt;/span&gt;&lt;br /&gt;Let start with the funny things !&lt;br /&gt;the &lt;code&gt;text_settings&lt;/code&gt; table needs at least one table like this :&lt;br /&gt;&lt;pre&gt;text_settings={{&lt;br /&gt;text="my text",     --text to display&lt;br /&gt;x=20,                --x coordinate of first letter&lt;br /&gt;y=20,                --y coordinate of first letter&lt;br /&gt;},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;To display more than one text,  add a table in the text_settings table :&lt;br /&gt;&lt;pre&gt;text_settings={&lt;br /&gt;{--display a text on coordinates 20,20&lt;br /&gt;text="unformatted text",&lt;br /&gt;x=20,&lt;br /&gt;y=20,&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;{--display a text on coordinates 20,40, with selected font and size, true and bold&lt;br /&gt;text="bold and italic text",&lt;br /&gt;x=20,&lt;br /&gt;y=40,&lt;br /&gt;font_name="Verdana",&lt;br /&gt;font_size=18,&lt;br /&gt;italic=true,&lt;br /&gt;bold=true,&lt;br /&gt;},&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The output (nothing extraorinary) :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TBaZmKbwLcI/AAAAAAAAAeQ/6DNp0-gWmx0/text-00.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Adding some colors :&lt;br /&gt;&lt;pre&gt;        {--display a text on coordinates 20,20, in plain colour&lt;br /&gt;text="Plain Color",&lt;br /&gt;x=20,&lt;br /&gt;y=50,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0,0xFF0000,1}}&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TBaPDR5xRbI/AAAAAAAAAdk/dhCiskv66sE/text-01.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;A plain color with with a little gradient on opacity (see the two table in colour table):&lt;br /&gt;&lt;pre&gt;        {&lt;br /&gt;text="Opacity Gradient",&lt;br /&gt;x=20,&lt;br /&gt;y=100,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0,0xFF0000,1},&lt;br /&gt;{1,0xFF0000,0.1}}&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TBaPDZrmbDI/AAAAAAAAAdo/bInWooqqrk0/text-02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;A 2-colours gradient effect :&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="2 colors Gradients",&lt;br /&gt;x=20,&lt;br /&gt;y=150,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0,0xFF0000,1},&lt;br /&gt;{1,0xFFFF00,1}}&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TBaPD9RGBxI/AAAAAAAAAds/L61AJ10iXJw/text-03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;A 3-colours gradient effect :&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="3 colors Gradients",&lt;br /&gt;x=20,&lt;br /&gt;y=200,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0,0xFF0000,1},&lt;br /&gt;{0.5,0xFFFF00,1},&lt;br /&gt;{1,0x0000FF,1}},&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TBaPEDgZPiI/AAAAAAAAAdw/Q-ZQHW2F7B8/text-04.png" /&gt;&lt;/center&gt;&lt;br /&gt;Mix-up of 5 colors and opacity gradients&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="5 colors Gradient and opacity",&lt;br /&gt;x=20,&lt;br /&gt;y=250,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={&lt;br /&gt;{0.00,    0xFF0000,0},&lt;br /&gt;{0.25,    0xFFFF00,1},&lt;br /&gt;{0.5,    0xFFFFFF,1},&lt;br /&gt;{0.75,    0xFFFF00,1},&lt;br /&gt;{1.0,    0xFF0000,0}},&lt;br /&gt;}, &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TBaPEzfeeCI/AAAAAAAAAd0/WtlY5N6Ii7E/text-05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;A 3-colours  vertical gradient (&lt;code&gt;orientation="nn"&lt;/code&gt;) :&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="3 colors vertical Gradient",&lt;br /&gt;x=20,&lt;br /&gt;y=300,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={&lt;br /&gt;{0.00,    0xFF0000,0},&lt;br /&gt;{0.5,    0xFFFFFF,1},&lt;br /&gt;{1.0,    0xFF0000,0}},&lt;br /&gt;orientation="nn"&lt;br /&gt;},  &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TBaPOSmZ-2I/AAAAAAAAAd4/_-H5gZZxbmo/text-06.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;In the examples above, you can see the &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; parameters which defines the starting point of the text, but text can be aligned (vertical or horizontal)  with the parameters &lt;code&gt;h_align&lt;/code&gt; and &lt;code&gt;v_align&lt;/code&gt;.&lt;br /&gt;This example with radial gradient use it :&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="radial gradient",&lt;br /&gt;x=400,&lt;br /&gt;y=350,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size="48",&lt;br /&gt;colour={&lt;br /&gt;        {0.8,0xF0FFF0,1},&lt;br /&gt;        {1.00,0xF0F0FF,0.1},&lt;br /&gt;        },&lt;br /&gt;   h_align="c",&lt;br /&gt;   radial={0,300,0,0,300,370}&lt;br /&gt;}, &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/TBaegQdCwlI/AAAAAAAAAeY/FwcaVCvjJNQ/text-12.png" /&gt;&lt;/center&gt;&lt;br /&gt;or this one :&lt;br /&gt;&lt;pre&gt;         {&lt;br /&gt;text="another radial gradient",&lt;br /&gt;x=400,&lt;br /&gt;y=400,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size="48",&lt;br /&gt;colour={&lt;br /&gt;        {0.98,    0xFFFF00,1},&lt;br /&gt;        {0.99,    0xFF0000,1},&lt;br /&gt;        {1.00,    0xFF00FF,1},&lt;br /&gt;        },&lt;br /&gt;   h_align="c",&lt;br /&gt;   v_align="m",&lt;br /&gt;radial={0,-1000,0,0,-1000,1020}&lt;br /&gt;&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TBafi6HrCjI/AAAAAAAAAek/MyDw4xRW6Xo/text-13.png" /&gt;&lt;/center&gt;&lt;br /&gt;Apply some angles on text:&lt;br /&gt;&lt;pre&gt;        {--display a text with a 30° angle&lt;br /&gt;text="text at 30 degrees",&lt;br /&gt;x=50,&lt;br /&gt;y=600,&lt;br /&gt;colour={{0,0xFFFF00,1},{0.5,0x0000FF,1},{1,0xFFFF00,1}},&lt;br /&gt;angle=-30,&lt;br /&gt;font_name="ubuntu-title",&lt;br /&gt;font_size=32,&lt;br /&gt;},&lt;br /&gt;{--display a vertical text&lt;br /&gt;text="vertical text",&lt;br /&gt;x=30,&lt;br /&gt;y=450,&lt;br /&gt;colour={{0         ,0xFF0000,1},&lt;br /&gt;        {0.25    ,0xFFFF00,1},&lt;br /&gt;        {0.50    ,0x00FF00,1},&lt;br /&gt;        {0.75    ,0x00FFFF,1},&lt;br /&gt;        {1         ,0x0000FF,1}&lt;br /&gt;        },&lt;br /&gt;angle=-90,&lt;br /&gt;font_name="ubuntu-title",&lt;br /&gt;font_size=32,&lt;br /&gt;orientation="nw",&lt;br /&gt;h_align="r"&lt;br /&gt;},&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TBahu-SlkhI/AAAAAAAAAes/3sp0OVi09Ok/text-14.png" /&gt;&lt;/center&gt;&lt;br /&gt;And how to display &lt;span style="font-weight: bold;"&gt;conky variables&lt;/span&gt; ? Simply use the &lt;code&gt;conky_parse()&lt;/code&gt; function like this :&lt;br /&gt;&lt;pre&gt;         {--display a text with some conly variables&lt;br /&gt;--use two dots to concatenate texts&lt;br /&gt;text="text with some conky, cpu=" .. conky_parse("${cpu}") .. " %",&lt;br /&gt;x=20,&lt;br /&gt;y=660,&lt;br /&gt;colour={{0,0xFFFF00,1},{0.5,0xFF0000,1},{1,0xFFFF00,1}},&lt;br /&gt;font_name="Purisa",&lt;br /&gt;bold=true,&lt;br /&gt;font_size=38&lt;br /&gt;},     &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TBajYh3H0oI/AAAAAAAAAe0/9TM5DMXYdA4/text-15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Well, I think I show all the available options in this script.&lt;br /&gt;But now we can combine some of them to have nices effects with low-cpu usage:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Text with shadow&lt;/span&gt; : draw twice the text but with a little offset on x and y :&lt;br /&gt;&lt;pre&gt;        {&lt;br /&gt;text=conky_parse('text with shadow #1'),&lt;br /&gt;x=300,&lt;br /&gt;y=500,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{1,0xFF0000,0.75},&lt;br /&gt;        },&lt;br /&gt;   orientation="ww",&lt;br /&gt;},&lt;br /&gt;&lt;br /&gt;  {&lt;br /&gt;text=conky_parse('text with shadow #1'),&lt;br /&gt;x=298,&lt;br /&gt;y=498,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0,0xFFFF00,1}},&lt;br /&gt;    orientation="ww",&lt;br /&gt;},  &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TBaPPGgmj9I/AAAAAAAAAeA/ZzZdxPPjdM0/text-08.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Blur effect&lt;/span&gt; : display text 3 times but with opacity&lt;0.5&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/TBaPPywmqgI/AAAAAAAAAeE/KxlF0NYNx28/text-09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Focus effect&lt;/span&gt; : repeat text 3 times with x and y offsets and at the focus point set opacity for 1 of the 3 texts to 1.0 and to 0.0 for the two others texts.&lt;br /&gt;&lt;pre&gt;--focus effect&lt;br /&gt; {--afficher un texte aux coordonées 20,20&lt;br /&gt;text='focus effect #1',&lt;br /&gt;x=300,&lt;br /&gt;y=600,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,0},&lt;br /&gt;        {0.50,0x00FFFF,1},&lt;br /&gt;        {1.00,0x00FFFF,0},&lt;br /&gt;        },&lt;br /&gt;   orientation="ww",&lt;br /&gt;},&lt;br /&gt; {&lt;br /&gt;text='focus effect #1',&lt;br /&gt;x=300,&lt;br /&gt;y=599,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,0.5},&lt;br /&gt;        {0.50,0x00FFFF,0},&lt;br /&gt;        {1.00,0x00FFFF,0.5},&lt;br /&gt;        },&lt;br /&gt;   orientation="ww",&lt;br /&gt;},&lt;br /&gt; {&lt;br /&gt;text='focus effect #1',&lt;br /&gt;x=300,&lt;br /&gt;y=601,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,0.5},&lt;br /&gt;        {0.50,0x00FFFF,0},&lt;br /&gt;        {1.00,0x00FFFF,0.5},&lt;br /&gt;        },&lt;br /&gt;   orientation="ww",&lt;br /&gt;},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TBaPP5D1TkI/AAAAAAAAAeI/9lWmmUEU6oM/text-10.png" /&gt;&lt;/center&gt;&lt;br /&gt;Another one :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;--focus effect 2&lt;br /&gt; {&lt;br /&gt;text='focus effect #2',&lt;br /&gt;x=300,&lt;br /&gt;y=720,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,1},&lt;br /&gt;        {1,0x00FFFF,0},&lt;br /&gt;        },&lt;br /&gt;},&lt;br /&gt; {&lt;br /&gt;text='focus effect #2',&lt;br /&gt;x=299,&lt;br /&gt;y=719,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,0},&lt;br /&gt;        {1,0x00FFFF,0.25},&lt;br /&gt;        },&lt;br /&gt;},&lt;br /&gt; {&lt;br /&gt;text='focus effect #2',&lt;br /&gt;x=301,&lt;br /&gt;y=721,&lt;br /&gt;font_name="Clarendon",&lt;br /&gt;font_size=50,&lt;br /&gt;colour={{0.00,0x00FFFF,0},&lt;br /&gt;        {1,0x00FFFF,0.25},       &lt;br /&gt;        },&lt;br /&gt;},&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/TBam41WB_1I/AAAAAAAAAe8/4lqWDCL0c5s/text-16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;In a real life desktop, with vertical text, blur and focus effects !(wallpaper  &lt;a href="http://sostopher.deviantart.com/gallery/#/d1wuxjo"&gt;here&lt;/a&gt; ), click to enlarge&lt;center&gt;&lt;br /&gt;&lt;table style="width: auto;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://picasaweb.google.com/lh/photo/hQQ9QPy4VRpObWmSs-Jd7A?feat=embedwebsite"&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/TBapavgo3-I/AAAAAAAAAfU/idpi7ftJORc/s400/capture.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="font-family: arial,sans-serif; font-size: 11px; text-align: right;"&gt;De &lt;a href="http://picasaweb.google.com/wlourf/TextWidget?feat=embedwebsite"&gt;Text widget&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Happy conkying ;-)&lt;br /&gt;&lt;br /&gt;PS : While writing this note, I think about new effects like reflection or perspective, maybe I will add them soon ... it's done and it's &lt;a href="http://u-scripts.blogspot.com/2010/06/text-widget-part-2.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/3213850822469958395-4307281471579238017?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/4307281471579238017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/06/text-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4307281471579238017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4307281471579238017'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/06/text-widget.html' title='Text Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_yHDbHcEhK7A/TBaZmKbwLcI/AAAAAAAAAeQ/6DNp0-gWmx0/s72-c/text-00.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-4389454208223292194</id><published>2010-05-14T15:06:00.000-07:00</published><updated>2010-05-15T14:57:00.002-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='calendar'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Calendar box</title><content type='html'>Hello !&lt;br /&gt;&lt;br /&gt;Here is a new calendar fully customizable, nothing special in it, just nices effects created with the couple Lua/Cairo. Also, I choose a "settings table" to pass parameters to the script, so if a parameter is missing, a default parameter is used. Only 4 parameters are mandatory.&lt;br /&gt;&lt;br /&gt;You can download the script from Ubuntu forums &lt;a target="_blank" href="http://ubuntuforums.org/showpost.php?p=9305855&amp;postcount=12648"&gt;here&lt;/a&gt; and you need conky 1.8.0 or higher.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;Set up the conkyrc&lt;/span&gt;&lt;br /&gt;You need theses two lines in your conkyrc :&lt;br /&gt;&lt;pre&gt;own_window_transparent yes&lt;br /&gt;own_window_argb_visual yes&lt;/pre&gt;If you want the calendar in your language system, you have to add $time in TEXT section&lt;br /&gt;&lt;pre&gt;$time&lt;/pre&gt;and if you want to hide this time, use, for example :&lt;br /&gt;&lt;pre&gt;use_xft yes&lt;br /&gt;xftalpha 0&lt;/pre&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;Set up the lua script&lt;/span&gt;&lt;br /&gt;At the beggining of the script, there is a table called cal_settings which contains the parameters for one or more calendars :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--for one calendar&lt;br /&gt;cal_settings={&lt;br /&gt; { x=12,&lt;br /&gt;  y=12,&lt;br /&gt;  font="Japan",&lt;br /&gt;  font_size=14&lt;br /&gt; },&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;or&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--for two calendars&lt;br /&gt;cal_settings={&lt;br /&gt; { x=12,&lt;br /&gt;  y=12,&lt;br /&gt;  font="Japan",&lt;br /&gt;  font_size=14&lt;br /&gt; },&lt;br /&gt; { x=120,&lt;br /&gt;  y=120,&lt;br /&gt;  font="Japan",&lt;br /&gt;  font_size=16&lt;br /&gt; },&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So, the 4 mandatory parameters are : &lt;code&gt;x, y, font, font_size&lt;/code&gt;. With the first example, the output is classical :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-3QrNtgGtI/AAAAAAAAAZ4/V-rRol2aL4s/calendar-box-01.png" /&gt;&lt;/center&gt;&lt;br /&gt;The red numbers are for bank holidays (May is a good month for that in France !) and blue number is for today.&lt;br /&gt;The bank holidays and reminders stuffs are stored in a text file called at the beginnning of the script :&lt;br /&gt;&lt;pre&gt;calendar_file= "/home/wlourf/scripts/calendar-box/calendar.txt"&lt;/pre&gt;&lt;br /&gt;the format of this text file is&lt;br /&gt;&lt;pre&gt;#format of in this text file&lt;br /&gt;#MMDD;N;TEXT&lt;br /&gt;#MMDD = month day&lt;br /&gt;#N    = 0 or 1 (1 to display colours of bank holidays)&lt;br /&gt;#TEXT = Text to display&lt;br /&gt;&lt;br /&gt;0501;1;May Day&lt;br /&gt;0508;1;Armistice 1945&lt;br /&gt;0513;1;Ascension&lt;br /&gt;0524;1;Pentecost Monday&lt;br /&gt;0612;0;Mom's Birthday&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, the others parameters that can be put in the cal_settings table...&lt;br /&gt;With this ones, numbers are displayed with two digits and numbers of others months are hidden :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; x=36,&lt;br /&gt; y=12,&lt;br /&gt; font="Verdana",&lt;br /&gt; font_size=20,&lt;br /&gt; two_digits=true,&lt;br /&gt; display_others_days=false,&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S-3TfLEDeVI/AAAAAAAAAZ8/rT1MwscyJ6k/calendar-box-02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Theses ones format the month and the days with two letters&lt;br /&gt;&lt;pre&gt; month_format="%B %Y",&lt;br /&gt; days_number=2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-3UaqHeJ2I/AAAAAAAAAaA/HcfFNgeKsiI/calendar-box-03.png" /&gt;&lt;/center&gt;&lt;br /&gt;For time formatting , see &lt;a target="_blank" href="http://www.lua.org/pil/22.1.html"&gt;http://www.lua.org/pil/22.1.html&lt;/a&gt;, time can be displayed with &lt;code&gt;"%B - %H:%M"&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Month can be put around the calendar with l/r/b or t,&lt;br /&gt;Days can be put on top or on bottom of the calendar with b or t&lt;br /&gt;To display a month different from current month, use month_offset&lt;br /&gt;&lt;pre&gt; month_position="l",&lt;br /&gt; month_offset=-1,&lt;br /&gt; days_position="b",&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-3Wj7pheYI/AAAAAAAAAaE/xYmfsg50O08/calendar-box-04.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;numbers can be right/left or center aligned&lt;br /&gt;&lt;pre&gt; days_position="t",&lt;br /&gt; two_digits=false,&lt;br /&gt; alignment="r",&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S-3YSYFZ6sI/AAAAAAAAAaM/rVfrl4384w4/calendar-box-05.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Now, just put some colors, they are set in tables inside the cal_settings table. Formats are:&lt;br /&gt;-for boxes:&lt;br /&gt;&lt;pre&gt; {colour1, colour2, alpha1,alpha2,border1,border2,alpha border1,alpha border2}&lt;/pre&gt;&lt;br /&gt;-for texts:&lt;br /&gt;&lt;pre&gt; {colour1, colour2, alpha1,alpha2}&lt;/pre&gt;&lt;br /&gt;Colours use gradients, it's why there are two colors to set for each format.&lt;br /&gt;Theses parameters set the color of boxes and texts&lt;br /&gt;&lt;pre&gt; alignment="c",&lt;br /&gt; border=0,&lt;br /&gt; colBox = {0xFF0000,0x0000FF,0,1,0x0000FF,0x00FFFF,0.5,0.5},&lt;br /&gt; colBoxText  ={0x000000,0x0000FF,1,0},&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-5mAYlOVZI/AAAAAAAAAbE/0UcUhYGCF4M/calendar-box-06.png" /&gt;&lt;/center&gt;&lt;br /&gt;Others colours for text are for month, days (letters), today (number), bank holiday (number) , other month number, like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; month_offset=0,&lt;br /&gt; month_position="b",&lt;br /&gt; colBox = {0xFF0000,0x0000FF,0,0.5,0x0000FF,0x00FFFF,0.5,0.5}, --box color&lt;br /&gt; colBoxText  ={0x000000,0x000000,1,0.5},    --color of numbers&lt;br /&gt; colBoxTextTD = {0x0000FF,0x0000FF,1,1},    --color of today&lt;br /&gt; colBoxTextBH = {0x00FF00,0x00FF00,1,1},    --color of bank holiday&lt;br /&gt; display_others_days=true,&lt;br /&gt; colBoxTextOM = {0xCCCCCC,0x0000FF,1,0},    --color of numbers for other month&lt;br /&gt; colDaysText  ={0xFF0000,0x000000,1,1},     --color of days (Monday ...)&lt;br /&gt; colMonthText  = {0xFF0000,0x000000,0,1},   --color of month&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-5mViz9DZI/AAAAAAAAAbM/E0YupD1067Q/calendar-box-07.png" /&gt;&lt;/center&gt;&lt;br /&gt;On the above image, the color for today's box was not defined, so the script use the inversed colors of a standard box. The others parameters for the boxes are:&lt;br /&gt;&lt;pre&gt; border=0.5,&lt;br /&gt; colBox = {0xFF0000,0x0000FF,0,0,0x0000FF,0x00FFFF,0.5,0.5}, --color of standard box, alpha = 0 here&lt;br /&gt; colDays = {0xFF00FF,0x0000FF,1,1,0x0000FF,0x00FF00,1,1},    --color of boxes "Days" (Monday ...)&lt;br /&gt; colMonth = {0x00FF00,0x0000FF,1,1,0x0000FF,0x00FF00,1,1},   --color of box "Month"&lt;br /&gt; colBoxTD  = {0xFF0000,0xFF0000,0,1,0xFF00FF,0x00FF00,1,1},  --color of box "Today"&lt;br /&gt; colBoxBH  = {0xFF0000,0xFF0000,1,1,0xFF00FF,0x00FF00,1,1},  --color of box "Bank holiday"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S-5nBGqy_7I/AAAAAAAAAbU/LQ9QFsDTj08/calendar-box-08.png" /&gt;&lt;/center&gt;&lt;br /&gt;Parameters to change the shape of the boxes :&lt;br /&gt;&lt;pre&gt; hpadding=5,  --horizontal space beetween border and text (default=2 pixels)&lt;br /&gt; vpadding=5,  --vertical space beetween border and text (default=2 pixels)&lt;br /&gt; border=0.5,  --border size (default=0 pixels)&lt;br /&gt; gap=5,   --space betwwen 2 boxes (default=2 pixels)&lt;br /&gt; radius=5,  --radius of corners (default=0 pixels)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S-5pyWrZxJI/AAAAAAAAAbk/rrZgQDNzGWs/calendar-box-09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Parameters to change the gradient effect :&lt;br /&gt;&lt;pre&gt; orientation ="ww", -- possibles values = nn, ne,ee,se,ss,sw,ww,nw&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S-5qhEkWrTI/AAAAAAAAAbo/R896zXUccLM/calendar-box-10.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;To have a radial gradient :&lt;br /&gt;&lt;pre&gt; orientation ="nw", -- possibles values = nn, ne,ee,se,ss,sw,ww,nw&lt;br /&gt; gradient=0.25,  --  default linear(=0) or radial gradient percentage (0-1) of box side&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S-5s4-dZBHI/AAAAAAAAAbs/t8jzRUscbIE/calendar-box-11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;I also add a reminder box : this one displays text info from calendar.txt file, parameters are :&lt;br /&gt;&lt;pre&gt; display_info_box=true, --display info box (default=false)&lt;br /&gt; colInfo = {0xFF0000,0x0000FF,0,1,0x0000FF,0x00FFFF,0.5,0.5}, --color info Box&lt;br /&gt; colInfoText = {0x000000,0xFFFFFF,1,1},  --color text of info box&lt;br /&gt; info_position="b",  --position of info box, possibles values are t/b/l/r, (default=b)&lt;br /&gt; display_empty_info_box=true, --if no info to display , display or not info the box&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S-5wZ1F2zSI/AAAAAAAAAb0/zU6h4egg4zw/capture-box-11.png" /&gt;&lt;/center&gt;&lt;br /&gt;The info box can also display first line of a text file generated by a script. For example, this line in the conkyrc get the Saint of the day in file &lt;code&gt;/tmp/info.txt&lt;/code&gt; - thanks chepioq ;-):&lt;br /&gt;&lt;pre&gt;${execi 3600 wget http://fetedujour.fr/api/text  -O - -o /dev/null | awk '{print $6}' | sed 's/.$//' &gt; /tmp/info.txt}&lt;/pre&gt;&lt;br /&gt;And this parameter in the lua script :&lt;br /&gt;&lt;pre&gt; file_info="/tmp/info.txt",&lt;/pre&gt;&lt;br /&gt;will read info in &lt;code&gt;/tmp/info.txt&lt;/code&gt; instead of &lt;code&gt;calendar.txt&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S-52FJNUNcI/AAAAAAAAAb4/6xTu9uEPnqA/calendar-box-12.png" /&gt;&lt;/center&gt;&lt;br /&gt;That's all for this script !&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;span style="font-weight: bold;"&gt;Some updates&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Openbox's shortcuts&lt;/span&gt; script :&lt;br /&gt;Keyboard shortcuts without commands are no more displayed.&lt;br /&gt;Long command lines are shortened in the dispay to fit the column width.&lt;br /&gt;In keyboard section, when a command string hold the full path to the executable, it keeps only the name of the executable itself.&lt;br /&gt;&lt;a target="_blank" href="http://ubuntuforums.org/showpost.php?p=8944570&amp;amp;postcount=221"&gt;It's here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Pie Chart widget&lt;/span&gt;:&lt;br /&gt;The parameters are now set in a table and I add the &lt;code&gt;type_arc&lt;/code&gt; parameter, it can be set to "&lt;code&gt;l&lt;/code&gt;" for linear or "&lt;code&gt;r&lt;/code&gt;" for radial.&lt;br /&gt;"&lt;code&gt;r&lt;/code&gt;" gives the same result as before :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-6BYOazWJI/AAAAAAAAAcA/OqC1DfMHgYc/pie-13.png" /&gt;&lt;/center&gt;&lt;br /&gt;"&lt;code&gt;l&lt;/code&gt;" gives that (a ring) :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S-6BYLmJbXI/AAAAAAAAAcE/euy1NfYkRgE/pie-14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;a target="_blank" href="http://ubuntuforums.org/showpost.php?p=9118129&amp;postcount=253"&gt;It's here&lt;/a&gt;&lt;br /&gt;&lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-4389454208223292194?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/4389454208223292194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/05/calendar-box.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4389454208223292194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4389454208223292194'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/05/calendar-box.html' title='Calendar box'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_yHDbHcEhK7A/S-3QrNtgGtI/AAAAAAAAAZ4/V-rRol2aL4s/s72-c/calendar-box-01.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-1291016965873073052</id><published>2010-04-27T13:10:00.000-07:00</published><updated>2010-04-27T15:02:22.152-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='imlib'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Radio Box Widget</title><content type='html'>I like to listen to radio when I am working on my computer. Usually, I listen to &lt;a target="_new" href="http://sites.radiofrance.fr/chaines/fip/accueil/index.php"&gt;FIP radio&lt;/a&gt;, the track information played by this radio are very cools and smooths (example for one day : &lt;a target="_new" href="http://sites.radiofrance.fr/chaines/fip/endirect/archives.php"&gt;here&lt;/a&gt;) but of course I don't use their ugly &lt;a target="_new" href="http://players.tv-radio.com/radiofrance/playerfip.php"&gt;player&lt;/a&gt; or their information &lt;a target="_new" href="http://sites.radiofrance.fr/chaines/fip/endirect/popprog.php?first=1"&gt;popup&lt;/a&gt; ...&lt;br /&gt;&lt;br /&gt;Guess what, I want to display the tracks I'm listening on my desktop in a conky  ;-)&lt;br /&gt;But as there are more radios than "FIP radio" and because the script was not difficult to write, the conky came more "universal" (sorry, a big word for a little thing).&lt;br /&gt;You need &lt;span style="font-weight: bold;"&gt;conky 1.8.0&lt;/span&gt; because the script use  &lt;span style="font-style: italic;"&gt;cairo_text_extents_t&lt;/span&gt; structure for text alignment.&lt;br /&gt;&lt;br /&gt;The script can be downloaded from ubuntu forums : &lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=9183570&amp;postcount=12525"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;First, I said I don't want a ugly player, so I use vlc with the http interface, like this :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;vlc --intf=http http://www.tv-radio.com/station/fip_mp3/fip_mp3-128k.m3u&lt;/pre&gt;&lt;br /&gt;there are others interfaces or others methods to hide a player but I like vlc!&lt;br /&gt;&lt;br /&gt;I can control volume with my keyboard or with my browser at this address :&lt;br /&gt;&lt;pre&gt;http://localhost:8080/&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;The conky itself doesn't get the track information. This is done by a bash script, (I made one for FIP here but for others radios, you have to work a little bit ...) which write the information in a text file.&lt;br /&gt;So, the conky needs only this text file in input with at least one of the lines bellow (order doesn't matter):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;radio:__FIP radio__&lt;br /&gt;artist:Sonny Rollins&lt;br /&gt;title:Come, Gone&lt;br /&gt;album:Way out West&lt;br /&gt;label:Contemporary&lt;br /&gt;year:1957&lt;br /&gt;cover:/tmp/radio-cover&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I will call this file : &lt;code style="color: rgb(255, 102, 102);"&gt;&lt;b&gt;/tmp/radio.txt&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In the conkyrc, as usual, call the Lua script :&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;lua_load ~/scripts/radio-box.lua&lt;br /&gt;lua_draw_hook_post main_radio_box &lt;b style="color: rgb(255, 102, 102);"&gt;/tmp/radio.txt&lt;/b&gt;&lt;br /&gt;TEXT&lt;br /&gt;${execi 15 ~/scripts/generate-track-information.sh}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can see that the &lt;code&gt;main_radio_box&lt;/code&gt; function needs one parameter : the track information file generated by the &lt;code&gt;generate-track-information.sh&lt;/code&gt;.&lt;br /&gt;In fact, the function can have 17 parameters but only the first one is mandatory.&lt;br /&gt;&lt;br /&gt;If you run the script with only the first parameter, you get that :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S9X6tmiEtUI/AAAAAAAAAVU/Am38e9pJkPM/radio-box-01.png" /&gt;&lt;/center&gt;&lt;br /&gt;useless, isn't it ?&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;&lt;br /&gt;Now, let's add some parameters on the main function :&lt;br /&gt;The x, y coordinates of the top-left corner, to move the box :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 100 25&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S9X7vekobWI/AAAAAAAAAVY/mKY0Ed3xeEc/radio-box-02.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The font and the font size, to change the display :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Purisa 15&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S9X8tK4b9AI/AAAAAAAAAVc/WG0hH9glsqs/radio-box-03.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The informations to display, in the form ATBLYR where :&lt;br /&gt;&lt;pre&gt;A=Artist&lt;br /&gt;T=Track&lt;br /&gt;B=Album&lt;br /&gt;L=Label&lt;br /&gt;Y=Year&lt;br /&gt;R=Radio&lt;/pre&gt;&lt;br /&gt;Example :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 RATBLY&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S9X-DyGiIRI/AAAAAAAAAVk/PRvhutEuLMQ/radio-box-04.png" /&gt;&lt;/center&gt;&lt;br /&gt;Here you can see that the box auto-fit the text, both in height and width.&lt;br /&gt;&lt;br /&gt;The cover.&lt;br /&gt;If your script get the cover, you can display it, just set the path in the file &lt;code&gt;/tmp/radio.txt&lt;/code&gt;. To display, the cover use &lt;code&gt;1&lt;/code&gt;, other caracter to not display.&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 RATBLY 1&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S9X_XDulY-I/AAAAAAAAAVo/qiukNwEo_SI/radio-box-05.png" /&gt;&lt;/center&gt;&lt;br /&gt;If there is less text to dispaly, the cover will resize to the height of the text frame, like this&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB 1&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S9X_XTnPOUI/AAAAAAAAAVs/HvaNeYRG_bE/radio-box-06.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The border size :&lt;br /&gt;(In a reel conky, you should write all the parameters on one single line)&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATBY&lt;br /&gt;         1 7&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S9YA6fFHPFI/AAAAAAAAAVw/6ztEkltgrKY/radio-box-07.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The radius of the corners:&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATBY&lt;br /&gt;         1 3 15&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S9YFlgSdnuI/AAAAAAAAAV8/W3Nuin0Cjyg/radio-box-08.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 0 0&lt;/pre&gt;&lt;br /&gt;Bye, Sonny...&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S9YHBYfdmuI/AAAAAAAAAWA/6t40C5zUuJ0/radio-box-09.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The gap between the two frames:&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 3 3 60&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S9YIax2L-EI/AAAAAAAAAWE/pShhH7M3BZE/radio-box-10.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The light effect source, possibles values are :&lt;br /&gt;&lt;pre&gt;nw : Nord-West (default)&lt;br /&gt;nn : North-North&lt;br /&gt;ne : North-East&lt;br /&gt;ee : East-East&lt;br /&gt;se : South-East&lt;br /&gt;ss : South-South&lt;br /&gt;sw : South-West&lt;br /&gt;ww : West-West&lt;/pre&gt;&lt;br /&gt;Example for North-North :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 3 3 10 nn&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S9YJgpw45AI/AAAAAAAAAWI/My7tNDsGr70/radio-box-11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The colors of the frame (it's a linear gradient but if the two values are the same, there is no more gradient):&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 3 3 10 ee &lt;br /&gt;         FF0000  FFFF00 1 1 &lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S9YM6HptLMI/AAAAAAAAAWQ/OvuNTqZ-pfk/radio-box-12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The colors of the text :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15&lt;br /&gt;         ATB 1 3 3 10 ee &lt;br /&gt;         F00F00 FCFFC0 1 1 00FF00 00FFFF 1 1&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S9YM6K34FNI/AAAAAAAAAWU/AXSVC9hStNM/radio-box-13.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The colors of the border (the same of the main frame if they are not defined, but inversed)&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 5 5 10 sw &lt;br /&gt;         CCCCCC 000000 1 1 FFFF00 FFFFFF 1 1 000000 DDDDDD 1 1&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S9YNXF3l5PI/AAAAAAAAAWg/E3soOuogrkU/radio-box-14.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;More classical :&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATB&lt;br /&gt;         1 2 0 10 ww &lt;br /&gt;         CCCCCC CCCCCC 1 1 000000 000000 1 1 000000 000000 1 1&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S9YOAMAbubI/AAAAAAAAAWk/IiYROItwR7c/radio-box-15.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;While writing this note I add parameters for transparancy:&lt;br /&gt;&lt;pre&gt;lua_draw_hook_post main_radio_box /tmp/radio.txt 10 10 Japan 15 ATBLY&lt;br /&gt;         1 5 5 10 nw &lt;br /&gt;         000000 FFFFFF 0.3 0.3 FF0000 FF0000 0.5 0.5 000000 000000 1 0.2&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S9c6s0T_dMI/AAAAAAAAAXE/wHRKTKN00Xc/radio-box-16.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;I think I will add some effects on the cover if I can in the future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-1291016965873073052?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/1291016965873073052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/04/radio-box-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/1291016965873073052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/1291016965873073052'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/04/radio-box-widget.html' title='Radio Box Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_yHDbHcEhK7A/S9X6tmiEtUI/AAAAAAAAAVU/Am38e9pJkPM/s72-c/radio-box-01.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-283235652979665575</id><published>2010-04-09T05:34:00.000-07:00</published><updated>2010-05-28T16:16:02.603-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bash script'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Pie Chart &amp; Ring Widget</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh3.ggpht.com/_yHDbHcEhK7A/S7-tacjmj5I/AAAAAAAAASA/XOaQxmh7LuY/pie11.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 407px; height: 425px;" src="http://lh3.ggpht.com/_yHDbHcEhK7A/S7-tacjmj5I/AAAAAAAAASA/XOaQxmh7LuY/pie11.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Edit: v1.1 15/05/2010, widget can now draw a ring, see at bottom.&lt;br /&gt;&lt;br /&gt;Here is another widget for Conky... it's a pie-chart fully customizable. For example, for the circle in the above picture : it's a file system (yes it is!), each sector is proportional to the size of a disk, and two colors are used to draw a sector (one for used space, and one for free space).&lt;br /&gt;&lt;br /&gt;It can be downloaded from Ubuntu forums &lt;a href="http://ubuntuforums.org/showpost.php?p=9118129&amp;postcount=253"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You need &lt;b&gt;Conky 1.8.0&lt;/b&gt; to use it.&lt;br /&gt;To call it in a Lua script, you have to set parameters in a table:&lt;br /&gt;&lt;pre&gt;pie_settings= { table1, table2 ...}&lt;/pre&gt;&lt;br /&gt;Each table has is own parameters, only one is mandatory, it's &lt;code&gt;tableV&lt;/code&gt;, a table containing the values to display.&lt;br /&gt;&lt;br /&gt;Example of &lt;b&gt;tableV&lt;/b&gt;, of course, in real life, table is created by the script :&lt;br /&gt;&lt;pre&gt; -- table of labels and values &lt;br /&gt;    {{label1,conky_variable,conky_argument,convert to Go-Mo-Ko units (true/false) or unit}, ...}&lt;br /&gt; -- all the values are at maximum values in this example&lt;br /&gt; -- last parameter set to true means that the script &lt;br /&gt;    will convert the values in Go, Mo ...&lt;br /&gt; local k=1024*1024*1024&lt;br /&gt; tableV={{"/","",  k*50, k*50,true},&lt;br /&gt;  {"/home","", k*500, k*500,true},&lt;br /&gt;  {"/data","", k*1000, k*1000,true},&lt;br /&gt;  {"stuff","", k*10, k*10,true}&lt;br /&gt;  },&lt;/pre&gt;&lt;br /&gt;The Lua file contains a script which use the output of &lt;b&gt;df&lt;/b&gt; command, because this widget was made with the disks spaces in mind, but it can be use with any other value, like this (but it's not the purpose of the script, so we won't use it):&lt;br /&gt;&lt;pre&gt; tableV={{"cpu0","cpu", "cpu0",100,"%"},&lt;br /&gt;  {"cpu1","cpu", "cpu1",100,"%"},&lt;br /&gt;  {"fan","", "${exec sensors | grep 'CPU Fan' | cut -c13-16}", 2000," rpm"},&lt;br /&gt;  {"sys","", "${exec sensors | grep 'Sys Temp' | cut -c15-17}", 100,"°C"}   &lt;br /&gt; },&lt;/pre&gt;&lt;br /&gt;Examples of &lt;b&gt;tablebg&lt;/b&gt; and &lt;b&gt;tablefg&lt;/b&gt; (background and foreground colors):&lt;br /&gt;&lt;pre&gt; tablebg={{0xFFFFFF,0.5},&lt;br /&gt;  {0xFFFFFF,0.5},&lt;br /&gt;  {0xFFFFFF,0.5},&lt;br /&gt;  {0xFFFFFF,0.5}&lt;br /&gt;  },&lt;br /&gt; tablefg={{0xFF0000,1},&lt;br /&gt;  {0x00FF00,1},&lt;br /&gt;  {0x0000FF,1},&lt;br /&gt;  {0xFFFF00,1}&lt;br /&gt;  },&lt;/pre&gt;&lt;br /&gt;With the above parameters and these ones :&lt;br /&gt;&lt;pre&gt; xc=conky_window.width/2,&lt;br /&gt; yc=conky_window.height/2,&lt;br /&gt; int_radius=0,&lt;br /&gt; radius=100,&lt;br /&gt; first_angle=0,&lt;br /&gt; last_angle=360,&lt;br /&gt; proportional=true,&lt;br /&gt; gradient_effect=false,&lt;br /&gt; show_text=true,&lt;br /&gt; line_lgth=30,&lt;br /&gt; line_space=20,&lt;br /&gt; line_width=1,&lt;br /&gt; extend_line=true,&lt;br /&gt; txt_font="FreeSans",&lt;br /&gt; font_size=12,&lt;br /&gt; font_color=nil,&lt;br /&gt; font_alpha=1,&lt;br /&gt; txt_offset=1,&lt;br /&gt; txt_format="&amp;amp;m",&lt;br /&gt; nb_decimals=0,&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;we obtain this simple kind of chart&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S79AJX5ejLI/AAAAAAAAAQA/4oEOZ3jahHc/pie1.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;If the number of values in a colors table is less than the number of sectors, like that :&lt;br /&gt;&lt;pre&gt; tablefg={{0xFF0000,1},&lt;br /&gt;  {0xFFFF00,1}},&lt;/pre&gt;&lt;br /&gt;colors restart at the end of the table :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S79CmfiX-aI/AAAAAAAAAQE/Xt8cCYhdSrE/pie2.png" /&gt;&lt;/center&gt;&lt;br /&gt;Now, if we change the second parameter of &lt;b&gt;tableV&lt;/b&gt;, the value for each sector, we change the way the graph is displayed.&lt;br /&gt;&lt;pre&gt; local k=1024*1024*1024&lt;br /&gt; tableV={{"/",  .25*k*50, k*50,true},&lt;br /&gt;  {"/home", .50*k*500, k*500,true},&lt;br /&gt;  {"/data", .75*k*1000, k*1000,true},&lt;br /&gt;  {"stuff", .90*k*10, k*10,true}&lt;br /&gt;  },&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S79GbKCjuTI/AAAAAAAAAQM/J20ZcZA4lCU/pie3.png" /&gt;&lt;/center&gt;&lt;br /&gt;This is what I wanted to display on my desktop : the amount of used space on my external or internal drives and the proportion of each drive in the full file system. Like the big arc on first picture, I have to clean some disks ...&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Now, have a look to more interestings parameters ;-)&lt;br /&gt;With &lt;code&gt;int_radius=50,&lt;/code&gt; (internal radius)&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S79Hm4plRtI/AAAAAAAAAQQ/aEh8Nmp2nZc/pie4.png" /&gt;&lt;/center&gt;&lt;br /&gt;For the angles, (O° is North and angles go clockwise),&lt;br /&gt;&lt;pre&gt; first_angle=-45&lt;br /&gt; last_angle=180&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S79IZNa8oXI/AAAAAAAAAQU/Ny2sMXdiZGs/pie5.png" /&gt;&lt;/center&gt;&lt;br /&gt;Back to full circle and &lt;code&gt;proportional&lt;/code&gt; parameter:&lt;br /&gt;&lt;pre&gt; first_angle=0,&lt;br /&gt; last_angle=360,&lt;br /&gt; proportional=false,&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S79JfhX8MRI/AAAAAAAAAQY/2zCrYIWjkuI/pie6.png" /&gt;&lt;/center&gt;&lt;br /&gt;Back to &lt;code&gt;proportional=true&lt;/code&gt; and adding some gradient and hiding text &lt;pre&gt; proportional=true,&lt;br /&gt; gradient_effect=true,&lt;br /&gt; show_text=false,&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S79LiifEusI/AAAAAAAAAQc/bZUrMuGT1iQ/pie7.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;By the way, here is an interesting script to toggle the text (or others flags) when the conky is running.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;In the Lua script :&lt;/span&gt;&lt;br /&gt;&lt;pre style="color: rgb(51, 51, 255);"&gt; local file = io.open("/tmp/flag-conky","r")&lt;br /&gt; io.close()&lt;br /&gt; show_text=(file == nil)&lt;/pre&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;And a bash script associated with a keyboard shortcut:&lt;/span&gt;&lt;br /&gt;&lt;pre style="color: rgb(51, 51, 255);"&gt; #!/bin/bash&lt;br /&gt; flag="/tmp/flag-conky"&lt;br /&gt; if [ -f $flag ]; then&lt;br /&gt;  rm $flag&lt;br /&gt; else&lt;br /&gt;  echo &gt; $flag&lt;br /&gt; fi&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;b&gt;The lines options&lt;/b&gt;&lt;br /&gt;&lt;pre&gt; line_lgth=100&lt;br /&gt; line_width=4&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S79OjK3Nr2I/AAAAAAAAAQg/LHbwYMEVWCA/pie8.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;code&gt;line_space&lt;/code&gt; can be usefull when labels are too close:&lt;br /&gt;&lt;pre&gt;--for the second arc (yellow and blue labels are separated)&lt;br /&gt; first_angle=0,&lt;br /&gt; last_angle=90,&lt;br /&gt; line_space=20,&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S79xyY4lSkI/AAAAAAAAARU/axTrkOE6vr4/pie9.png" /&gt;&lt;/center&gt;&lt;br /&gt;Last parameter for lines is &lt;code&gt;extend_line&lt;/code&gt; which will extend the horizontal line if the text is too long, with &lt;code&gt;extend_line=true&lt;/code&gt; on the second arc :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S792mqz182I/AAAAAAAAARY/b-ln2jIF070/pie10.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;b&gt;The text options&lt;/b&gt;&lt;br /&gt;&lt;code&gt;txt_font&lt;/code&gt; and &lt;code&gt;font_size&lt;/code&gt; are obvious.&lt;br /&gt;&lt;code&gt;font_color&lt;/code&gt; and &lt;code&gt;font_alpha&lt;/code&gt; create a linear gradient. To keep text color the same color of the line, set &lt;code&gt;font_color=nil&lt;/code&gt;&lt;br /&gt;&lt;code&gt;txt_offset&lt;/code&gt; is the space between the line and the text&lt;br /&gt;&lt;code&gt;nb_decimals&lt;/code&gt; is the number of decimals for the numbers ;-)&lt;br /&gt;With&lt;br /&gt;&lt;pre&gt; txt_font="FreeSans",&lt;br /&gt; font_size=12,&lt;br /&gt; font_color=0xFFFFFF,&lt;br /&gt; font_alpha=0.75,&lt;br /&gt; txt_offset=1,&lt;br /&gt; nb_decimals=1,&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh3.ggpht.com/_yHDbHcEhK7A/S7-tacjmj5I/AAAAAAAAASA/XOaQxmh7LuY/pie11.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;The last parameter &lt;code&gt;txt_format&lt;/code&gt; is the string for formating texts. Some tags can be used : &lt;br /&gt;&lt;pre&gt;&lt;br /&gt; -- &amp;l for label (the first value of tableV)&lt;br /&gt; -- &amp;v for value (the second value of tableV)&lt;br /&gt; -- &amp;m for max value (the third value of tableV)&lt;br /&gt; -- &amp;o for occupied percentage (ie tableV[2]/tableV[3])&lt;br /&gt; -- &amp;f for free percentage (ie tableV[3] - tableV[2]/tableV[3])&lt;br /&gt; -- &amp;n for free value (non-occupied) (ie tableV[3] - tableV[2])&lt;/pre&gt; &lt;br /&gt;With &lt;br /&gt;&lt;pre&gt; txt_format="&amp;l &amp;m, free &amp;f",&lt;br /&gt; nb_decimals=0,&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S7-wbN_hwMI/AAAAAAAAASE/cG6kICqJ_BA/pie12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;That's all ;-)&lt;br /&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;Edit : a last example  (code is &lt;a href="http://ubuntuforums.org/showthread.php?t=281865&amp;page=12090"&gt;here&lt;/a&gt; ):&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S8n6ToBS2tI/AAAAAAAAAUw/R6WUO5mU1XA/pie12.png" /&gt;&lt;/center&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;Edit for version 1.1, I added the parameter &lt;code&gt;type_arc&lt;/code&gt;. If type arc is "&lt;code&gt;r&lt;/code&gt;" (the default value) values are displayed on a radial way as before :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S-6BYOazWJI/AAAAAAAAAcA/OqC1DfMHgYc/pie-13.png"/&gt;&lt;/center&gt;&lt;br /&gt;but if &lt;code&gt;type_arc="l"&lt;/code&gt; (l for linear) then values are dispayed like rings :&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh4.ggpht.com/_yHDbHcEhK7A/S-6BYLmJbXI/AAAAAAAAAcE/euy1NfYkRgE/pie-14.png"/&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-283235652979665575?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/283235652979665575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/04/pie-chart-widget.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/283235652979665575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/283235652979665575'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/04/pie-chart-widget.html' title='Pie Chart &amp; Ring Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_yHDbHcEhK7A/S7-tacjmj5I/AAAAAAAAASA/XOaQxmh7LuY/s72-c/pie11.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-719571504474989543</id><published>2010-04-07T09:31:00.000-07:00</published><updated>2010-04-16T12:20:32.752-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='imlib'/><category scheme='http://www.blogger.com/atom/ns#' term='bash script'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Square to Rounded image with Lua/imlib</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_yHDbHcEhK7A/S7y1-UH_NEI/AAAAAAAAAO4/lAOc8PP9d08/s1600/moon-earth.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 194px;" src="http://3.bp.blogspot.com/_yHDbHcEhK7A/S7y1-UH_NEI/AAAAAAAAAO4/lAOc8PP9d08/s400/moon-earth.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5457436930624926786" /&gt;&lt;/a&gt;&lt;br /&gt;I wanted to display Moon and Earth pictures on my conky but the only images I found where squares images with a black background and the Moon or the Earth in the middle. &lt;br /&gt;So to display the image correctly in the conky, I had to set transparency of the background of the original image. Well, I've done that with imlib and post the resulting script &lt;a href="http://ubuntuforums.org/showpost.php?p=9088516&amp;postcount=244"&gt;here&lt;/a&gt; (or in french &lt;a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3389351#p3389351"&gt;here&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;I also post the script to get Earth or Moon images from this site :&lt;br /&gt;&lt;a href="http://www.fourmilab.ch/earthview/expert.html"&gt;http://www.fourmilab.ch/earthview/expert.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Of course the images are updated every hour so the night area is reflecting the reality !&lt;br /&gt;And of course again, there are a few parameters to set the latitude, longitude and so on ...&lt;br /&gt;&lt;br /&gt;If you are inspired, you can have some amazing conkys like this one :&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S7y5h2wZr1I/AAAAAAAAAPg/_pLEzY5xNc4/moon.png"/&gt;&lt;/center&gt;&lt;br /&gt;or that:&lt;br /&gt;&lt;center&gt;&lt;img src='http://lh5.ggpht.com/_yHDbHcEhK7A/S7y5h1gFY4I/AAAAAAAAAPc/byYoSY7YbkQ/earth.png'/&gt;&lt;/center&gt;&lt;br /&gt;&lt;hr/&gt;&lt;br /&gt;I also updated the clock and the calendar wheel (this one is now a widget and it is more easy to use it).&lt;br /&gt;And I discover that the widgets can be called with the &lt;span style="font-weight:bold;"&gt;dofile()&lt;/span&gt; function in the Lua script. No more need to copy/paste the widget but to use a line like this :&lt;br /&gt;&lt;code&gt;dofile("/home/wlourf/calendar/calendar.lua")&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-719571504474989543?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/719571504474989543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/04/square-to-rounded-image-with-luaimlib.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/719571504474989543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/719571504474989543'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/04/square-to-rounded-image-with-luaimlib.html' title='Square to Rounded image with Lua/imlib'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_yHDbHcEhK7A/S7y1-UH_NEI/AAAAAAAAAO4/lAOc8PP9d08/s72-c/moon-earth.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-572354842801619206</id><published>2010-03-31T12:45:00.000-07:00</published><updated>2010-03-31T14:14:39.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Automatic logout for kids</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_yHDbHcEhK7A/S7OvYQPXERI/AAAAAAAAAOU/lXMKkv1CEHs/s1600/logout.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 386px; height: 56px;" src="http://2.bp.blogspot.com/_yHDbHcEhK7A/S7OvYQPXERI/AAAAAAAAAOU/lXMKkv1CEHs/s400/logout.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5454896404886917394" /&gt;&lt;/a&gt;&lt;br /&gt;I have a little problem with my little kid : when he plays on computer, I have to tell him at least 10 times to stop when his time is up !&lt;br /&gt;So I wrote this conky (to use in Gnome) that will display remaining time and logout the session !&lt;br /&gt;And after that, if he tries to login again, the session will run only 30 seconds ;-)&lt;br /&gt;&lt;br /&gt;Of course, it's for a small kid who doesn't know commands like "killall conky" or tricks like that !&lt;br /&gt;&lt;br /&gt;First, create a hidden folder in the kid session :&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;code&gt;mkdir ~/.logout/&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and create the next 3 files in the folder:&lt;br /&gt;&lt;b&gt;the conkyrc-logout&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;double_buffer yes&lt;br /&gt;no_buffers yes&lt;br /&gt;&lt;br /&gt;#own_window yes&lt;br /&gt;own_window_type desktop&lt;br /&gt;own_window_transparent yes&lt;br /&gt;own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below&lt;br /&gt;&lt;br /&gt;border_inner_margin 0&lt;br /&gt;border_outer_margin 0&lt;br /&gt;&lt;br /&gt;# X font when Xft is disabled, you can pick one with program xfontsel&lt;br /&gt;font 7x13&lt;br /&gt;&lt;br /&gt;# Use Xft?&lt;br /&gt;use_xft yes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Xft font when Xft is enabled&lt;br /&gt;xftfont monospace-18&lt;br /&gt;&lt;br /&gt;# Text alpha when using Xft&lt;br /&gt;xftalpha 0.5&lt;br /&gt;&lt;br /&gt;# Draw shades?&lt;br /&gt;draw_shades yes&lt;br /&gt;&lt;br /&gt;# Stippled borders?&lt;br /&gt;stippled_borders 0&lt;br /&gt;&lt;br /&gt;# Default colors and also border colors&lt;br /&gt;default_color yellow&lt;br /&gt;default_shade_color blue&lt;br /&gt;&lt;br /&gt;alignment br&lt;br /&gt;gap_x 1&lt;br /&gt;gap_y 1&lt;br /&gt;&lt;br /&gt;# Add spaces to keep things from moving about?  This only affects certain objects.&lt;br /&gt;use_spacer right&lt;br /&gt;&lt;br /&gt;# Subtract file system buffers from used memory?&lt;br /&gt;no_buffers yes&lt;br /&gt;&lt;br /&gt;TEXT&lt;br /&gt;Stop in ${exec ~/.logout/time_left.sh}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The script &lt;b&gt;time_left.sh&lt;/b&gt; which send remaining time to the conky :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;#! /bin/bash&lt;br /&gt;&lt;br /&gt;#st in seconds&lt;br /&gt;st=$(~/.logout/read_time.sh)&lt;br /&gt;&lt;br /&gt;RUNTIME=$((st))&lt;br /&gt;SECOND=$((RUNTIME%60))&lt;br /&gt;MINUTE=$((RUNTIME/60%60))&lt;br /&gt;HOUR=$((RUNTIME/3600))&lt;br /&gt;&lt;br /&gt;if [ "$SECOND" -lt 10 ]; then&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/code&gt;&lt;code&gt;&lt;span style="font-size:85%;"&gt;SECOND="0$SECOND"&lt;br /&gt;fi&lt;br /&gt;if [ "$MINUTE" -lt 10 ]; then&lt;br /&gt; MINUTE="0$MINUTE"&lt;br /&gt;fi&lt;br /&gt;if [ "$HOUR" -lt 10 ]; then&lt;br /&gt; HOUR="0$HOUR"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;echo $HOUR":"$MINUTE":"$SECOND&lt;br /&gt;if [ "$RUNTIME" -lt 0 ]; then&lt;br /&gt; gnome-session-save --force-logout&lt;br /&gt;fi&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The script &lt;b&gt;read_time.sh&lt;/b&gt; which read remaining time and save it in a file &lt;b&gt;.counter.txt&lt;/b&gt;&lt;br /&gt;The default time for a day is one hour (3600 secondes) on line 4.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;#! /bin/bash&lt;br /&gt;&lt;br /&gt;log=~/.logout/.counter.txt&lt;br /&gt;duration=3600&lt;br /&gt;&lt;br /&gt;if [ ! -f $log ]; then&lt;br /&gt;echo "no file"&lt;br /&gt;echo $(date +%Y%m%d)";"$duration &gt; $log&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;today=$(date +%Y%m%d)&lt;br /&gt;&lt;br /&gt;reste=-1&lt;br /&gt;line=`tail $log`&lt;br /&gt;&lt;br /&gt;xday=$(echo $line | cut -d";" -f1)&lt;br /&gt;if [ $xday -eq $today ]; then&lt;br /&gt;reste=$(echo $line | cut -d";" -f2)&lt;br /&gt;hasdate=true&lt;br /&gt;if [ $reste -lt 0 ]; then&lt;br /&gt; reste=30&lt;br /&gt;fi&lt;br /&gt;reste=$((reste-1))&lt;br /&gt;else&lt;br /&gt;reste=$duree&lt;br /&gt;fi&lt;br /&gt;echo $today";"$reste &gt; $log&lt;br /&gt;&lt;br /&gt;echo $reste&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To run it at startup, add this line in gnome startup:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;code&gt;conky -c ~/.logout/conkyrc-logout&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Voilà ! I'm sure there is other to do that, but I like the display of the remaining time...&lt;br /&gt;Make sure the paths are OK for in the three files and don't forget to make the scripts executables&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The script in french &lt;a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3366873#p3366873"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-572354842801619206?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/572354842801619206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/03/automatic-logout-for-kids.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/572354842801619206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/572354842801619206'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/03/automatic-logout-for-kids.html' title='Automatic logout for kids'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_yHDbHcEhK7A/S7OvYQPXERI/AAAAAAAAAOU/lXMKkv1CEHs/s72-c/logout.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-484296764832705235</id><published>2010-03-19T23:36:00.001-07:00</published><updated>2010-03-20T00:16:47.018-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='smiley'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Smiley Widget</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_yHDbHcEhK7A/S6RtGRJ5-GI/AAAAAAAAANU/f-rL17KvImo/s1600-h/capture_smiley2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 282px;" src="http://1.bp.blogspot.com/_yHDbHcEhK7A/S6RtGRJ5-GI/AAAAAAAAANU/f-rL17KvImo/s400/capture_smiley2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5450601403476736098" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a new widget which can give at least four informations if you can read it, which is not really easy at first glance.&lt;br /&gt;Each eye and the smile can be linked to a conky variable or not and color can change.&lt;br /&gt;The code for the script can be downloaded on &lt;a href="http://ubuntuforums.org/showthread.php?p=8994422#post8994422"&gt;ubuntu forum&lt;/a&gt; or on &lt;a href="http://linux-hardcore.com/index.php?topic=2460.msg17648#msg17648"&gt;CH forum&lt;/a&gt; (or in french &lt;a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3349415#p3349415"&gt;here&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Parameters are explained in the Lua script, but there is a short example :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;draw_smiley(200,175,120,4,0xFFFF00,false,true,false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;"downspeedf", "wlan0",1000, false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;"upspeedf", "wlan0",100, false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;"wireless_link_qual_perc","wlan0",100,false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;"acpitemp","",80,&lt;br /&gt;&amp;nbsp;&amp;nbsp;-0.5)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And the function with named arguments&lt;br /&gt;&lt;code&gt;function draw_smiley(xc,yc,radius1,shadow_size,color0,compo_r,compo_g,compo_b,&lt;br /&gt;&amp;nbsp;&amp;nbsp;le_name,le_arg,le_max,le_inv,&lt;br /&gt;&amp;nbsp;&amp;nbsp;re_name,re_arg,re_max,re_inv,&lt;br /&gt;&amp;nbsp;&amp;nbsp;mouth_name,mouth_arg,mouth_max,mouth_inv,&lt;br /&gt;&amp;nbsp;&amp;nbsp;color_name,color_arg,color_max,&lt;br /&gt;&amp;nbsp;&amp;nbsp;rotation)&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;From last to first :&lt;br /&gt;-last line :rotation is the angle in radian of rotation of the smiley&lt;br /&gt;-lines 2 to 5 are where we choose values to display. On line 2, it will display the download speed of wlan0, the value need to be in percent so we have to set the max value (1000 in my case). The last parameters will inverse the value if needed, ie. if value is 80%, it will draw a 20% value.&lt;br /&gt;- first line : xc, yc, radius1 are for positionning the smiley in the conky window&lt;br /&gt;- first line : shadow_size will draw a shadow ;-)&lt;br /&gt;- first line : color0, compo_r, compo_g, compo_b are parameters for having color changing, for the example above:&lt;br /&gt;&lt;code&gt;0xFFFF00,false,true,false,&lt;/code&gt; &lt;br /&gt;with&lt;br /&gt;&lt;code&gt;"acpitemp","",80,&lt;/code&gt;&lt;br /&gt;The color will change between 0 and 80, at zero, color will be 0xFFFF00 (yellow) and when $acpitemp will increase, green composante will be affected, so when 80°C is reached, the color will be 0xFF0000 (red).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Last warnings&lt;/u&gt; :&lt;br /&gt;Fixed values can be used instead of conky variables with name="" and arg=value (80% in this case): &lt;code&gt;"",80,100,false,&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you call more than one widget : &lt;code&gt;xc, yc and rotation&lt;/code&gt; are  RELATIVES to previous widget.&lt;br /&gt;&lt;br /&gt;Voilà!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-484296764832705235?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/484296764832705235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/03/smiley-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/484296764832705235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/484296764832705235'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/03/smiley-widget.html' title='Smiley Widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_yHDbHcEhK7A/S6RtGRJ5-GI/AAAAAAAAANU/f-rL17KvImo/s72-c/capture_smiley2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-3149665707881142714</id><published>2010-03-10T13:56:00.000-08:00</published><updated>2010-04-29T12:23:30.587-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openbox'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>How to display Openbox's Shortcuts</title><content type='html'>&lt;img src="http://lh5.ggpht.com/_yHDbHcEhK7A/S5gZ6cCnr7I/AAAAAAAAAMo/VE_e2ikpYw0/s800/sc_kb.png" /&gt;&lt;br /&gt;I am an Openbox + Ubuntu user but sometimes, I can't remember some shortcuts. So I wrote a script to display the shorcuts (keyboard+mouse) from rc.xml in a conky window, and this window is called with a shortcut (!) only when I need it, it's a kind of help window :-)&lt;br /&gt;&lt;br /&gt;Maybe this kind of script already exist but I didn't find it .&lt;br /&gt;&lt;br /&gt;All the scripts can be downloaded from &lt;a href="http://ubuntuforums.org/showpost.php?p=8944570&amp;amp;postcount=221"&gt;ubuntu forums&lt;/a&gt;.&lt;br /&gt;In french, it's here on &lt;a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3321621#p3321621"&gt;ubuntu-fr forum&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;First I need a conkyrc template.&lt;br /&gt;The python script will read this file and write shortcuts at the end of this file but in a new file.&lt;br /&gt;The only thing to do in this file is to choose your colors for display.&lt;br /&gt;The name of the file is &lt;span style="font-weight: bold;"&gt;conky_template&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Second, the python script &lt;span style="font-weight: bold;"&gt;shortcuts.py&lt;/span&gt; read the openbox's rc.xml file.&lt;br /&gt;There are some parameters to set at the beginning of the script :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;#full path and name of the rc.xml file&lt;br /&gt;rc_path_file="/home/ll/.config/openbox/rc.xml"&lt;br /&gt;#template of conkyrc to use&lt;br /&gt;conkytemplate_path_file ="/home/wlourf/scripts/raccourcis/conky_template"&lt;br /&gt;&lt;br /&gt;#column width (Ms = souris, Kb= clavier)&lt;br /&gt;lgColMs=50&lt;br /&gt;lgColKb=40&lt;br /&gt;&lt;br /&gt;#Number of lines per Column (Ms = souris, Kb= clavier)&lt;br /&gt;nbLnMs=30&lt;br /&gt;nbLnKb=30&lt;br /&gt;&lt;br /&gt;#in "Keyboard" array, "appliFirst" will display application name before shorcut&lt;br /&gt;appliFirst=True&lt;br /&gt;&lt;br /&gt;#END OF THE PARAMETERS !&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Third, a little bash script &lt;span style="font-weight: bold;"&gt;launcher.sh&lt;/span&gt; needed to run the python script and to call conky. Don't forget to make it executable.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And, for finish, in rc.xml, two shortcuts to run launcher.sh with parameters :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;command&amp;gt;/home/wlourf/scripts/raccourcis/launcher.sh /tmp/conky_kb k&amp;lt;/command&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;command&amp;gt;/home/wlourf/scripts/raccourcis/launcher.sh /tmp/conky_ms m&amp;lt;/command&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Voilà, when I call the script, the conky display the above image for the keyboard or this one for the mouse :&lt;br /&gt;&lt;img src="http://lh6.ggpht.com/_yHDbHcEhK7A/S5gaeYRgKhI/AAAAAAAAANM/DhKgR3SeVbM/s800/sc_ms.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Today I also updated the audio_spectrum script : it can display the bargraph widget in a circular way, like this :&lt;br /&gt;&lt;img src="http://img697.imageshack.us/img697/5430/widgetcircular.png" border="0" /&gt;&lt;br /&gt;And a short video :&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/rcM9nTKeC74&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/rcM9nTKeC74&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-3149665707881142714?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/3149665707881142714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/03/how-to-display-openboxs-shortcuts.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3149665707881142714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3149665707881142714'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/03/how-to-display-openboxs-shortcuts.html' title='How to display Openbox&apos;s Shortcuts'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_yHDbHcEhK7A/S5gZ6cCnr7I/AAAAAAAAAMo/VE_e2ikpYw0/s72-c/sc_kb.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-4623351663055740923</id><published>2010-03-01T14:27:00.000-08:00</published><updated>2010-03-01T14:43:36.262-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Bleeding heart ...</title><content type='html'>&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/oeNTK7_20wk&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/oeNTK7_20wk&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;I made this amazing heart with a Lua script. The verticals lines are linked to some conky variables (cpu, download speed ...).&lt;br /&gt;It's up to the user to choose the shape he wants to draw, for example a breathing heart :&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/zuf6IBtS-Hs&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/zuf6IBtS-Hs&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Well, I am not specially interesting by hearts but I tried to adhere to the theme of the conky contest of this month : &lt;span style="font-weight:bold;"&gt;Saint Valentine's Day/Massacre&lt;/span&gt;. So, if you like this script,&lt;a href="http://blog.conky.be/2010/03/01/please-vote-on-februarys-cotm-entries/"&gt; you can vote for it on the conky blog &lt;span style="text-decoration: underline;"&gt;&lt;span style="font-weight: bold;"&gt;here.&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A last video made with the same script :&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/bJxDKyd3UJs&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/bJxDKyd3UJs&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;All the stuff can be downloaded from the ubuntu forum : &lt;a href="http://ubuntuforums.org/showpost.php?p=8886584&amp;amp;postcount=193"&gt;here&lt;/a&gt;. There is also an HOWTO if you want to draw your own shapes!&lt;br /&gt;&lt;br /&gt;I think, I will stop with this moving stuff for a while !&lt;br /&gt;&lt;br /&gt;Happy Conkying ! And if someone can explain me the difference between "bleeding" and "bloody" ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-4623351663055740923?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/4623351663055740923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/03/bleeding-heart.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4623351663055740923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/4623351663055740923'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/03/bleeding-heart.html' title='Bleeding heart ...'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-2630662763555592084</id><published>2010-02-28T12:55:00.000-08:00</published><updated>2010-02-28T13:11:06.067-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='audio spectrum'/><category scheme='http://www.blogger.com/atom/ns#' term='equalizer'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Audio Spectrum Analyser / Equalizer</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/hP9Wt7YKoHM&amp;hl=fr_FR&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/hP9Wt7YKoHM&amp;hl=fr_FR&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;As you can see on this video, we can make some funny things with conky. (With recordmydesktop, I don't have a nice sound, and sound is not synchro to the video, sorry for that).&lt;br /&gt;After drawing some bargraphs with Lua, I tried to draw an audio spectrum. This has nothing to do with Conky or Lua but all the work was already done for a screenlet named &lt;a href="http://impulse.ian-halpern.com/"&gt;Impulse&lt;/a&gt; for gnome ().&lt;br /&gt;&lt;br /&gt;This screenlet use a C library and some python bindings for drawing the spectrum. The main work to port this to conky was to translate drawing from python to lua and it was quiet easy. &lt;br /&gt;I tried to make lua bindings for the C library but I didn't managed because I don't know C ! Even after reading this &lt;a href="http://www.wellho.net/mouth/1844_Calling-functions-in-C-from-your-Lua-script-a-first-HowTo.html"&gt;HowTo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;How the conky works ?&lt;br /&gt;conkyrc load the Lua script and run the main function in Lua. This function create a pipe to the python binding linked to the C library at first run of the conky. After that, the Lua script read the values returned by python and draw the equalizer.&lt;br /&gt;Also, I included the bargraph widget in the lua script so the spectrum can be more colorized ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-2630662763555592084?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/2630662763555592084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/02/audio-spectrum-analyser-equalizer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/2630662763555592084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/2630662763555592084'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/02/audio-spectrum-analyser-equalizer.html' title='Audio Spectrum Analyser / Equalizer'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-3758580519527548248</id><published>2010-02-28T04:25:00.000-08:00</published><updated>2010-07-14T15:06:46.502-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bargraph'/><category scheme='http://www.blogger.com/atom/ns#' term='equalizer'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Bargraph widget</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_yHDbHcEhK7A/S3SMgc3K_eI/AAAAAAAAAL8/0RNa-PixYOQ/s1600-h/equalizer_widget.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 392px; height: 400px;" src="http://2.bp.blogspot.com/_yHDbHcEhK7A/S3SMgc3K_eI/AAAAAAAAAL8/0RNa-PixYOQ/s400/equalizer_widget.png" alt="" id="BLOGGER_PHOTO_ID_5437125139274333666" border="0" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);font-size:100%;" &gt;&lt;br /&gt;The version 2.0 of the bargraph is located &lt;a href="http://u-scripts.blogspot.com/2010/07/bargraph-widget.html"&gt;here&lt;/a&gt; : I add more effects and it is more easy to configure with a table of settings :-)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;While looking at an old hifi system with green and red equalizer, I tried to do the same with cairo. But with the powerful of cairo, we can do more than simple bar graph. So I wrote this script, really simple to use even if there are 20 parameters to set. But as you can see on the picture, the effects are well rendering!&lt;br /&gt;&lt;br /&gt;22. Feb 2020:&lt;br /&gt;I just updated the widget so it can receives not only conky stats but also numeric values.&lt;br /&gt;For use with conky stat :&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;code&gt;      equalizer('cpu', 'cpu0', ...&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;for use with numeric values:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;code&gt;      equalizer('', my_value, ...&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I'have done that because I wanted to retain previous values from conky stats in order to display a progressing graph like on this video :&lt;br /&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/qv7IvnRWdvo&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/qv7IvnRWdvo&amp;amp;hl=fr_FR&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="344" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;It's absolutely useless, isn't it !&lt;br /&gt;&lt;br /&gt;The code for the video is &lt;a href="http://crunchbanglinux.org/forums/post/55326/#p55326"&gt;on the crunbang forum&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;28 Feb. 2010:&lt;br /&gt;I renamed the widget from 'equalizer' to 'bargraph'&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Last version can be downloaded from ubuntu forums : &lt;a href="http://ubuntuforums.org/showpost.php?p=8812016&amp;amp;postcount=171"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Happy conkying!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-3758580519527548248?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/3758580519527548248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/02/bargraph-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3758580519527548248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/3758580519527548248'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/02/bargraph-widget.html' title='Bargraph widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_yHDbHcEhK7A/S3SMgc3K_eI/AAAAAAAAAL8/0RNa-PixYOQ/s72-c/equalizer_widget.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-5133347312019635550</id><published>2010-02-23T13:27:00.000-08:00</published><updated>2011-02-09T14:31:51.481-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='widget'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Links Index !</title><content type='html'>This page is the reference points for all the little scripts for Conky I posted around.&lt;br /&gt;It will make life easier for people using theses scripts when they're looking for latest versions.&lt;br /&gt;&lt;br /&gt;Recents updated scripts are on top!&lt;br /&gt;First link is the link to the download page, second link is the link to the presentation page in this blog&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/#/d36njc0"&gt;Text widget&lt;/a&gt; (v1.42 - 09/02/2011) &lt;a href="http://u-scripts.blogspot.com/2010/06/text-widget.html"&gt;blog&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/art/Box-widget-for-conky-1-1-195130450"&gt;Box widget&lt;/a&gt; (v1.1 - 27/01/2011)&lt;a href="http://u-scripts.blogspot.com/2011/01/box-widget_27.html"&gt; blog&lt;/a&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/gallery/?offset=0#/d2jj1rz"&gt;Bargraph widget&lt;/a&gt; (v2.1 - 07/01/2011) &lt;a href="http://u-scripts.blogspot.com/2010/07/bargraph-widget.html"&gt;blog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/gallery/#/d2qo9sz"&gt;Pie Chart widget&lt;/a&gt;  (v1.3 - 07/01/2011) &lt;a target="_new" href="http://u-scripts.blogspot.com/2010/04/pie-chart-widget.html"&gt;blog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/gallery/#/d31vd5m"&gt;Graph widget&lt;/a&gt; (v1.1 - 07/01/2011) &lt;a href="http://u-scripts.blogspot.com/2010/10/graph-widget.html"&gt;blog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://wlourf.deviantart.com/art/Rings-And-Sectors-Conky-1-1-174493100"&gt;Rings + Sectors Widget&lt;/a&gt; (v1.1 - 07/01/2011) &lt;a href="http://u-scripts.blogspot.com/2010/08/rings-sectors-widgets.html"&gt;blog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ubuntuforums.org/showpost.php?p=9305855&amp;amp;postcount=12648"&gt;Calendar box&lt;/a&gt; (v1.0 - 14/05/2010) &lt;a href="http://u-scripts.blogspot.com/2010/05/calendar-box.html"&gt;blog&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8944570&amp;amp;postcount=221"&gt;Openbox's shortcuts&lt;/a&gt; (v1.2 - 02/05/2010)&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showthread.php?p=9183570#post9183570"&gt;Radio box widget&lt;/a&gt; (v1.0 - 27/04/2010)&lt;/li&gt; &lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=9088516&amp;amp;postcount=244"&gt;SquareToRound Script&lt;/a&gt; (v1.0 - 07/04/2010) with scripts for Moon and Earth pictures&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8782789&amp;amp;postcount=147"&gt;Calendar Wheel&lt;/a&gt; (v1.4.1 - 07/04/2010)&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8788718&amp;amp;postcount=12002"&gt;Shaded Clock&lt;/a&gt; (v1.2 - 06/04/2010)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://u-scripts.blogspot.com/2010/03/automatic-logout-for-kids.html"&gt;Automatic logout for kids&lt;/a&gt; (v1.0 - 31/03/2010)&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showthread.php?p=8994422#post8994422"&gt;Smiley widget&lt;/a&gt; (v1.0 - 19/03/2010)&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8861782&amp;amp;postcount=175"&gt;Audio Spectrum Analyser/Equalizer&lt;/a&gt; (v1.2 - 10/03/2010)&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8886584&amp;amp;postcount=193"&gt;Bleeding Heart&lt;/a&gt; (v1.0 - 26/02/2010)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a target="_new" href="http://ubuntuforums.org/showpost.php?p=8601909&amp;amp;postcount=121"&gt;Photo Album Stack&lt;/a&gt; (v1.1 -31/01/2010) with scripts for deviantArt&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-5133347312019635550?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/5133347312019635550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/02/links-index.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5133347312019635550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/5133347312019635550'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/02/links-index.html' title='Links Index !'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-7954300755814712748</id><published>2010-02-02T09:54:00.000-08:00</published><updated>2010-03-31T14:02:33.377-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deviantart'/><category scheme='http://www.blogger.com/atom/ns#' term='bash script'/><title type='text'>How to get pictures from RSS feeds from deviantArt (get_deviation_search.sh v1.0)</title><content type='html'>Each time you make a research on deviantArt web site (or when you browse a category) a RSS feed is generated.&lt;br /&gt;For example, to see the &lt;a href="http://www.deviantart.com/#catpath=digitalart/fractals&amp;amp;order=5"&gt;newest&lt;/a&gt; deviations in the fractal category, the rss feed generated at the bottom of the page is &lt;a href="http://backend.deviantart.com/rss.xml?q=in%3Adigitalart/fractals%20sort%3Atime&amp;amp;type=deviation"&gt;http://backend.deviantart.com/rss.xml?q=in%3Adigitalart/fractals%20sort%3Atime&amp;amp;type=deviation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For my &lt;a href="http://u-scripts.blogspot.com/2010/01/phot-album-stack.html"&gt;Photo Album script&lt;/a&gt;, I wanted to download/save pictures from the RSS feed to my hard drive.&lt;br /&gt;Well, I wrote something and it works but it certainly can be improve!&lt;br /&gt;&lt;br /&gt;I call this script : &lt;b&gt;get_deviation_search.sh&lt;/b&gt; and it should be run with at least three arguments:&lt;br /&gt;1st arg : folder where to save the pictures&lt;br /&gt;2nd arg : delay (in minutes) for repeating the script (0 is for a single run)&lt;br /&gt;3rd arg and following : urls of the rss feed to follow&lt;br /&gt;and more parameters can be set inside the script&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#example for photomanipulations, fractals categories and research for "conky"&lt;br /&gt;&lt;br /&gt;./get_deviation_search.sh /home/wlourf/deviant 5 http://backend.deviantart.com/rss.xml?q=in%3Adigitalart/fractals%20sort%3Atime\&amp;amp;type=deviation http://backend.deviantart.com/rss.xml?q=in%3Adigitalart/photomanip%20sort%3Atime\&amp;amp;type=deviation http://backend.deviantart.com/rss.xml?q=in%3Adigitalart/fractals%20sort%3Atime\&amp;amp;type=deviation http://backend.deviantart.com/rss.xml?q=sort%3Atime%20conky\&amp;amp;type=deviation&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: rgb(255, 0, 0);"&gt;IMPORTANT : In the RSS feed the symbol &amp;amp; has to replace by \&amp;amp; elsewhere it won't work&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This script can also be downloaded &lt;a href="http://ubuntuforums.org/showpost.php?p=8601909&amp;postcount=121"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;En français (soyons fous) :&lt;br /&gt;Ce script permet de télécharger les images des liens RSS générés sur les pages des résultats de recherche sur deviantArt.&lt;br /&gt;Il fonctionne avec 3 arguments minimum :&lt;br /&gt;1: le dossier où enregistrer les images&lt;br /&gt;2: le temps à attendre entre chaque boucle (0 pour une seule boucle)&lt;br /&gt;3 et suivants : liens RSS (Dans ces liens il faut remplacer &amp;amp; par /&amp;amp;)&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;The script :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#! /bin/bash&lt;br /&gt;#This script get pictures from RSS feed from deviantArt website and save them to hard disk&lt;br /&gt;#&lt;br /&gt;# by wlourf http://u-scripts.blogspot.com/&lt;br /&gt;# v1.0 - 02 Feb. 2010&lt;br /&gt;#&lt;br /&gt;#1st arg : folder where to save the pictures&lt;br /&gt;#2nd arg : delay (in minutes) for repetaing the script (0 is for a single run)&lt;br /&gt;#3rd arg and following : urls of the rss feed to follow&lt;br /&gt;&lt;br /&gt;#some paramaters are set here&lt;br /&gt;file1=/tmp/get_deviant_rss.txt&lt;br /&gt;file2=/tmp/get_liste.txt&lt;br /&gt;#display filename even if it is not saved (ie saved previously)&lt;br /&gt;display_files_not_saved=false&lt;br /&gt;#if script running in gnome_terminal, right click on the file can open it&lt;br /&gt;display_files_with_link=true&lt;br /&gt;############################# end ###########################&lt;br /&gt;&lt;br /&gt;clear&lt;br /&gt;&lt;br /&gt;if [[ $# -lt 3 ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo 'This script needs at least 3 arguments : '&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo '    - full path of the folder where save the pictures'&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo '    - run the script every X minutes, 0 for a single run'&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo '    - one or more RSS feeds to watch (take care to escape the &amp; symbol with \&amp;)'&lt;br /&gt;&amp;nbsp;&amp;nbsp;exit&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;folder=$1&lt;br /&gt;repeat=$2&lt;br /&gt;args=$*&lt;br /&gt;rss=${args#$1" "}&lt;br /&gt;rss=${rss#$2" "}&lt;br /&gt;nbUrl=0&lt;br /&gt;&lt;br /&gt;if [[ {$folder:-1} != "/" ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;folder="$folder/"&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;for url in $rss&lt;br /&gt;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;((nbUrl++))&lt;br /&gt;&amp;nbsp;&amp;nbsp;tabRSS[$nbUrl]=$url&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;nbLoops=0&lt;br /&gt;flag=true&lt;br /&gt;while ( $flag ); do&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "-------------------"&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "folder = "$folder&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "-------------------"&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "loop every $repeat minutes"&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "-------------------"&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;((nbLoops++))&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;mkdir -p $folder&lt;br /&gt;&amp;nbsp;&amp;nbsp;cd $folder&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;for ((u=1 ; u&lt;=$nbUrl ; u++))&lt;br /&gt;&amp;nbsp;&amp;nbsp;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#read one rss feed&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "-------------------"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "rss $u/$nbUrl = "${tabRSS[u]}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;GET ${tabRSS[u]} &gt; $file1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#extract the link to the fullview image&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match="medium=\"image\""&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;url_line=""&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;begin="http"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end="\" height"&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;table=()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;idx=1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#put the links in a table for better display&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while read line&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if [[ "$line" =~ "${match}" ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;url_line=$line&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a=$(($(expr "$url_line" : ".*$begin")-${#begin}))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b=$(($(expr "$url_line" : ".*$end")-$a-${#end}))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;url_link=${url_line:$a:$b}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;table[$idx]=$url_link&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;((idx++))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;done &lt;  $file1&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#read the table ans save the image if not already saved&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nbLinks=$(($idx-1))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nbSaved=0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for ((a=1 ; a&lt;=$nbLinks ; a++))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;link=${table[a]}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img_name=$(expr match "$link" '.*\(/.*\)')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img_name=${img_name:1}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;txt="loop $nbLoops - url $u - $a/$nbLinks"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ($display_files_with_link) then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strFile="file://"$folder$img_name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;strFile=$img_name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if [ -f "$img_name" ]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if ($display_files_not_saved) then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo  $txt" - *** "$strFile" *** already saved"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo  $txt" - "$strFile&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wget  -q $link&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;((nbSaved++))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;done&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "$nbSaved/$nbLinks pictures saved for loop number $nbLoops and rss= $url"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "-------------------"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&lt;br /&gt;&amp;nbsp;&amp;nbsp;done&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;if [[ $repeat -eq "0" ]]; then &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flag=false&lt;br /&gt;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;nows=$(date +%s)&lt;br /&gt;&amp;nbsp;&amp;nbsp;waitto=$(($nows+$repeat*60))&lt;br /&gt;&amp;nbsp;&amp;nbsp;sl=$(($waitto-$nows))&lt;br /&gt;&amp;nbsp;&amp;nbsp;echo "Wait $((sl/60)) minutes till :"&lt;br /&gt;&amp;nbsp;&amp;nbsp;date --date "$sl sec"&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;sleep $sl&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;echo&lt;br /&gt;echo "Finish! after $nbLoops loop(s)"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-7954300755814712748?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/7954300755814712748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/02/how-to-get-pictures-from-rss-feeds-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7954300755814712748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7954300755814712748'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/02/how-to-get-pictures-from-rss-feeds-from.html' title='How to get pictures from RSS feeds from deviantArt (get_deviation_search.sh v1.0)'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-7181523432429495871</id><published>2010-01-31T03:47:00.000-08:00</published><updated>2010-03-31T14:00:04.101-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deviantart'/><category scheme='http://www.blogger.com/atom/ns#' term='bash script'/><title type='text'>How to get random pictures from deviantArt (get_deviation.sh v1.0)</title><content type='html'>As I was a bit boring to see always the sames pictures from my hard drive with my conky script "&lt;a href="http://u-scripts.blogspot.com/2010/01/phot-album-stack.html"&gt;Photo Album Stack&lt;/a&gt;", I tried to get some other pictures from the web.&lt;br /&gt;&lt;br /&gt;Picasa as an interesting &lt;a href="http://picasaweb.google.com/lh/recentPhotos"&gt;Slideshow tool&lt;/a&gt;.&lt;br /&gt;If you open just this page in a browser (epiphany for example), you have to set the folder of the cache&lt;br /&gt;/home/wlourf/.gnome2/epiphany/mozilla/epiphany/Cache in the script and that's it.&lt;br /&gt;But pictures on Picasa are not really interesting, isn't it?&lt;br /&gt;&lt;br /&gt;DeviantArt has also a random tool but whithout slideshow, so you have to click to display images ...&lt;br /&gt;I wrote this script (&lt;b&gt;get_deviation.sh&lt;/b&gt;) that go to the random page and save the image (in fullsize) to the hard disk. This one can be improved because regular expressions are not my favorite toy!&lt;br /&gt;Next, I will try to do the same for pictures from one single category.&lt;br /&gt;&lt;br /&gt;Before running the script you have to set the &lt;span style="font-weight: bold;"&gt;folder&lt;/span&gt; variable in it.&lt;br /&gt;&lt;br /&gt;This script can also be downloaded &lt;a href="http://ubuntuforums.org/showpost.php?p=8601909&amp;postcount=121"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In a few days, I will post the last version of the Photo Album Script which will run with this script.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;En français (soyons fous)!&lt;br /&gt;Ceci est un script qui enregistre des images aléatoires du site deviantArt sur son PC. Pour être utilisé, il faut paramétrer la variable folder au début du script.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;The script : &lt;b&gt;get_deviation.sh&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#! /bin/bash&lt;br /&gt;#This script get a random image from deviant art website and save it to hard disk!&lt;br /&gt;#&lt;br /&gt;# by wlourf http://u-scripts.blogspot.com/&lt;br /&gt;# v1.0 - 31 Jan. 2010&lt;br /&gt;#&lt;br /&gt;#argument 1 (optional) is the path+filename where to save the image&lt;br /&gt;#if argument 1 is not present, image will be saved in $folder&lt;br /&gt;#&lt;br /&gt;#other paramaters are set here&lt;br /&gt;file1=/tmp/get_random.txt&lt;br /&gt;file2=/tmp/get_image.txt&lt;br /&gt;folder=~/deviant&lt;br /&gt;&lt;br /&gt;############################# end ###########################&lt;br /&gt;&lt;br /&gt;#get a random url&lt;br /&gt;GET http://www.deviantart.com/random/deviation &gt; $file1&lt;br /&gt;&lt;br /&gt;#extract the link to the deviation page&lt;br /&gt;match="&amp;lt;input type="\" name="\" value="\" begin="http" end="\"&gt;"&lt;br /&gt;&lt;br /&gt;a=$(($(expr "$url_line" : ".*$begin")-${#begin}))&lt;br /&gt;b=$(($(expr "$url_line" : ".*$end")-$a-${#end}))&lt;br /&gt;&lt;br /&gt;url_page=${url_line:$a:$b}&lt;br /&gt;&lt;br /&gt;#echo "deviation--&gt; "$url_page&lt;br /&gt;&lt;br /&gt;#get the deviation page&lt;br /&gt;GET $url_page &gt; $file2&lt;br /&gt;&lt;br /&gt;#extract the link to the fullview image&lt;br /&gt;match="fullview"&lt;br /&gt;url_line=""&lt;br /&gt;&lt;br /&gt;while read line&lt;br /&gt;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;if [[ "$line" =~ "${match}" ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;url_line=$line&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break&lt;br /&gt;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;done &lt;  $file2&lt;br /&gt;&lt;br /&gt;begin="src\":\""&lt;br /&gt;end="\"},\"smallview"&lt;br /&gt;&lt;br /&gt;b=$(($(expr "$url_line" : ".*$end")-${#end}))&lt;br /&gt;url2=${url_line:0:$b}&lt;br /&gt;&lt;br /&gt;a=$(($(expr "$url2" : ".*$begin")))&lt;br /&gt;url_img=${url2:$a}&lt;br /&gt;&lt;br /&gt;#save image to hard disk if url ok &lt;br /&gt;if [[ $url_img != "" ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;cd $folder&lt;br /&gt;&amp;nbsp;&amp;nbsp;if [[ $1 != "" ]]; then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wget $url_img -O $1&lt;br /&gt;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wget $url_img&lt;br /&gt;&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;fi &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you want the script to run in a loop, just write in another script:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;while true&lt;br /&gt;do&lt;br /&gt;&amp;nbsp;&amp;nbsp;./get_deviation.sh&lt;br /&gt;done&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-7181523432429495871?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/7181523432429495871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/01/how-to-get-random-pictures-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7181523432429495871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7181523432429495871'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/01/how-to-get-random-pictures-from.html' title='How to get random pictures from deviantArt (get_deviation.sh v1.0)'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-7858479805411259026</id><published>2010-01-19T13:20:00.000-08:00</published><updated>2010-03-31T13:51:37.784-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='imlib'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Calendar wheel</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_yHDbHcEhK7A/S1YsvFPDNsI/AAAAAAAAAJU/WM_wZaffYQM/s1600-h/Calendar_wheel_with_conky_1_by_wlourf.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://4.bp.blogspot.com/_yHDbHcEhK7A/S1YsvFPDNsI/AAAAAAAAAJU/WM_wZaffYQM/s400/Calendar_wheel_with_conky_1_by_wlourf.png" alt="" id="BLOGGER_PHOTO_ID_5428575588212487874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Well, as I explore the conky a little bit deeper, I am very amazing of things we can draw with some lines of codes.&lt;br /&gt;Last week I tried the Conky Contest of the Month with this "Calendar Wheel". We were only two guys to participate (too bad) but you can vote for my calendar if you like the conky I will now explain !! Edit: I &lt;a href="http://blog.conky.be/2010/02/03/congratulations-wlourf-winner-of-januarys-cotm-competition/"&gt;won&lt;/a&gt; coool !&lt;br /&gt;&lt;br /&gt;This script simply draw a circular calendar on the left side of the screen (I didn't try on the right side as text alignment is not easy with cairo).&lt;br /&gt;&lt;br /&gt;The most difficult part of this script was to rotate the dates because cairo doesn't allow that: the trick was to draw each date on a separate image, rotate the image and then render the rotated image on the screen.&lt;br /&gt;Customization can be done with colors, height and width and some text can be added (depending on the date) on the left side of the arc.&lt;br /&gt;&lt;br /&gt;This is what I've done for the contest (and for learning myself Lua) !&lt;br /&gt;&lt;br /&gt;After that, I added some improvements in version 1.1 :&lt;br /&gt;- today's date can now be set anywere in the arc (not on only the horizontal line) : &lt;span style="font-weight: bold;"&gt;yoffset&lt;/span&gt;&lt;br /&gt;- today's date can now have an offset (positive or negative) : &lt;span style="font-weight: bold;"&gt;xoffset&lt;/span&gt;&lt;br /&gt;- the main thing is that&lt;span style="font-weight: bold;"&gt; the calendar is draw only at the start of the conky and when the date change&lt;/span&gt; (i.e. the calendar is saved in a PNG file and this is this file that will be displayed in the conky) or if the PNG file is deleted : so the conky become really really fast  ...&lt;br /&gt;&lt;br /&gt;And in version 1.2, the calendar can be drawn on the right side of the conky.&lt;br /&gt;&lt;br /&gt;The script can be downloaded from ubuntu forums &lt;a href="http://ubuntuforums.org/showpost.php?p=8782789&amp;amp;postcount=147"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;Edit : how to set date in local language&lt;/span&gt;:&lt;br /&gt;Here is what I've done for having dates according to my locale settings:&lt;br /&gt;It your conkyrc, in the TEXT section, write&lt;br /&gt;&lt;code&gt;${time}&lt;/code&gt;&lt;br /&gt;If you want to hide this date , &lt;br /&gt;&lt;code&gt;use_xft yes&lt;br /&gt;xftalpha 0&lt;br /&gt;default_color 000000&lt;/code&gt;&lt;br /&gt;It seems it works only for the black color .&lt;br /&gt;I didn' manage to do that in Lua only&lt;br /&gt;&lt;br /&gt;Happy Conkying !&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More screenshots :&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_yHDbHcEhK7A/S2IbGiNu7jI/AAAAAAAAAKc/0RQJxkZ5-u0/s1600-h/Calendar-01.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://1.bp.blogspot.com/_yHDbHcEhK7A/S2IbGiNu7jI/AAAAAAAAAKc/0RQJxkZ5-u0/s400/Calendar-01.png" alt="" id="BLOGGER_PHOTO_ID_5431933899639811634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/_yHDbHcEhK7A/S0-RVgmEioI/AAAAAAAAAE0/Sq8KEKKIxSA/s512/Calendar-04.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 502px; height: 512px;" src="http://lh6.ggpht.com/_yHDbHcEhK7A/S0-RVgmEioI/AAAAAAAAAE0/Sq8KEKKIxSA/s512/Calendar-04.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There is also a gallery on &lt;a href="http://picasaweb.google.com/wlourf/WheelCalendar#"&gt;picasa&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-7858479805411259026?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/7858479805411259026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/01/calendar-wheel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7858479805411259026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/7858479805411259026'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/01/calendar-wheel.html' title='Calendar wheel'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_yHDbHcEhK7A/S1YsvFPDNsI/AAAAAAAAAJU/WM_wZaffYQM/s72-c/Calendar_wheel_with_conky_1_by_wlourf.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-8331150457606496800</id><published>2010-01-10T03:32:00.000-08:00</published><updated>2010-03-31T13:55:57.507-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='cairo'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Shaded clock widget</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_yHDbHcEhK7A/S0m8XkJZ9rI/AAAAAAAAADU/OhBOXXlBzA8/s1600-h/clocks1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://3.bp.blogspot.com/_yHDbHcEhK7A/S0m8XkJZ9rI/AAAAAAAAADU/OhBOXXlBzA8/s400/clocks1.png" alt="" id="BLOGGER_PHOTO_ID_5425074339170612914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This is my attempt to draw a eye-candy clock using cairo and conky.&lt;br /&gt;I draw some examples on the picture with the parameters used.&lt;br /&gt;Effects are nice but code need to be optimized.&lt;br /&gt;&lt;br /&gt;Edit : I updated my "shadowed clock"  to a "clock shaded", (is this more english ?). It's now easy to use because it's a widget that can be cut/paste in a Lua script.&lt;br /&gt;Again, it can be &lt;a href="http://ubuntuforums.org/showpost.php?p=8788718&amp;postcount=12002"&gt;downloaded&lt;/a&gt; from ubuntu forums .&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_yHDbHcEhK7A/S27X0Pk3avI/AAAAAAAAALw/JiqLCVCj8vY/s1600-h/clocks_shaded_by_wlourf.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 263px;" src="http://4.bp.blogspot.com/_yHDbHcEhK7A/S27X0Pk3avI/AAAAAAAAALw/JiqLCVCj8vY/s400/clocks_shaded_by_wlourf.png" alt="" id="BLOGGER_PHOTO_ID_5435519092817095410" 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/3213850822469958395-8331150457606496800?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/8331150457606496800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/01/shadowed-clock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/8331150457606496800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/8331150457606496800'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/01/shadowed-clock.html' title='Shaded clock widget'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_yHDbHcEhK7A/S0m8XkJZ9rI/AAAAAAAAADU/OhBOXXlBzA8/s72-c/clocks1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3213850822469958395.post-412669766507520139</id><published>2010-01-03T03:37:00.001-08:00</published><updated>2010-03-31T13:31:46.077-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='imlib'/><category scheme='http://www.blogger.com/atom/ns#' term='lua'/><category scheme='http://www.blogger.com/atom/ns#' term='conky'/><title type='text'>Photo Album Stack</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_yHDbHcEhK7A/S0CEaRRB56I/AAAAAAAAABE/AAoBfVQ8p-c/s1600-h/Capture-1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://1.bp.blogspot.com/_yHDbHcEhK7A/S0CEaRRB56I/AAAAAAAAABE/AAoBfVQ8p-c/s400/Capture-1.png" alt="" id="BLOGGER_PHOTO_ID_5422479538200373154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Hi,&lt;br /&gt;&lt;br /&gt;This is my first attempt to use lua bindings in conky (&gt; 1.7.2).&lt;br /&gt;This script is based on londonali's &lt;a href="http://conky.linux-hardcore.com/?page_id=3622"&gt;Photo Album Script&lt;/a&gt; but it can display than more one image at a time and in a more messy way (if configured to).&lt;br /&gt;&lt;br /&gt;In the conkyrc, don't forget the blank line after &lt;b&gt;TEXT&lt;/b&gt;&lt;br /&gt;To start with an empty photo album, delete the file created by the script :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;code&gt;rm /tmp/img.png &amp;amp; conky -c ~/scripts/conkyrc-album-stack &amp;amp;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some improvments made in version 1.1 :&lt;br /&gt;- little images are no more enlarged&lt;br /&gt;- the filename of the image can be written in the frame or/and elsewhere in the conky.&lt;br /&gt;- gray shadow on the bottom right side of each image can be added&lt;br /&gt;(this is optional but has to be improved : the shadow has to be "blur" and shadows don't work for big pictures)&lt;br /&gt;It can be used with the script get_deviation.sh (see this &lt;a href="http://u-scripts.blogspot.com/2010/01/how-to-get-random-pictures-from.html"&gt;post&lt;/a&gt;) or any other script that get a random image from the web.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The scripts can be &lt;a href="http://ubuntuforums.org/showpost.php?p=8601909&amp;postcount=121"&gt;downloaded&lt;/a&gt; from ubuntu forums.&lt;br /&gt;&lt;br /&gt;Another screenshot :&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_yHDbHcEhK7A/S2nmd6UVAuI/AAAAAAAAALI/UwUmODjavx4/s1600-h/Capture-1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 250px;" src="http://4.bp.blogspot.com/_yHDbHcEhK7A/S2nmd6UVAuI/AAAAAAAAALI/UwUmODjavx4/s400/Capture-1.png" alt="" id="BLOGGER_PHOTO_ID_5434127826944328418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr&gt;En français, soyons fous! Ce script affiche des images de son disque dur sur votre conky dans une façon un peu bordélique. Les dernières modifications sont :&lt;br /&gt;- les petites images ne sont plus agrandies&lt;br /&gt;- le nom de l'image peut être affiché dans le cadre ou n'importe où dans la fenêtre du conky&lt;br /&gt;- une sorte d'ombre peut être ajoutée mais ceci devra être amélioré (il n'y a pas d'effet de flou et ça ne fonctionne pas bien pour les grandes images)&lt;br /&gt;- le script peut être utilisé avec un autre script qui génère des images aléatoires comme get_deviation.sh que j'ai posté il y a quelques jours&lt;hr&gt;&lt;br /&gt;&lt;br /&gt;Happy conkying!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3213850822469958395-412669766507520139?l=u-scripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://u-scripts.blogspot.com/feeds/412669766507520139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://u-scripts.blogspot.com/2010/01/phot-album-stack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/412669766507520139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3213850822469958395/posts/default/412669766507520139'/><link rel='alternate' type='text/html' href='http://u-scripts.blogspot.com/2010/01/phot-album-stack.html' title='Photo Album Stack'/><author><name>wlourf</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_yHDbHcEhK7A/S0-cDiIGMoI/AAAAAAAAAGo/LqWinnu7CT0/S220/billeA2.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_yHDbHcEhK7A/S0CEaRRB56I/AAAAAAAAABE/AAoBfVQ8p-c/s72-c/Capture-1.png' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
