Sunday, August 29, 2010

Animated text conky.
Here is a concept for a conky that I have been thinking about for a while.




having the text in conky appear as if it were being typed.

The idea came a while back when I was thinking about how to get a better scroll function in conky, and I was working on a matrix rain themed conky. I thought it would be cool if you could get text in conky to appear like the text that appeared on Neo's computer in the movie.

I just hadn't done anything about it till now.

Thanks go to iggykoopa of the crunchbanglinux forum for his help with coding. Other wise the script would be very difficult to change. Now you can set up the script to display any text you like, when you like and where you like. It's still a bit tricky as you have to work out your timings for each section of text to appear, pause and vanish.

I have set it up so that you get the impression that a program is runing inside of conky, scanning your system and fetching the information.

You can get the code on the crunchbang linux forum here.

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.

Tuesday, March 16, 2010

I haven't been very active conky wise lately and it looks like I won't be able to spend much time in the future on conky/Lua tinkering either.

I have projects that are going to be keeping me busy. But hopefully I will have a few hours here and there to play!

I've still got lots of good ideas about things to do with Lua/cairo scripts, but as the scripts get more complicated they also take longer to write and test.

I guess I'm entering a mostly retired state as far as conky goes.

Saturday, March 6, 2010

Numbers to text conversion functions.
Code available on the crunchbanglinux forum here.



I have written 3 functions for converting various numbers to text representations.
The first function converts any regular 3 digit or lower number into words, so that:
19 becomes "nineteen" and 487 becomes "four hundred and eighty seven"
I have used this function in the third line in the image above to convert the output of $cpu to words.

The second function converts number dates into text, as in the first line in the image above.

The third converts time data to words as in the middle line above. This function takes into account all the changes that occur with displaying the time as words. For example at 6:01, the function will output "one minute past six". At 6:02 it will be "two minutes past six". At 6:00 it will show "six o'clock" etc. You can choose between having seconds represented or not.

I intend to use these functions with my circlewriting functions to create a text only, non-linear display along the lines of this:



here is what it looks like when its working:

Monday, March 1, 2010

UPDATE. I have made the perspective drawing function configurable and posted the code on the crunchbanglinux website here. The code there displays the following graphic.



Because everything is based off of equations (which are themselves based off just a few key pieces of data), you can easily use the settings to alter the look of the bars like so:



In this case the red bar is cpu usage.
The green is memperc.
The blue and yellow bars show the percent used of my hard disk drives.
There is a maximum of 6 bars assignable. For more bars the Lua script would have to altered to add them manually.

ORIGINAL POST

I have also been thinking more about creating more isometric figure drawing functions. I put together this one a little while ago. While it does look cool, it clearly does not reflect any kind of reality of how a 3D shape would look from a fixed perspective (which is what isometric means).

So I thought about trying to create a more realistic looking figure. I knew it would involve the use of perspective, but I had no idea about how to create the effect or the mathematical principles behind perspective.

So I turned to google and one of the first things I came across was this video.
That gave me a basic understanding of how the effect was achieved. But I didn't want to simply draw a figure using fixed coordinates (that would have been far too easy), I wanted to have a isometric figure that could be configured through settings.

I had to rapidly re-aquaint myself with the mathematics of triangles!

This is what I ended up with. It takes the output from the previous cpu recording and averaging function.



The largest, whitest bar is current cpu usage, then the next bar is 1 minute, then 5, 15, 30 and 60 minute averages. The darker bars are all low because the conky had not been running for long before I too this screenshot.

You could feed each bar anything you wanted, the first could be current CPU followed by memperc etc. Currently (and for the foreseeable future) to add or remove bars is a manual process. Perhaps someone with more mathematics and coding skill than me could "automate" the drawing process with "for i=numberofbars do".
A poster by the name of dbro posted a conky config on the crunchbanglinux forum that had an interesting idea about recording data over time and then displaying the data as averages for a period of time via bars.

I took a look at his Lua script but I couldnt work out how it worked :)
I also thought his bars were confusing. I think it was partlly because of the way he was using the Lua script with conky. He wasn't using cairo to display the bars but parsing the Lua script and then creating bars via the $hr conky object.

I liked the idea of being able to compare computer usage now, to avergae usage over a set time period, so I took dbro's idea and applied my own logic and code to achieve this end. This is what I came up with:



The code is here on the crunchbanglinux website. Here you can alse read a little about the evolution of this script and in dbro's post below he sets out a less intensive way to achieve the same result. I have yet to try and implement dbro's method but the cogs are turning as to how I would apply it.