Lua Imlib2 bindings
From Conky
Conky 1.7.2 and newer ships with Lua Imlib2 bindings. Below is a quick example of how to use them.
Save this script to ~/imlib2.lua:
--
-- Conky Imlib2 Lua scripting example
--
-- Copyright (c) 2009 Brenden Matthews, all rights reserved.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
require 'imlib2'
function conky_imlib2_draw(arg)
if conky_window == nil then return end
imlib_set_cache_size(0)
imlib_set_font_cache_size(512 * 1024)
imlib_set_color_usage(128)
imlib_context_set_dither(1)
imlib_context_set_display(conky_window.display)
imlib_context_set_visual(conky_window.visual)
imlib_context_set_drawable(conky_window.drawable)
buffer = imlib_create_image(conky_window.width, conky_window.height)
imlib_context_set_image(buffer)
imlib_image_clear()
imlib_add_path_to_font_path('/usr/share/fonts/dejavu')
font = imlib_load_font('DejaVuSans/30')
imlib_context_set_font(font)
imlib_context_set_color(0, 255, 0, 255)
imlib_text_draw(0, 0, arg)
imlib_render_image_on_drawable(0, 0)
imlib_free_font()
imlib_free_image()
end
In your conkyrc, add the following:
lua_load ~/imlib2.lua
lua_draw_hook_pre imlib2_draw imlib2!
TEXT
blah

