From 6382fe146926019677464b7b58b5634ace4bc61a Mon Sep 17 00:00:00 2001 From: codegax <14095200+codegax@users.noreply.github.com> Date: Sat, 2 May 2026 16:10:00 -0600 Subject: [PATCH] tree/load_layout: give placeholder leaves L_HORIZ layout A placeholder leaf has view==NULL, so arrange_container routes it to its view-less branch, which calls arrange_children with the container's layout. arrange_children asserts on L_NONE, so a plain { swallows: [...] } JSON entry crashed assert-enabled builds before any window could match. Default the layout to L_HORIZ when JSON does not specify one. The placeholder has no children, so the iteration short-circuits without rendering anything until promoted. --- sway/tree/load_layout.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sway/tree/load_layout.c b/sway/tree/load_layout.c index e1addaecf..10f26d3c5 100644 --- a/sway/tree/load_layout.c +++ b/sway/tree/load_layout.c @@ -386,10 +386,12 @@ static struct sway_container *build_node(struct json_object *obj, c->swallows = sw; // Retained so IPC can echo it verbatim for round-trip. c->swallows_json = json_object_get(swallows_v); + // arrange_children asserts on L_NONE; placeholders end up there + // via the view-less branch even with no children. + if (c->pending.layout == L_NONE) { + c->pending.layout = L_HORIZ; + } } else { - // Leaf without swallows is an empty split with no children. i3 does - // not produce these; treat as an error to avoid silently leaving - // orphaned containers. *error_out = format_str("append_layout: node has neither nodes nor " "swallows"); free_transient_subtree(c);