Here is my latest conky configuration
conkybar!
and this is what it looks like currently:
Nothing out of the ordinary in terms of content over many other conkyrc generated displays.
But with a few differences.
The first thing is that every is generated in a lua script. The second is that those black triangles at the top are clickable buttons. Here is how this setup functions.
A while ago on the crunchbanglinux website a poster by the name of jpope had a wallpaper that had a large power button right in the middle of the screen. Here is the post:
http://crunchbanglinux.org/forums/post/45907/#p45907
ADcomp had written a python script to place a button on the desktop that would launch a command or script. The button could be placed anywhere and you could make your own icons for it to use and it could execute any command when you click it. It was all set up in the script.
I thought that was pretty cool and I stored it in the back of my mind.
Then recently I started looking into the file io function of lua, the ability to open files in the lua script, read their contents and store that as strings which could be manipulated in the script. I had been working on some bash scripts using curl to download information from webpages, then editing the html to pull out specific pieces of information.
I had been using the conky_parse command in lua to execute the bash scripts via conky, but I was trying to bring some of the operations into the native lua language to make the scripts run a little lighter cpu wise.
However, once I started playing around with the file io commands I realised that I could affect the whole lua script by having the script "watching" a text file and then editing the file, initially via a terminal command.
something like this:
$ touch /tmp/setw.txt; echo "1" > /tmp/setw.txt
the touch command creates the file then the > writes a "1" into the file.
a similar command could then easily ovewrite the "1" with a "2"
so if i had the Lua script watching that file I could put the output into a string and use the string as a basis for an if statement.
These are the lines that watch the text files in the lua script
wread = io.open("/home/mcdowall/conkyset/wset.txt", "r")
wset = wread:read("*lines")
I've changed the names and moved the files out of /tmp so they are persistant.
So now a simple:
if wset=="1" then
--display one thing--
end
if wset=="2" then
--display something else--
end
gives me interactive control over the script.
I then remembered the button script I had seen, and after some searching (and asking) I had the link to the script.
take a look at this entry on the ubuntu conky thread for more infomation on how the interaction works.
http://ubuntuforums.org/showpost.php?p=9826304&postcount=13840
The actual lua script can be found here. It is still very much a work in progress.
http://ubuntuforums.org/showpost.php?p=9830734&postcount=13855
The fact that everything has to be constructed in lua was itself a challenge. Lua doesn't have all the goodies pre-programmed into it like the objects you can get in a conkyrc by putting in the right command
The calendars were tricky. I saw londonali1010's post on lua calendars here
http://mylittledesktop.blogspot.com/2009/10/argh-my-first-snag-with-my-lovely.html
I looked over her code and borrowed a couple of lines (for calculating start day), but went about contructing the calendar in a very different way. The result was a calendar that looked very similar to the one available through a conkyrc. I'm still trying to perfect the day indicator however.
The biggest limitation to using Lua to construct a complete conky output is how it handles displaying text. It takes a lot of lines to get the tables you see in my output, far more than if I were to do the same thing in a straight conkyrc.
Anyway, I'm still working on the content of the conky but I am happy how the mechanics have worked out!
As it stands right now this setup is no more cpu draining than my regular all conkyrc setup. And when I have all the sections rolled up (except system monitor so that I can see the cpu usage) it runs much lighter. When a section is "rolled up" or inactive the lua script does not have to do any of the calculations or rendering for that section.
Subscribe to:
Post Comments (Atom)
Hi, the conkybar is wonderful!
ReplyDeletecan you explain how to use the script you found here http://ubuntuforums.org/showpost.php?p=9830734&postcount=13855
please?
Thanks!