From ef6d6dd12cfbce8bdee5d26129b6375ceaeb9f63 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Fri, 6 Feb 2009 20:55:38 +0100 Subject: [PATCH] awful.hooks: finally and for the last time fix timer removal Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- lib/awful/hooks.lua.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/awful/hooks.lua.in b/lib/awful/hooks.lua.in index fc15be06..5524e141 100644 --- a/lib/awful/hooks.lua.in +++ b/lib/awful/hooks.lua.in @@ -99,7 +99,16 @@ for name, hook in pairs(capi.hooks) do table.insert(delays, h.timer) end table.sort(delays) - hook(delays[1]) + _M[name].timer = delays[1] + hook(delays[1], function (...) + for i, callback in ipairs(_M[name].callbacks) do + callback['counter'] = callback['counter'] + _M[name].timer + if callback['counter'] >= callback['timer'] then + callback['callback'](...) + callback['counter'] = 0 + end + end + end) end end elseif name == "dbus" then