Conky features a Lua Programming API, and also ships with Lua bindings for some useful libraries. Note that the bindings require tolua++, which currently only compiles against Lua 5.1.
To use Lua Conky, you first need to make sure you have a version of
Conky with Lua support enabled (
conky -v will report this).
Conky defines certain global functions and variables which can be
accessed from Lua code running in Conky. Scripts must first be loaded
using the lua_load configuration option. You then call functions in Lua
via Conky's $lua, $lua_read, and Lua hooks.
Be careful when creating threaded objects through the Lua API. You could wind up with a whole bunch of threads running if a thread is created with each iteration.
NOTE: In order to accommodate certain features in the cairo library's API, Conky will export a few additional functions for the creation of certain structures. These are documented below.
This table contains some information about Conky's window. The following table describes the values contained:
|drawable||Window's drawable (Xlib Drawable), requires Lua extras enabled at compile time.|
|visual||Window's visual (Xlib Visual), requires Lua extras enabled at compile time.|
|display||Window's display (Xlib Display), requires Lua extras enabled at compile time.|
|width||Window width (in pixels).|
|height||Window height (in pixels).|
|border_inner_margin||Window's inner border margin (in pixels).|
|border_outer_margin||Window's outer border margin (in pixels).|
|border_width||Window's border width (in pixels).|
|text_start_x||The x component of the starting coordinate of text drawing.|
|text_start_y||The y component of the starting coordinate of text drawing.|
|text_width||The width of the text drawing region.|
|text_height||The height of the text drawing region.|
NOTE: This table is only defined when X support is enabled.