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