blob: 7f5dd3ae566f87f837f0319e13541b8e8d73fd31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/output.h"
#include "sway/tree/container.h"
#include "sway/tree/root.h"
static void arrange_title_bar_iterator(struct sway_container *con, void *data) {
container_arrange_title_bar(con);
}
struct cmd_results *cmd_title_align(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "title_align", EXPECTED_AT_LEAST, 1))) {
return error;
}
if (strcmp(argv[0], "left") == 0) {
config->title_align = ALIGN_LEFT;
} else if (strcmp(argv[0], "center") == 0) {
config->title_align = ALIGN_CENTER;
} else if (strcmp(argv[0], "right") == 0) {
config->title_align = ALIGN_RIGHT;
} else {
return cmd_results_new(CMD_INVALID,
"Expected 'title_align left|center|right'");
}
root_for_each_container(arrange_title_bar_iterator, NULL);
for (int i = 0; i < root->outputs->length; ++i) {
struct sway_output *output = root->outputs->items[i];
output_damage_whole(output);
}
return cmd_results_new(CMD_SUCCESS, NULL);
}
|