diff options
author | emersion <contact@emersion.fr> | 2018-11-26 09:28:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 09:28:25 +0100 |
commit | c2921b2e613642ec147513607fb13d98ee43cee7 (patch) | |
tree | 20949c3508ada4d015e57504abbd1c62f0f5133b /sway/commands | |
parent | 0e6e5af9833bcfac30d4a19d7fa5b88e81ce67cd (diff) | |
parent | e6562c8cd26c2e7caa4c83aaa5d734643fba4015 (diff) | |
download | sway-c2921b2e613642ec147513607fb13d98ee43cee7.tar.xz |
Merge pull request #3169 from RedSoxFan/title-align
Implement title alignment
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/title_align.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sway/commands/title_align.c b/sway/commands/title_align.c new file mode 100644 index 00000000..82578186 --- /dev/null +++ b/sway/commands/title_align.c @@ -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); +} |