mirror of
				https://github.com/swaywm/sway.git
				synced 2025-10-29 05:40:18 -04:00 
			
		
		
		
	sway/commands/layout: flatten parent once
Applying layout changes to the parent of the parent, in case the parent only has a single child, stops the creation of a chain of single child containers. Closes: https://github.com/swaywm/sway/issues/7945
This commit is contained in:
		
							parent
							
								
									87fbcf0574
								
							
						
					
					
						commit
						f50e307227
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -134,6 +134,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | ||||||
| 	// Operate on parent container, like i3.
 | 	// Operate on parent container, like i3.
 | ||||||
| 	if (container) { | 	if (container) { | ||||||
| 		container = container->pending.parent; | 		container = container->pending.parent; | ||||||
|  | 		// If parent has only a singe child operate on its parent and
 | ||||||
|  | 		// flatten once, like i3
 | ||||||
|  | 		if (container && container->pending.children->length == 1) { | ||||||
|  | 			struct sway_container *child = container->pending.children->items[0]; | ||||||
|  | 			struct sway_container *parent = container->pending.parent; | ||||||
|  | 			container_replace(container, child); | ||||||
|  | 			container_begin_destroy(container); | ||||||
|  | 			container = parent; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// We could be working with a container OR a workspace. These are different
 | 	// We could be working with a container OR a workspace. These are different
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bonsaiiV
						bonsaiiV