summaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2017-11-22 21:37:07 -0500
committerDrew DeVault <[email protected]>2017-11-22 21:37:07 -0500
commit7753a0ec750f17e1f014cda0dd2564ae0533cdd4 (patch)
tree581d84114d97edbe2ef068a7568fe44b63159ce5 /sway/ipc-json.c
parentd7d21bb0f895248cafefc3d12e4aed033a8e5d17 (diff)
Wire up IPC server
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
new file mode 100644
index 00000000..6fcb91fa
--- /dev/null
+++ b/sway/ipc-json.c
@@ -0,0 +1,18 @@
+#include <json-c/json.h>
+#include <stdio.h>
+#include "sway/ipc-json.h"
+
+json_object *ipc_json_get_version() {
+ int major = 0, minor = 0, patch = 0;
+ json_object *version = json_object_new_object();
+
+ sscanf(SWAY_VERSION, "%u.%u.%u", &major, &minor, &patch);
+
+ json_object_object_add(version, "human_readable", json_object_new_string(SWAY_VERSION));
+ json_object_object_add(version, "variant", json_object_new_string("sway"));
+ json_object_object_add(version, "major", json_object_new_int(major));
+ json_object_object_add(version, "minor", json_object_new_int(minor));
+ json_object_object_add(version, "patch", json_object_new_int(patch));
+
+ return version;
+}