diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2012-02-16 23:29:29 +0000 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2012-02-16 23:30:54 +0000 |
commit | d5b4c8e368050cf1b84b03c1379bbbc3c817a713 (patch) | |
tree | 2f918d4c5b95a05ebec68bceec35f7d4fa9a0c4e /src/output.c | |
parent | 7149f6f78e0d105f02d54e1db60db8b191a98acb (diff) |
Implement the i3bar JSON protocol
This hardcodes all the JSON parts. Strings are not properly escaped currently.
The best/easiest way to fix this is by actually using libyajl.
Diffstat (limited to 'src/output.c')
-rw-r--r-- | src/output.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/output.c b/src/output.c index c0c1480..96dd3e4 100644 --- a/src/output.c +++ b/src/output.c @@ -24,6 +24,8 @@ char *color(const char *colorstr) { (void)snprintf(colorbuf, sizeof(colorbuf), "^fg(%s)", cfg_getstr(cfg_general, colorstr)); else if (output_format == O_XMOBAR) (void)snprintf(colorbuf, sizeof(colorbuf), "<fc=%s>", cfg_getstr(cfg_general, colorstr)); + else if (output_format == O_I3BAR) + (void)snprintf(colorbuf, sizeof(colorbuf), "\"color\":\"%s\", ", cfg_getstr(cfg_general, colorstr)); return colorbuf; } @@ -43,6 +45,8 @@ void print_seperator() { printf("^fg(%s)^p(5;-2)^ro(2)^p()^fg()^p(5)", cfg_getstr(cfg_general, "color_separator")); else if (output_format == O_XMOBAR) printf("<fc=%s> | </fc>", cfg_getstr(cfg_general, "color_separator")); + else if (output_format == O_I3BAR) + printf(", "); else if (output_format == O_NONE) printf(" | "); } |