diff --git a/sway/commands/layout.c b/sway/commands/layout.c index ff097fef2..d04bb4dc0 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -78,7 +78,7 @@ static struct cmd_results *cmd_layout_auto(swayc_t *container, int argc, char ** struct cmd_results *error = NULL; const char *cmd_name = "layout auto"; const char *set_inc_cmd_name = "layout auto [master|ncol] [set|inc]"; - const char *err_msg = "Allowed arguments are "; + const char *err_msg = "Allowed arguments are "; bool need_layout_update = false; enum swayc_layouts old_layout = container->layout; @@ -90,7 +90,7 @@ static struct cmd_results *cmd_layout_auto(swayc_t *container, int argc, char ** layout = L_AUTO_RIGHT; } else if (strcasecmp(argv[1], "top") == 0) { layout = L_AUTO_TOP; - } else if (strcasecmp(argv[1], "bot") == 0) { + } else if (strcasecmp(argv[1], "bottom") == 0) { layout = L_AUTO_BOTTOM; } else if (strcasecmp(argv[1], "next") == 0) { if (is_auto_layout(container->layout) && container->layout < L_AUTO_LAST) { diff --git a/sway/commands/workspace_layout.c b/sway/commands/workspace_layout.c index 3e0a12cef..c93057732 100644 --- a/sway/commands/workspace_layout.c +++ b/sway/commands/workspace_layout.c @@ -3,7 +3,7 @@ struct cmd_results *cmd_workspace_layout(int argc, char **argv) { struct cmd_results *error = NULL; - if ((error = checkarg(argc, "workspace_layout", EXPECTED_EQUAL_TO, 1))) { + if ((error = checkarg(argc, "workspace_layout", EXPECTED_AT_LEAST, 1))) { return error; } @@ -13,16 +13,27 @@ struct cmd_results *cmd_workspace_layout(int argc, char **argv) { config->default_layout = L_STACKED; } else if (strcasecmp(argv[0], "tabbed") == 0) { config->default_layout = L_TABBED; - } else if (strcasecmp(argv[0], "auto_left") == 0) { - config->default_layout = L_AUTO_LEFT; - } else if (strcasecmp(argv[0], "auto_right") == 0) { - config->default_layout = L_AUTO_RIGHT; - } else if (strcasecmp(argv[0], "auto_top") == 0) { - config->default_layout = L_AUTO_TOP; - } else if (strcasecmp(argv[0], "auto_bottom") == 0) { - config->default_layout = L_AUTO_BOTTOM; + } else if (strcasecmp(argv[0], "auto") == 0) { + if (argc == 1) { + config->default_layout = L_AUTO_FIRST; + } else { + if ((error = checkarg(argc, "workspace_layout auto", EXPECTED_EQUAL_TO, 2))) { + return error; + } + if (strcasecmp(argv[0], "left") == 0) { + config->default_layout = L_AUTO_LEFT; + } else if (strcasecmp(argv[0], "right") == 0) { + config->default_layout = L_AUTO_RIGHT; + } else if (strcasecmp(argv[0], "top") == 0) { + config->default_layout = L_AUTO_TOP; + } else if (strcasecmp(argv[0], "bottom") == 0) { + config->default_layout = L_AUTO_BOTTOM; + } else { + return cmd_results_new(CMD_INVALID, "workspace_layout auto", "Expected 'workspace_layout auto '"); + } + } } else { - return cmd_results_new(CMD_INVALID, "workspace_layout", "Expected 'workspace_layout '"); + return cmd_results_new(CMD_INVALID, "workspace_layout", "Expected 'workspace_layout '"); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } diff --git a/sway/sway.5.txt b/sway/sway.5.txt index 5e0a07bde..ee1cbddd6 100644 --- a/sway/sway.5.txt +++ b/sway/sway.5.txt @@ -64,12 +64,11 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**( **focus** :: Direction may be one of _up_, _down_, _left_, _right_, _next_, _prev_, _parent_, or _child_. The directional focus commands will move the focus - in that direction. The auto_next and auto_prev will focus the next, - respectively previous, element in the current container if it is using - one of the _auto_ layouts. The parent focus command will change the - focus to the parent of the currently focused container, which is useful, - for example, to open a sibling of the parent container, or to move the - entire container around. + in that direction. The _next_ and _prev_ directions will focus the next, + respectively previous, element in the current container. The parent + focus command will change the focus to the parent of the currently + focused container, which is useful, for example, to open a sibling of + the parent container, or to move the entire container around. **focus** output :: Direction may be one of _up_, _down_, _left_, _right_. The directional focus @@ -88,7 +87,7 @@ They are expected to be used with **bindsym** or at runtime through **swaymsg**( **layout** auto :: Sets layout to one of the auto modes, i.e. one of _left_, right_, _top_, - or _bot_. + or _bottom_. **layout** auto :: Cycles between available auto layouts. @@ -381,8 +380,8 @@ The default colors are: switch to workspace 2, then invoke the "workspace 2" command again, you will be returned to workspace 1. Defaults to _no_. -**workspace_layout** :: - Specifies the start layout for new workspaces. +**workspace_layout** :: Specifies the start layout for new workspaces. **include** :: Includes a sub config file by _path_. _path_ can be either a full path or a