aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/font.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 17:20:03 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 22:11:08 -0400
commitbf7a4cd0ebd465a0597e9eec0142fad222b396de (patch)
treef95c4b8cd8e7d06eaa1b688d3bcbb3249dc21129 /sway/commands/bar/font.c
parentImplement enough IPC for swaybar to work (diff)
downloadsway-bf7a4cd0ebd465a0597e9eec0142fad222b396de.tar.gz
sway-bf7a4cd0ebd465a0597e9eec0142fad222b396de.tar.zst
sway-bf7a4cd0ebd465a0597e9eec0142fad222b396de.zip
Add bar configuration commands
Diffstat (limited to 'sway/commands/bar/font.c')
-rw-r--r--sway/commands/bar/font.c26
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..6d7c533a
--- /dev/null
+++ b/sway/commands/bar/font.c
@@ -0,0 +1,26 @@
1#include <string.h>
2#include "sway/commands.h"
3#include "log.h"
4#include "stringop.h"
5
6struct 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 wlr_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}