2018-05-12 08:44:56 +10:00
|
|
|
#include "sway/commands.h"
|
|
|
|
#include "sway/config.h"
|
2018-10-02 02:56:27 +10:00
|
|
|
#include "sway/tree/arrange.h"
|
2018-05-12 08:44:56 +10:00
|
|
|
#include "sway/tree/view.h"
|
|
|
|
|
|
|
|
struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
|
2019-06-04 12:29:36 +10:00
|
|
|
const char *expected_syntax = "Expected 'hide_edge_borders [--i3] "
|
|
|
|
"none|vertical|horizontal|both|smart|smart_no_gaps";
|
|
|
|
|
2018-05-12 08:44:56 +10:00
|
|
|
struct cmd_results *error = NULL;
|
2019-02-24 20:00:15 +11:00
|
|
|
if ((error = checkarg(argc, "hide_edge_borders", EXPECTED_AT_LEAST, 1))) {
|
2018-05-12 08:44:56 +10:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2019-06-04 12:29:36 +10:00
|
|
|
bool hide_lone_tab = false;
|
2019-02-24 20:00:15 +11:00
|
|
|
if (strcmp(*argv, "--i3") == 0) {
|
2019-06-04 12:29:36 +10:00
|
|
|
hide_lone_tab = true;
|
2019-02-24 20:00:15 +11:00
|
|
|
++argv;
|
|
|
|
--argc;
|
2019-06-04 12:29:36 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!argc) {
|
2024-04-15 15:39:41 +10:00
|
|
|
return cmd_results_new(CMD_INVALID, "%s", expected_syntax);
|
2019-02-24 20:00:15 +11:00
|
|
|
}
|
|
|
|
|
2018-05-12 08:44:56 +10:00
|
|
|
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) {
|
2019-11-05 09:10:40 +11:00
|
|
|
config->hide_edge_borders = E_NONE;
|
|
|
|
config->hide_edge_borders_smart = ESMART_ON;
|
2018-10-02 02:56:27 +10:00
|
|
|
} else if (strcmp(argv[0], "smart_no_gaps") == 0) {
|
2019-11-05 09:10:40 +11:00
|
|
|
config->hide_edge_borders = E_NONE;
|
|
|
|
config->hide_edge_borders_smart = ESMART_NO_GAPS;
|
2018-05-12 08:44:56 +10:00
|
|
|
} else {
|
2024-04-15 15:39:41 +10:00
|
|
|
return cmd_results_new(CMD_INVALID, "%s", expected_syntax);
|
2018-05-12 08:44:56 +10:00
|
|
|
}
|
2019-06-04 12:29:36 +10:00
|
|
|
config->hide_lone_tab = hide_lone_tab;
|
2018-05-12 08:44:56 +10:00
|
|
|
|
2018-10-02 02:56:27 +10:00
|
|
|
arrange_root();
|
2018-05-12 08:44:56 +10:00
|
|
|
|
2019-01-11 10:27:21 +11:00
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
2018-05-12 08:44:56 +10:00
|
|
|
}
|