swayfx/sway/commands/hide_edge_borders.c

39 lines
1.1 KiB
C
Raw Normal View History

2018-05-12 08:44:56 +10:00
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/tree/container.h"
#include "sway/tree/root.h"
2018-05-12 08:44:56 +10:00
#include "sway/tree/view.h"
static void _configure_view(struct sway_container *con, void *data) {
if (con->type == C_VIEW) {
view_autoconfigure(con->sway_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))) {
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 {
return cmd_results_new(CMD_INVALID, "hide_edge_borders",
"Expected 'hide_edge_borders "
"<none|vertical|horizontal|both|smart>'");
}
root_for_each_container(_configure_view, NULL);
2018-05-12 08:44:56 +10:00
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}