Saturday, July 31, 2010

My latest conky plots the position of the sun throughout the day. The Lua script also calculates and displays the sun's altitude and azimuth as it changes throughout the day. I had to get to grips with some equations and also get to grips with how to do those calculations in Lua.

The conky has 2 scripts that make it work.
Firstly there is a bash script that uses the curl function to access a webpage. Then using grep, awk and sed I extracted key astronomical data from the page.

The Lua script is then fed the data via conky and uses the numbers to perform all the necessary calculations. I also display a range of data in the conky via the Lua script.

The figure is all based on equations which are in turn based on the data I gathered. The figure shows a very accurate representation of the position of the sun relative to the horizon.

You can get the code for the bash and Lua script on the crunchbang linux website here.

If you are interested in using this conky then be sure to read my post as you will have to make some changes to the scripts regarding geographical location.
Here is a new conky/lua setup from me.

This is based on a wallpaper created by the ever talented gutterslob which he posted on the crunchbang linux website here.

This was posted back in March and I said at the time that it would make a great conky but I never went any further than that. Then recently I saw someone else on the crunchbang site post a screenshot using the wallpaper and, as I had some time to kill, I started making a conky display based upon it.

This is how it turned out (everything is labeled in the picture)

The code is on the crunchbang website here.
The code is ugly, overlong, overcomplicated and far from user friendly. The Lua script is an amalgamation of bits of previous lua scripts with modifications but I have yet to go through the code and clean it up.

There are some innovations. I think my clock turned out quite nicely and I haven't seen a clock like that before. I also liked the idea of a wordless/numberless figure (which this is)

Also my upspeed and downspeed bars, while seemingly simple, display speed as a percentage of total possible speed (determined via speed testing). The lua script can differentiate between bytes, kilobytes and megabytes per second (that is output by the conky object upspeed for example) and calculate speed in a single unit which makes this possible.