From 60df5cc9f80a64a594c81d6ec438e86f6e73cd0c Mon Sep 17 00:00:00 2001 From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com> Date: Sun, 4 Nov 2018 18:12:14 +0100 Subject: [PATCH 1/2] Correct manpage regarding gaps command The command 'gaps inner|outer all|current set|plus|minus ' is not valid in the configuration file, hence list it accordingly. --- sway/sway.5.scd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sway/sway.5.scd b/sway/sway.5.scd index b3d696f2..b83cf8ac 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd @@ -133,6 +133,10 @@ They are expected to be used with *bindsym* or at runtime through *swaymsg*(1). *fullscreen* Toggles fullscreen for the focused view. +*gaps* inner|outer all|current set|plus|minus + Changes the _inner_ or _outer_ gaps for either _all_ workspaces or the + _current_ workspace. + *layout* default|splith|splitv|stacking|tabbed Sets the layout mode of the focused container. @@ -433,10 +437,6 @@ The default colors are: This affects new workspaces only, and is used when the workspace doesn't have its own gaps settings (see: workspace gaps inner|outer ). -*gaps* inner|outer all|current set|plus|minus - Changes the _inner_ or _outer_ gaps for either _all_ workspaces or the - _current_ workspace. - *hide\_edge\_borders* none|vertical|horizontal|both|smart|smart\_no\_gaps Hides window borders adjacent to the screen edges. Default is _none_. From 67866dc3785453ad0ac97d14858c9176cbcca966 Mon Sep 17 00:00:00 2001 From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com> Date: Sun, 4 Nov 2018 20:40:14 +0100 Subject: [PATCH 2/2] gaps: Improve error reporting Always raise an error if the runtime only gaps command is found in the config file. --- sway/commands/gaps.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c index ca8cb27a..3f0ef155 100644 --- a/sway/commands/gaps.c +++ b/sway/commands/gaps.c @@ -149,16 +149,17 @@ struct cmd_results *cmd_gaps(int argc, char **argv) { return error; } + bool config_loading = !config->active || config->reloading; + if (argc == 2) { return gaps_set_defaults(argc, argv); } - if (argc == 4) { - if (config->active) { - return gaps_set_runtime(argc, argv); - } else { - return cmd_results_new(CMD_INVALID, "gaps", - "This syntax can only be used when sway is running"); - } + if (argc == 4 && !config_loading) { + return gaps_set_runtime(argc, argv); + } + if (config_loading) { + return cmd_results_new(CMD_INVALID, "gaps", + "Expected 'gaps inner|outer '"); } return cmd_results_new(CMD_INVALID, "gaps", "Expected 'gaps inner|outer ' or "