Widgets in Conky? It can be done!
If you haven't already jumped on the Conky 1.7.2 bandwagon, now may be the time to try it out...I've written a new script in Lua, that will allow you to draw widgets to your Conky window, a la this screenie:

The Conky above is a combination of four separate widgets (one clock and 4 semi-rings) in the Conky Widgets script, and all the text is written with Conky. You can download the Lua script and .conkyrc that made it here: conky_widgets.tar.gz.
This Conky Widgets script is essentially a "shell" to hold blocks of widget code, with the idea that you or anyone else can write blocks of code and call them simply in a single script, without having to make drastic changes to your script or to your Conky. To use it with your Conky, download the empty script here: conky_widgets.lua.tar.gz. Then download one or more code blocks: Air Clock (air_clock_wb.txt.tar.gz) or Ring Meter (ring_wb.txt.tar.gz). Simply copy the code block into the empty widget script, following the instructions in the script's header.
Finally, call your widgets with the following code before TEXT in your .conkyrc:
lua_load ~/scripts/conky_widgets.lua lua_draw_hook_pre widgets
Have a go and see what you can do! And if you write a widget code block yourself, please do post it here so we can all see what you've done.
(Don't have Conky 1.7.2 installed yet? Start here!)
Lua Cairo Bindings for Conky 1.7.2+…Getting Started
If you saw my last post about Lua Cairo bindings for Conky 1.7.2+, but didn't go any further with it, then you're not alone! It's pretty daunting at first, especially if you haven't programmed in Lua or Cairo before. Perhaps I can persuade you...?
The images in the following two screenshots use only Conky. They were written in Lua, using Cairo bindings:

If I've tickled your fancy, here are a few tips to get you started!
Before you start
First and foremost, grab yourself a copy of the latest Conky release. Â If you are running Ubuntu 9.04 or higher, you can get the .deb here. Â If you are running Ubuntu 9.10 Karmic Koala, version 1.7.2 is in the Karmic repos.
Read through the Cairo tutorial, and familiarise yourself with the Lua documentation. Â Not to say that you should do every exercise word-for-word or read every entry in the Lua reference manual, but it'll give you an idea of the kinds of things you can do, and where to find help if you need it.
Starting out
The easiest way to start is to modify someone else's work, just to get used to the syntax. Just find a script you like and start tweaking. Maybe change colours or shapes, placement of objects, or combine elements from different scripts. Try the following:
- Clock background by Norsetto
- Conky Pies by Brenden Matthews
- Air Clock or Rings, both by me
If you're ready to start making your own ideas come to life, have a go recreating the Cairo snippets on the Cairo website. Then start breaking out your own designs!
Working with Conky
There are a couple of bits you'll definitely need to get your Lua script to work with Conky. First, to define your Cairo surface:
if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, onky_window.width, conky_window.height)
cr=cairo_create(cs)
Next, the best bit: you can use the function conky_parse() to evaluate any Conky expression. For instance, you can use:
str=conky_parse('${cpu cpu0}')
to grab the total CPU percent usage of your system. It is saved as a string, so in order to get it as a numerical value, you will need to use:
value=tonumber(str)
conky_parse() and tonumber() together are a powerful combination, because it means that anything you can get in Conky, you can get in your Lua script.
And finally
Don't forget, if you come up with a new weird and wonderful way to use Conky, post it here!
5 Great Sources of Conky Inspiration
So, I think we're all on the same page by now: Conky is a fantastic system monitor, but it can also be a nice little bit of eye-candy for your desktop. Once you've got a handle on the basics, you'll probably be looking for inspiration for your next great Conky config. Here are my top 5 favourite places to look, when I'm after ideas for a new Conky setup...
Browsing the Conky documentation may not seem particularly inspiring, but you'd be surprised! I've found some of my favourite variables just by reading through the variable list...Variables I would probably not have learned about any other way. For instance, it was here that I discovered the $scroll variable, which scrolls text inside a set number of characters. It was also here that I stumbled upon the $if_updatenr variable, which counts the number of updates and can display a different set of outputs for each one.
4. The Ubuntu Forums Conky Screenshot Thread
The biggest active thread I've found devoted to Conky, this baby boasts over 900 pages (at last count)...That's over nine THOUSAND posts of screenshots, hints, tips and troubleshooting. It's also frequented by some of the most prolific and best Conkyists out there, so you're dealing with the best of the best.
3. Conky Wiki
The Conky Wiki is where new releases are described in the most detail, with feature tours, screenshots and code snippets. It's the best place to browse the latest features and get ideas on how to implement them.
2. The Lifehacker Desktop Show and Tell Pool on Flickr
It's not all about Conky in this Flickr pool; it's a real mix of Mac OS, Linux distros and Windows. There are some absolutely awesome shots on here, from Conky to Rainmeter to Geektool to Samurize and beyond...If you want some real artistic inspiration, this is the place to look.
Hands down, the best place to look for Conky inspiration is Conky Hardcore! Captured from all over the 'net, Conky Hardcore! compiles the best and brightest ideas for Conky...and tells you how to achieve them on your own system. Whether you're a novice or an expert, Conky Hardcore! should definitely be in your bookmark list.
And finally...
So those are my top 5 resources for Conky inspiration...What are yours?

