From 721f9c8b067d1a119d5379086e3d2cfdd84a97f9 Mon Sep 17 00:00:00 2001 From: Aylur Date: Sun, 9 Jun 2024 23:23:15 +0200 Subject: fix: centerbox setters --- lua/astal/widget.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lua') 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 -- cgit v1.2.3