Some of my scripts for daily use on a linux desktop

Friday, March 19, 2010

Smiley Widget

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.
Each eye and the smile can be linked to a conky variable or not and color can change.
The code for the script can be downloaded on ubuntu forum or on CH forum (or in french here).

Parameters are explained in the Lua script, but there is a short example :

  "downspeedf", "wlan0",1000, false,
  "upspeedf", "wlan0",100, false,

And the function with named arguments
function draw_smiley(xc,yc,radius1,shadow_size,color0,compo_r,compo_g,compo_b,

From last to first :
-last line :rotation is the angle in radian of rotation of the smiley
-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.
- first line : xc, yc, radius1 are for positionning the smiley in the conky window
- first line : shadow_size will draw a shadow ;-)
- first line : color0, compo_r, compo_g, compo_b are parameters for having color changing, for the example above:
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).

Last warnings :
Fixed values can be used instead of conky variables with name="" and arg=value (80% in this case): "",80,100,false,

If you call more than one widget : xc, yc and rotation are RELATIVES to previous widget.


No comments:

Post a Comment