summaryrefslogtreecommitdiffstats
path: root/sway/ipc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc.c')
-rw-r--r--sway/ipc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index 0b36d758..c5b72db7 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -12,6 +12,7 @@
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include <fcntl.h> 13#include <fcntl.h>
14#include <ctype.h> 14#include <ctype.h>
15#include <json-c/json.h>
15#include "ipc.h" 16#include "ipc.h"
16#include "log.h" 17#include "log.h"
17#include "config.h" 18#include "config.h"
@@ -226,6 +227,18 @@ void ipc_client_handle_command(struct ipc_client *client) {
226 free(json); 227 free(json);
227 break; 228 break;
228 } 229 }
230 case IPC_GET_VERSION:
231 {
232 json_object *json = json_object_new_object();
233 json_object_object_add(json, "human_readable", json_object_new_string(SWAY_GIT_VERSION));
234 json_object_object_add(json, "major", json_object_new_int(0));
235 json_object_object_add(json, "minor", json_object_new_int(0));
236 json_object_object_add(json, "patch", json_object_new_int(1));
237 const char *json_string = json_object_to_json_string(json);
238 ipc_send_reply(client, json_string, (uint32_t) strlen(json_string));
239 json_object_put(json); // free
240 break;
241 }
229 default: 242 default:
230 sway_log(L_INFO, "Unknown IPC command type %i", client->current_command); 243 sway_log(L_INFO, "Unknown IPC command type %i", client->current_command);
231 ipc_client_disconnect(client); 244 ipc_client_disconnect(client);