From 440d1560a32a2368214b11983786bdcf84f0f7c7 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Oct 2021 21:45:09 -0700 Subject: [PATCH] layoutlist: Fix the `layout` consturctor parameter. If set, it would override some important widget methods and explode. --- lib/awful/widget/layoutlist.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/awful/widget/layoutlist.lua b/lib/awful/widget/layoutlist.lua index b1170823..563f0fae 100644 --- a/lib/awful/widget/layoutlist.lua +++ b/lib/awful/widget/layoutlist.lua @@ -314,10 +314,10 @@ function layoutlist:set_base_layout(layout) layout or wibox.layout.fixed.horizontal ) - if self._private.layout.set_spacing then - self._private.layout:set_spacing( - self._private.style.spacing or beautiful.layoutlist_spacing or 0 - ) + local spacing = self._private.style.spacing or beautiful.tasklist_spacing + + if self._private.layout.set_spacing and spacing then + self._private.layout:set_spacing(spacing) end assert(self._private.layout.is_widget) @@ -415,11 +415,15 @@ local function new(_, args) reload_cache(ret) - -- Apply all args properties - gtable.crush(ret, args) + -- Apply all args properties. Make sure "set_layout" doesn't override + -- the widget `layout` method. + local l = args.layout + args.layout = nil + gtable.crush(ret, args, false) + args.layout = l if not ret._private.layout then - ret:set_base_layout() + ret:set_base_layout(args.layout) end assert(ret._private.layout)