aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/split.c21
-rw-r--r--sway/sway.5.scd6
2 files changed, 25 insertions, 2 deletions
diff --git a/sway/commands/split.c b/sway/commands/split.c
index 3e25c6f7..4c275883 100644
--- a/sway/commands/split.c
+++ b/sway/commands/split.c
@@ -32,6 +32,24 @@ static struct cmd_results *do_split(int layout) {
32 return cmd_results_new(CMD_SUCCESS, NULL); 32 return cmd_results_new(CMD_SUCCESS, NULL);
33} 33}
34 34
35static struct cmd_results *do_unsplit() {
36 struct sway_container *con = config->handler_context.container;
37 struct sway_workspace *ws = config->handler_context.workspace;
38
39 if (con && con->parent && con->parent->children->length == 1) {
40 container_flatten(con->parent);
41 } else {
42 return cmd_results_new(CMD_FAILURE, "Can only flatten a child container with no siblings");
43 }
44
45 if (root->fullscreen_global) {
46 arrange_root();
47 } else {
48 arrange_workspace(ws);
49 }
50 return cmd_results_new(CMD_SUCCESS, NULL);
51}
52
35struct cmd_results *cmd_split(int argc, char **argv) { 53struct cmd_results *cmd_split(int argc, char **argv) {
36 struct cmd_results *error = NULL; 54 struct cmd_results *error = NULL;
37 if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) { 55 if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) {
@@ -55,6 +73,9 @@ struct cmd_results *cmd_split(int argc, char **argv) {
55 } else { 73 } else {
56 return do_split(L_VERT); 74 return do_split(L_VERT);
57 } 75 }
76 } else if (strcasecmp(argv[0], "n") == 0 ||
77 strcasecmp(argv[0], "none") == 0) {
78 return do_unsplit();
58 } else { 79 } else {
59 return cmd_results_new(CMD_FAILURE, 80 return cmd_results_new(CMD_FAILURE,
60 "Invalid split command (expected either horizontal or vertical)."); 81 "Invalid split command (expected either horizontal or vertical).");
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index fa1d83a8..202cd13f 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -319,8 +319,10 @@ set|plus|minus|toggle <amount>
319 established by the *seat* subcommand of the same name. See 319 established by the *seat* subcommand of the same name. See
320 *sway-input*(5) for more ways to affect inhibitors. 320 *sway-input*(5) for more ways to affect inhibitors.
321 321
322*split* vertical|v|horizontal|h|toggle|t 322*split* vertical|v|horizontal|h|none|n|toggle|t
323 Splits the current container, vertically or horizontally. When _toggle_ is 323 Splits the current container, vertically or horizontally. When _none_ is
324 specified, the effect of a previous split is undone if the current
325 container is the only child of a split parent. When _toggle_ is
324 specified, the current container is split opposite to the parent 326 specified, the current container is split opposite to the parent
325 container's layout. 327 container's layout.
326 328