From 923eb46350b1102749eb05cd2120c96cc6a715d0 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Fri, 18 Oct 2024 21:49:17 -0500 Subject: initial commit --- util/widgets.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 util/widgets.lua (limited to 'util/widgets.lua') diff --git a/util/widgets.lua b/util/widgets.lua new file mode 100644 index 0000000..301f25b --- /dev/null +++ b/util/widgets.lua @@ -0,0 +1,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 -- cgit v1.2.3