diff options
Diffstat (limited to 'sway/commands/bar/font.c')
-rw-r--r-- | sway/commands/bar/font.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sway/commands/bar/font.c b/sway/commands/bar/font.c new file mode 100644 index 00000000..80b7a593 --- /dev/null +++ b/sway/commands/bar/font.c | |||
@@ -0,0 +1,21 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
2 | #include <string.h> | ||
3 | #include "sway/commands.h" | ||
4 | #include "log.h" | ||
5 | #include "stringop.h" | ||
6 | |||
7 | struct cmd_results *bar_cmd_font(int argc, char **argv) { | ||
8 | struct cmd_results *error = NULL; | ||
9 | if ((error = checkarg(argc, "font", EXPECTED_AT_LEAST, 1))) { | ||
10 | return error; | ||
11 | } | ||
12 | if (!config->current_bar) { | ||
13 | return cmd_results_new(CMD_FAILURE, "font", "No bar defined."); | ||
14 | } | ||
15 | char *font = join_args(argv, argc); | ||
16 | free(config->current_bar->font); | ||
17 | config->current_bar->font = strdup(font); | ||
18 | wlr_log(L_DEBUG, "Settings font '%s' for bar: %s", | ||
19 | config->current_bar->font, config->current_bar->id); | ||
20 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
21 | } | ||