Skip to content

Commit

Permalink
Add vicious.change_timer: a helper to change the timeout
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
blueyed committed Jan 23, 2019
1 parent 6997606 commit 50dc101
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,17 @@ function vicious.call(myw, format, warg)
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

-- }}}

0 comments on commit 50dc101

Please sign in to comment.