summaryrefslogtreecommitdiff
path: root/src/print_load.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-02-16 23:29:29 +0000
committerMichael Stapelberg <michael@stapelberg.de>2012-02-16 23:30:54 +0000
commitd5b4c8e368050cf1b84b03c1379bbbc3c817a713 (patch)
tree2f918d4c5b95a05ebec68bceec35f7d4fa9a0c4e /src/print_load.c
parent7149f6f78e0d105f02d54e1db60db8b191a98acb (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/print_load.c')
-rw-r--r--src/print_load.c7
1 files changed, 7 insertions, 0 deletions
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