Conky widgets (en)

From Conky PitStop

Jump to: navigation, search

Conky widgets

 Language   English   Français   


So, I wanted to make a system by which I (or anyone else) could publish Lua widgets and make it as easy as possible to build them into Conky. I’ve come up with a simple Lua script into which you can drop widget code blocks, some simple configuration info, and display them all with just a single call in Conky. That way, you only need one .conkyrc and one conky_widgets.lua script for all your widgety needs!

A screenie to whet your appetite:

Script-londonali1010-widgets-1.png

The conky_widgets.lua script looks like this, before it’s populated:

    --[[
    Conky Widgets by londonali1010 (2009)

    This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

    To configure:
    + Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
    + To call the widget, add the following just before the last "end" of the entire script:
        cr = cairo_create(cs)
        NAME_OF_FUNCTION(cr, OPTIONS)
        cairo_destroy(cr)
    + Replace OPTIONS with the options for your widget (should be specified in the widget's code block) 

    Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
        lua_load ~/scripts/conky_widgets.lua
        lua_draw_hook_pre widgets

    Changelog:
    + v1.0 -- Original release (17.10.2009)
    ]]

    require 'cairo'

    function conky_widgets()
        if conky_window == nil then return end
        local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end

Easy, huh?

And in the example above, I’ve used two widget code blocks : Air Clock & the Ring Meter.
The full conky_widgets.lua for the above screenshot is here.


Widgets available in the archive .tar.gz

  1. Air Clock. An analog clock, designed after the “Air” clock in KDE 4.3. (see also)
  2. Ring Meter. A graphical ring display of system stats. (see also)
  3. Ring Meter (Counter-Clockwise). A counter-clockwise version of the ring meter above.
  4. Clock Hands. A simple widget that draws clock hands only.


Ah, yes, and credits: the font is Journal, available on dafont.com. Apologies, I don’t have a source for the wallpaper, but if you come across it, please do let me know so I can give proper credit.

Happy Conkying!

Author: londonali1010
Distro: Crunchbang 9.04
Conky Version: 1.7.2

Personal tools
Namespaces
Variants
Actions
Navigation
English
Français
Toolbox