summaryrefslogtreecommitdiff
path: root/util/widgets.lua
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2024-10-18 21:49:17 -0500
committerTim Keller <tjk@tjkeller.xyz>2024-10-18 21:49:17 -0500
commit923eb46350b1102749eb05cd2120c96cc6a715d0 (patch)
tree811da20b4195d4b5c65c8ac0090982a4a23f6a7d /util/widgets.lua
downloadawesome-923eb46350b1102749eb05cd2120c96cc6a715d0.tar.xz
awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.zip
initial commit
Diffstat (limited to 'util/widgets.lua')
-rw-r--r--util/widgets.lua19
1 files changed, 19 insertions, 0 deletions
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