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 Oct 3, 2018
1 parent 979cc46 commit 0d91a6e
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 @@ -287,6 +287,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 0d91a6e

Please sign in to comment.