summaryrefslogtreecommitdiff
path: root/util/widgets.lua
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2024-11-03 16:09:10 -0600
committerTim Keller <tjkeller.xyz>2024-11-03 16:09:10 -0600
commitfea2bd24e83c90c311f4e77ccf46f1464a6f5afb (patch)
tree2edc2072ae629d8082fdb653a052df23b1c49f2e /util/widgets.lua
parent9a11cd62ac1ca5659a36fb3111d3bf7dead9d85b (diff)
downloadawesome-fea2bd24e83c90c311f4e77ccf46f1464a6f5afb.tar.xz
awesome-fea2bd24e83c90c311f4e77ccf46f1464a6f5afb.zip
update temp widget to be fancier and other small stuff
Diffstat (limited to 'util/widgets.lua')
-rw-r--r--util/widgets.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/util/widgets.lua b/util/widgets.lua
index 301f25b..eae351d 100644
--- a/util/widgets.lua
+++ b/util/widgets.lua
@@ -3,17 +3,21 @@ local gears = require("gears")
local widgets = {}
-function widgets.watchfn(callback, timeout, base_widget)
- local widget = (base_widget or wibox.widget.textbox)()
- gears.timer({
+function widgets.add_timer(w, callback, timeout)
+ w._timer = gears.timer({
timeout = timeout or 5,
call_now = true,
autostart = true,
callback = function()
- callback(widget)
+ callback(w)
end
})
- return widget
+ 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