aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-11-22 21:37:07 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-11-22 21:37:07 -0500
commit7753a0ec750f17e1f014cda0dd2564ae0533cdd4 (patch)
tree581d84114d97edbe2ef068a7568fe44b63159ce5 /sway/ipc-json.c
parentAdd initial command subsystem (untested) (diff)
downloadsway-7753a0ec750f17e1f014cda0dd2564ae0533cdd4.tar.gz
sway-7753a0ec750f17e1f014cda0dd2564ae0533cdd4.tar.zst
sway-7753a0ec750f17e1f014cda0dd2564ae0533cdd4.zip
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 @@
1#include <json-c/json.h>
2#include <stdio.h>
3#include "sway/ipc-json.h"
4
5json_object *ipc_json_get_version() {
6 int major = 0, minor = 0, patch = 0;
7 json_object *version = json_object_new_object();
8
9 sscanf(SWAY_VERSION, "%u.%u.%u", &major, &minor, &patch);
10
11 json_object_object_add(version, "human_readable", json_object_new_string(SWAY_VERSION));
12 json_object_object_add(version, "variant", json_object_new_string("sway"));
13 json_object_object_add(version, "major", json_object_new_int(major));
14 json_object_object_add(version, "minor", json_object_new_int(minor));
15 json_object_object_add(version, "patch", json_object_new_int(patch));
16
17 return version;
18}