From 17226e5a61e8d387353706bc3b38672072cb08fa Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 8 Sep 2009 11:04:43 +0200 Subject: [PATCH] telak: remove Signed-off-by: Julien Danjou --- lib/telak.lua.in | 78 ------------------------------------------------ 1 file changed, 78 deletions(-) delete mode 100644 lib/telak.lua.in diff --git a/lib/telak.lua.in b/lib/telak.lua.in deleted file mode 100644 index 09e7530b..00000000 --- a/lib/telak.lua.in +++ /dev/null @@ -1,78 +0,0 @@ ----------------------------------------------------------------------------- --- @author Julien Danjou <julien@danjou.info> --- @copyright 2008 Julien Danjou --- @release @AWESOME_VERSION@ ----------------------------------------------------------------------------- - --- Grab environment -local os = os -local io = io -local http = require("socket.http") -local ltn12 = require("ltn12") -local setmetatable = setmetatable -local util = require("awful.util") -local capi = -{ - timer = timer, - wibox = wibox, - widget = widget, - image = image -} - ---- Display a remote image on your root window, and update it once in a while. -module("telak") - -local data = setmetatable({}, { __mode = 'k' }) - --- Update a telak wibox. --- @param w The wibox to update. -local function update(w) - local tmp = os.tmpname() - http.request{url = data[w].image, sink = ltn12.sink.file(io.open(tmp, "w"))} - local img = capi.image(tmp) - if img then - w:geometry({ width = img.width, height = img.height }) - w.widgets.image = img - else - w.visible = false - end - os.remove(tmp) -end - ---- Create a new telak wibox. This will be automagically update to show a --- local or remote image. --- @param args A table with arguments: image is the local or remote image. --- Timer can be specified to set the time in seconds between two update. --- Default is 300 seconds. --- @return The wibox. You need to attach it to a screen and to set its --- coordinates as you want. -local function new(args) - if not args or not args.image then return end - - -- Create wibox - local w = capi.wibox{} - data[w] = { image = args.image } - local wimg = capi.widget({ type = "imagebox" }) - w.widgets = wimg - - data[w].timer = capi.timer { timeout = args.timer or 300 } - data[w].timer:add_signal("timeout", function update(w) end) - data[w].timer:start() - - update(w) - - return w -end - ---- Delete a telak wibox. --- @param w The wibox. -function delete(w) - if data[w] then - data[w].timer:stop() - data[w] = nil - end -end - -setmetatable(_M, { __call = function(_, ...) return new(...) end }) - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80