From 853fafcdd37cbb1c6439e444805cb0d3e37fe068 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Wed, 26 Aug 2009 03:27:18 +0200 Subject: [PATCH] Updated timers for the upcoming awesome 3.4 --- init.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/init.lua b/init.lua index ed5bda5..14dadb4 100644 --- a/init.lua +++ b/init.lua @@ -27,11 +27,7 @@ local table = { } -- Grab C API -local capi = { - hooks = hooks, - widget = widget, - awesome = awesome, -} +local capi = { timer = timer } -- }}} @@ -67,6 +63,7 @@ module("vicious") -- {{{ Initialise variables +local timers = {} local registered = {} local widget_cache = {} @@ -153,7 +150,11 @@ function regregister(reg) -- Start timer if reg.timer > 0 then - awful.hooks.timer.register(reg.timer, reg.update) + timers[reg.update] = { + timer = capi.timer({ timeout = reg.timer }) + } + timers[reg.update].timer:add_signal("timeout", reg.update) + timers[reg.update].timer:start() end -- Initial update @@ -191,7 +192,10 @@ function unregister(widget, keep, reg) end end - awful.hooks.timer.unregister(reg.update) + -- Stop timer + if timers[reg.update].timer.started then + timers[reg.update].timer:stop() + end reg.running = false return reg