File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -137,11 +137,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
137137 // If parent has only a singe child operate on its parent and
138138 // flatten once, like i3
139139 if (container && container -> pending .children -> length == 1 ) {
140- struct sway_container * child = container -> pending . children -> items [ 0 ];
140+ // Also check grandparent to avoid restricting layouts
141141 struct sway_container * parent = container -> pending .parent ;
142- container_replace (container , child );
143- container_begin_destroy (container );
144- container = parent ;
142+ if (parent && parent -> pending .children -> length == 1 ) {
143+ struct sway_container * child = container -> pending .children -> items [0 ];
144+ struct sway_container * parent = container -> pending .parent ;
145+ container_replace (container , child );
146+ container_begin_destroy (container );
147+ container = parent ;
148+ }
145149 }
146150 }
147151
You can’t perform that action at this time.
0 commit comments