diff --git a/lib/telak.lua.in b/lib/telak.lua.in index 6f70afe4..80121435 100644 --- a/lib/telak.lua.in +++ b/lib/telak.lua.in @@ -11,9 +11,9 @@ local http = require("socket.http") local ltn12 = require("ltn12") local setmetatable = setmetatable local util = require("awful.util") -local hooks = require("awful.hooks") local capi = { + timer = timer, wibox = wibox, widget = widget, image = image @@ -55,8 +55,9 @@ local function new(_, args) local wimg = capi.widget({ type = "imagebox" }) w.widgets = wimg - data[w].cb = function () update(w) end - hooks.timer.register(args.timer or 300, data[w].cb) + 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) @@ -67,7 +68,7 @@ end -- @param w The wibox. function delete(w) if data[w] then - hooks.timer.unregister(data[w].cb) + data[w].timer:stop() data[w] = nil end end