diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 12:56:27 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-10-01 21:19:06 -0400 |
commit | bb25194844599bb653a78633c9c09c0c0ff225ee (patch) | |
tree | a19bcbc62ff5d4ddcb822914a4f3516c7766406a /sway/commands/smart_borders.c | |
parent | Merge pull request #2739 from RedSoxFan/fix-2653 (diff) | |
download | sway-bb25194844599bb653a78633c9c09c0c0ff225ee.tar.gz sway-bb25194844599bb653a78633c9c09c0c0ff225ee.tar.zst sway-bb25194844599bb653a78633c9c09c0c0ff225ee.zip |
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.
Diffstat (limited to 'sway/commands/smart_borders.c')
-rw-r--r-- | sway/commands/smart_borders.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ | |||
1 | #include "sway/commands.h" | ||
2 | #include "sway/config.h" | ||
3 | #include "sway/tree/arrange.h" | ||
4 | #include "sway/tree/view.h" | ||
5 | #include "util.h" | ||
6 | |||
7 | struct cmd_results *cmd_smart_borders(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "smart_borders", EXPECTED_EQUAL_TO, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | |||
13 | enum edge_border_types saved = config->hide_edge_borders; | ||
14 | if (strcmp(argv[0], "no_gaps") == 0) { | ||
15 | config->hide_edge_borders = E_SMART_NO_GAPS; | ||
16 | } else { | ||
17 | config->hide_edge_borders = parse_boolean(argv[0], true) ? | ||
18 | E_SMART : config->saved_edge_borders; | ||
19 | } | ||
20 | config->saved_edge_borders = saved; | ||
21 | |||
22 | arrange_root(); | ||
23 | |||
24 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
25 | } | ||