mirror of
https://github.com/swaywm/sway.git
synced 2024-11-17 13:42:36 +00:00
bb25194844
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.
35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
#include "sway/commands.h"
|
|
#include "sway/config.h"
|
|
#include "sway/tree/arrange.h"
|
|
#include "sway/tree/view.h"
|
|
|
|
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))) {
|
|
return error;
|
|
}
|
|
|
|
if (strcmp(argv[0], "none") == 0) {
|
|
config->hide_edge_borders = E_NONE;
|
|
} else if (strcmp(argv[0], "vertical") == 0) {
|
|
config->hide_edge_borders = E_VERTICAL;
|
|
} else if (strcmp(argv[0], "horizontal") == 0) {
|
|
config->hide_edge_borders = E_HORIZONTAL;
|
|
} else if (strcmp(argv[0], "both") == 0) {
|
|
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|smart_no_gaps>'");
|
|
}
|
|
config->saved_edge_borders = config->hide_edge_borders;
|
|
|
|
arrange_root();
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
|
}
|