diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-10-02 11:37:33 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 11:37:33 +1000 |
commit | 183a4b0d6bbd17199d7071bfe5b76feb87838c18 (patch) | |
tree | a19bcbc62ff5d4ddcb822914a4f3516c7766406a /sway/commands | |
parent | b542c5413efdbbe0bbf3be0196fe566b8c6bb07f (diff) | |
parent | bb25194844599bb653a78633c9c09c0c0ff225ee (diff) |
Merge pull request #2740 from RedSoxFan/gap-borders
Handle gap borders
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/hide_edge_borders.c | 16 | ||||
-rw-r--r-- | sway/commands/smart_borders.c | 25 |
2 files changed, 31 insertions, 10 deletions
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c index 0a5c7f28..ea261fb1 100644 --- a/sway/commands/hide_edge_borders.c +++ b/sway/commands/hide_edge_borders.c @@ -1,15 +1,8 @@ #include "sway/commands.h" #include "sway/config.h" -#include "sway/tree/container.h" -#include "sway/tree/root.h" +#include "sway/tree/arrange.h" #include "sway/tree/view.h" -static void _configure_view(struct sway_container *con, void *data) { - if (con->view) { - view_autoconfigure(con->view); - } -} - struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_EQUAL_TO, 1))) { @@ -26,13 +19,16 @@ struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { config->hide_edge_borders = E_BOTH; } else if (strcmp(argv[0], "smart") == 0) { config->hide_edge_borders = E_SMART; + } else if (strcmp(argv[0], "smart_no_gaps") == 0) { + config->hide_edge_borders = E_SMART_NO_GAPS; } else { return cmd_results_new(CMD_INVALID, "hide_edge_borders", "Expected 'hide_edge_borders " - "<none|vertical|horizontal|both|smart>'"); + "<none|vertical|horizontal|both|smart|smart_no_gaps>'"); } + config->saved_edge_borders = config->hide_edge_borders; - root_for_each_container(_configure_view, NULL); + arrange_root(); return cmd_results_new(CMD_SUCCESS, NULL, NULL); } diff --git a/sway/commands/smart_borders.c b/sway/commands/smart_borders.c new file mode 100644 index 00000000..fcb4040e --- /dev/null +++ b/sway/commands/smart_borders.c @@ -0,0 +1,25 @@ +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/tree/arrange.h" +#include "sway/tree/view.h" +#include "util.h" + +struct cmd_results *cmd_smart_borders(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "smart_borders", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + enum edge_border_types saved = config->hide_edge_borders; + if (strcmp(argv[0], "no_gaps") == 0) { + config->hide_edge_borders = E_SMART_NO_GAPS; + } else { + config->hide_edge_borders = parse_boolean(argv[0], true) ? + E_SMART : config->saved_edge_borders; + } + config->saved_edge_borders = saved; + + arrange_root(); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} |