aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/titlebar_border_thickness.c
diff options
context:
space:
mode:
authorLibravatar Florent de Lamotte <florent.lamotte@gmail.com>2018-11-17 20:06:48 +0100
committerLibravatar Florent de Lamotte <florent.lamotte@gmail.com>2018-11-22 10:30:04 +0100
commit7555c7efdce66c7de7a5320879c501e901a5aab7 (patch)
treed9acff5cb9d0a5e420067602aca11f79fc1aabb7 /sway/commands/titlebar_border_thickness.c
parentMerge pull request #3158 from emersion/get-outputs-focused (diff)
downloadsway-7555c7efdce66c7de7a5320879c501e901a5aab7.tar.gz
sway-7555c7efdce66c7de7a5320879c501e901a5aab7.tar.zst
sway-7555c7efdce66c7de7a5320879c501e901a5aab7.zip
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.c30
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
8struct 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}