summaryrefslogtreecommitdiff
path: root/util/widgets.lua
blob: 301f25bea6723a71c37bef9ccb31ce68ca8095b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local wibox = require("wibox")
local gears = require("gears")

local widgets = {}

function widgets.watchfn(callback, timeout, base_widget)
	local widget = (base_widget or wibox.widget.textbox)()
	gears.timer({
		timeout = timeout or 5,
		call_now = true,
		autostart = true,
		callback = function()
			callback(widget)
		end
	})
	return widget
end

return widgets