X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/418e475b5b4eb8404e115d74fdb3756169877278..37c4198cdf300b4dab002e5cbc9ea2590f17f168:/helpers.lua?ds=inline diff --git a/helpers.lua b/helpers.lua index 4ece329..137bd6a 100644 --- a/helpers.lua +++ b/helpers.lua @@ -8,7 +8,7 @@ local debug = require("debug") -local capi = { timer = timer } +local capi = { timer = (type(timer) == 'table' and timer or require ("gears.timer")) } local io = { open = io.open, lines = io.lines, popen = io.popen } @@ -77,8 +77,11 @@ end helpers.timer_table = {} -function helpers.newtimer(name, timeout, fun, nostart) - helpers.timer_table[name] = capi.timer({ timeout = timeout }) +function helpers.newtimer(_name, timeout, fun, nostart) + local name = timeout + if not helpers.timer_table[name] then + helpers.timer_table[name] = capi.timer({ timeout = timeout }) + end helpers.timer_table[name]:connect_signal("timeout", fun) helpers.timer_table[name]:start() if not nostart then