From d5b4c8e368050cf1b84b03c1379bbbc3c817a713 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 16 Feb 2012 23:29:29 +0000 Subject: 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. --- src/print_load.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/print_load.c') diff --git a/src/print_load.c b/src/print_load.c index d47ecea..8c2343b 100644 --- a/src/print_load.c +++ b/src/print_load.c @@ -6,6 +6,9 @@ void print_load(const char *format) { /* Get load */ + if (output_format == O_I3BAR) + printf("{\"name\":\"load\", \"full_text\":\""); + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) double loadavg[3]; const char *walk; @@ -34,6 +37,10 @@ void print_load(const char *format) { walk += strlen("15min"); } } + + if (output_format == O_I3BAR) + printf("\"}"); + return; error: #endif -- cgit v1.2.3