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.
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".
Subscribe to: Post Comments (Atom)
Post a Comment