mirror of
https://github.com/swaywm/sway.git
synced 2025-11-07 13:29:56 -05:00
Implement title alignment
This adds support for `i3 4.16`'s ability to set the title alignment. The command is `title_align left|center|right`. When the title is on the right, marks are moved to the left. Otherwise, they are on the right.
This commit is contained in:
parent
91bbb2a7dd
commit
e6562c8cd2
8 changed files with 126 additions and 21 deletions
30
sway/commands/title_align.c
Normal file
30
sway/commands/title_align.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/output.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/root.h"
|
||||
|
||||
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, "title_align",
|
||||
"Expected 'title_align left|center|right'");
|
||||
}
|
||||
|
||||
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, NULL);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue