From 95cc1aad8ed761126448769e1b306ee82d84c749 Mon Sep 17 00:00:00 2001 From: PlayerNameHere Date: Tue, 29 Sep 2020 20:00:40 +0800 Subject: [PATCH] Fix wibox.layout.stack drawing the top layer at the bottom The top layer was being drawn under the other layers. Fixed by iterating the widgets table backwards, so that the top (index 1) is drawn last. --- lib/wibox/layout/stack.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/wibox/layout/stack.lua b/lib/wibox/layout/stack.lua index 6f3cd92a9..8d84fd46d 100644 --- a/lib/wibox/layout/stack.lua +++ b/lib/wibox/layout/stack.lua @@ -74,7 +74,9 @@ function stack:layout(_, width, height) local h_off, v_off = spacing, spacing - for _, v in pairs(self._private.widgets) do + -- Iterate backwards to draw top (index 1) last so that it appears above other layers + for i = #self._private.widgets, 1, -1 do + local v = self._private.widgets[i] table.insert(result, base.place_widget_at(v, h_off, v_off, width, height)) h_off, v_off = h_off + self._private.h_offset, v_off + self._private.v_offset if self._private.top_only then break end