blob: eae351d09d5bb831ecd74cd537bfea8a76ae18f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
local wibox = require("wibox")
local gears = require("gears")
local widgets = {}
function widgets.add_timer(w, callback, timeout)
w._timer = gears.timer({
timeout = timeout or 5,
call_now = true,
autostart = true,
callback = function()
callback(w)
end
})
return w
end
function widgets.watchfn(callback, timeout, base_widget)
local widget = (base_widget or wibox.widget.textbox)()
return widgets.add_timer(widget, callback, timeout)
end
return widgets
|