From bb25194844599bb653a78633c9c09c0c0ff225ee Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Mon, 1 Oct 2018 12:56:27 -0400 Subject: Handle border options for gaps Fixes `hide_edge_borders smart` when gaps are in use. Implements `hide_edge_borders smart_no_gaps` and `smart_borders on|no_gaps|off`. Since `smart_borders on` is equivalent to `hide_edge_borders smart` and `smart_borders no_gaps` is equivalent to `hide_edge_borders smart_no_gaps`, I opted to just save the last value set for `hide_edge_borders` and restore that on `smart_borders off`. This simplifies the conditions for setting the border. --- sway/commands/smart_borders.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sway/commands/smart_borders.c (limited to 'sway/commands/smart_borders.c') 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); +} -- cgit v1.2.3-70-g09d2