diff options
Diffstat (limited to 'sway/commands/titlebar_border_thickness.c')
-rw-r--r-- | sway/commands/titlebar_border_thickness.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/commands/titlebar_border_thickness.c b/sway/commands/titlebar_border_thickness.c new file mode 100644 index 00000000..c1e9bb52 --- /dev/null +++ b/sway/commands/titlebar_border_thickness.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <string.h> | ||
2 | #include "sway/commands.h" | ||
3 | #include "sway/config.h" | ||
4 | #include "sway/output.h" | ||
5 | #include "sway/tree/arrange.h" | ||
6 | #include "log.h" | ||
7 | |||
8 | struct cmd_results *cmd_titlebar_border_thickness(int argc, char **argv) { | ||
9 | struct cmd_results *error = NULL; | ||
10 | if ((error = checkarg(argc, "titlebar_border_thickness", EXPECTED_EQUAL_TO, 1))) { | ||
11 | return error; | ||
12 | } | ||
13 | |||
14 | char *inv; | ||
15 | int value = strtol(argv[0], &inv, 10); | ||
16 | if (*inv != '\0' || value < 0 || value > config->titlebar_v_padding) { | ||
17 | return cmd_results_new(CMD_FAILURE, "titlebar_border_thickness", | ||
18 | "Invalid size specified"); | ||
19 | } | ||
20 | |||
21 | config->titlebar_border_thickness = value; | ||
22 | |||
23 | for (int i = 0; i < root->outputs->length; ++i) { | ||
24 | struct sway_output *output = root->outputs->items[i]; | ||
25 | arrange_workspace(output_get_active_workspace(output)); | ||
26 | output_damage_whole(output); | ||
27 | } | ||
28 | |||
29 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
30 | } | ||