summaryrefslogtreecommitdiff
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorIan Fan <[email protected]>2018-07-08 20:34:47 +0100
committerIan Fan <[email protected]>2018-07-10 12:37:37 +0100
commit23c1c26c3fedf5470dbee9fe97c2374a48588863 (patch)
tree751b5569e4e05149c7a7cd7e0d8084be5ff62063 /sway/ipc-server.c
parent5fd36164a008f931def993413facf9058c56641d (diff)
Add get_config message type to ipc
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 70a4141e..c5161a6b 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -17,6 +17,7 @@
#include <unistd.h>
#include <wayland-server.h>
#include "sway/commands.h"
+#include "sway/config.h"
#include "sway/ipc-json.h"
#include "sway/ipc-server.h"
#include "sway/output.h"
@@ -681,6 +682,17 @@ void ipc_client_handle_command(struct ipc_client *client) {
goto exit_cleanup;
}
+ case IPC_GET_CONFIG:
+ {
+ json_object *json = json_object_new_object();
+ json_object_object_add(json, "config", json_object_new_string(config->current_config));
+ const char *json_string = json_object_to_json_string(json);
+ client_valid =
+ ipc_send_reply(client, json_string, (uint32_t)strlen(json_string));
+ json_object_put(json); // free
+ goto exit_cleanup;
+ }
+
default:
wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command);
goto exit_cleanup;