summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-06-09 23:23:15 +0200
committerAylur <[email protected]>2024-06-09 23:23:15 +0200
commit721f9c8b067d1a119d5379086e3d2cfdd84a97f9 (patch)
tree444f48ee0405bc92d6e9bd673bc19f05a643ddd4 /lua
parent41cb376a02d12f85eb1e4893425af15614c2e187 (diff)
fix: centerbox setters
Diffstat (limited to 'lua')
-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