mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	command: implement split none
This commit is contained in:
		
							parent
							
								
									4baf845a3a
								
							
						
					
					
						commit
						de3c290427
					
				
					 2 changed files with 25 additions and 2 deletions
				
			
		| 
						 | 
					@ -32,6 +32,24 @@ static struct cmd_results *do_split(int layout) {
 | 
				
			||||||
	return cmd_results_new(CMD_SUCCESS, NULL);
 | 
						return cmd_results_new(CMD_SUCCESS, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct cmd_results *do_unsplit() {
 | 
				
			||||||
 | 
						struct sway_container *con = config->handler_context.container;
 | 
				
			||||||
 | 
						struct sway_workspace *ws = config->handler_context.workspace;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (con && con->parent && con->parent->children->length == 1) {
 | 
				
			||||||
 | 
							container_flatten(con->parent);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							return cmd_results_new(CMD_FAILURE, "Can only flatten a child container with no siblings");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (root->fullscreen_global) {
 | 
				
			||||||
 | 
							arrange_root();
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							arrange_workspace(ws);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return cmd_results_new(CMD_SUCCESS, NULL);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct cmd_results *cmd_split(int argc, char **argv) {
 | 
					struct cmd_results *cmd_split(int argc, char **argv) {
 | 
				
			||||||
	struct cmd_results *error = NULL;
 | 
						struct cmd_results *error = NULL;
 | 
				
			||||||
	if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) {
 | 
						if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) {
 | 
				
			||||||
| 
						 | 
					@ -55,6 +73,9 @@ struct cmd_results *cmd_split(int argc, char **argv) {
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			return do_split(L_VERT);
 | 
								return do_split(L_VERT);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						} else if (strcasecmp(argv[0], "n") == 0 ||
 | 
				
			||||||
 | 
								strcasecmp(argv[0], "none") == 0) {
 | 
				
			||||||
 | 
							return do_unsplit();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		return cmd_results_new(CMD_FAILURE,
 | 
							return cmd_results_new(CMD_FAILURE,
 | 
				
			||||||
			"Invalid split command (expected either horizontal or vertical).");
 | 
								"Invalid split command (expected either horizontal or vertical).");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -319,8 +319,10 @@ set|plus|minus|toggle <amount>
 | 
				
			||||||
	established by the *seat* subcommand of the same name. See
 | 
						established by the *seat* subcommand of the same name. See
 | 
				
			||||||
	*sway-input*(5) for more ways to affect inhibitors.
 | 
						*sway-input*(5) for more ways to affect inhibitors.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
*split* vertical|v|horizontal|h|toggle|t
 | 
					*split* vertical|v|horizontal|h|none|n|toggle|t
 | 
				
			||||||
	Splits the current container, vertically or horizontally. When _toggle_ is
 | 
						Splits the current container, vertically or horizontally. When _none_ is
 | 
				
			||||||
 | 
						specified, the effect of a previous split is undone if the current
 | 
				
			||||||
 | 
						container is the only child of a split parent. When _toggle_ is
 | 
				
			||||||
	specified, the current container is split opposite to the parent
 | 
						specified, the current container is split opposite to the parent
 | 
				
			||||||
	container's layout.
 | 
						container's layout.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue