summaryrefslogtreecommitdiff
path: root/lua/astal
diff options
context:
space:
mode:
Diffstat (limited to 'lua/astal')
-rw-r--r--lua/astal/widget.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/astal/widget.lua b/lua/astal/widget.lua
index 7a88a1c..8cbb9b9 100644
--- a/lua/astal/widget.lua
+++ b/lua/astal/widget.lua
@@ -166,7 +166,11 @@ local function astalify(ctor)
end
-- construct, attach bindings, add children
- local widget = ctor(props)
+ local widget = ctor()
+
+ for prop, value in pairs(props) do
+ widget[prop] = value
+ end
for prop, binding in pairs(bindings) do
widget.on_destroy = binding:subscribe(function(v)
@@ -180,7 +184,9 @@ local function astalify(ctor)
set_children(widget, v)
end)
else
- set_children(widget, children)
+ if #children > 0 then
+ set_children(widget, children)
+ end
end
if type(setup) == "function" then