Add vicious.change_timer: a helper to change the timeout
This is useful in case you want to change the timeout value for a registered widget, e.g. from the format callback function. I am using this to have a shorter timeout interval for the temperature widget when its value is above some threshold. Signed-off-by: Daniel Hahler <git@thequod.de>
This commit is contained in:
parent
150864a76d
commit
f25866f4e5
11
init.lua
11
init.lua
|
@ -352,5 +352,16 @@ function vicious.call_async(wtype, format, warg, callback)
|
|||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Change the timer of a registered widget.
|
||||
function vicious.change_timer(reg, timer_)
|
||||
if not reg then return end
|
||||
if timer_ ~= reg.timer then
|
||||
vicious.unregister(nil, true, reg)
|
||||
reg.timer = timer_
|
||||
regregister(reg)
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
||||
return vicious
|
||||
-- }}}
|
||||
|
|
Loading…
Reference in New Issue