mirror of
https://github.com/swaywm/sway.git
synced 2025-11-03 09:01:43 -05:00
Wire up IPC server
This commit is contained in:
parent
d7d21bb0f8
commit
7753a0ec75
6 changed files with 453 additions and 2 deletions
18
sway/ipc-json.c
Normal file
18
sway/ipc-json.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue