diff options
author | emersion <contact@emersion.fr> | 2018-11-24 08:59:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-24 08:59:01 +0100 |
commit | d440468d2deb31d311564a5b796608136cf99e49 (patch) | |
tree | 01e58548cb5199ef8a682c8634655aeeef51d0b8 /sway/commands/titlebar_border_thickness.c | |
parent | d9ed1f080b23067db432b358a5d15b9c94d2c59d (diff) | |
parent | 7555c7efdce66c7de7a5320879c501e901a5aab7 (diff) |
Merge pull request #3145 from fdlamotte/master
Adding commands for configuring titlebar borders and padding
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 @@ +#include <string.h> +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/output.h" +#include "sway/tree/arrange.h" +#include "log.h" + +struct cmd_results *cmd_titlebar_border_thickness(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "titlebar_border_thickness", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + char *inv; + int value = strtol(argv[0], &inv, 10); + if (*inv != '\0' || value < 0 || value > config->titlebar_v_padding) { + return cmd_results_new(CMD_FAILURE, "titlebar_border_thickness", + "Invalid size specified"); + } + + config->titlebar_border_thickness = value; + + for (int i = 0; i < root->outputs->length; ++i) { + struct sway_output *output = root->outputs->items[i]; + arrange_workspace(output_get_active_workspace(output)); + output_damage_whole(output); + } + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} |