aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 197851cf..c5161a6b 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -17,6 +17,7 @@
17#include <unistd.h> 17#include <unistd.h>
18#include <wayland-server.h> 18#include <wayland-server.h>
19#include "sway/commands.h" 19#include "sway/commands.h"
20#include "sway/config.h"
20#include "sway/ipc-json.h" 21#include "sway/ipc-json.h"
21#include "sway/ipc-server.h" 22#include "sway/ipc-server.h"
22#include "sway/output.h" 23#include "sway/output.h"
@@ -667,6 +668,31 @@ void ipc_client_handle_command(struct ipc_client *client) {
667 goto exit_cleanup; 668 goto exit_cleanup;
668 } 669 }
669 670
671 case IPC_GET_BINDING_MODES:
672 {
673 json_object *modes = json_object_new_array();
674 for (int i = 0; i < config->modes->length; i++) {
675 struct sway_mode *mode = config->modes->items[i];
676 json_object_array_add(modes, json_object_new_string(mode->name));
677 }
678 const char *json_string = json_object_to_json_string(modes);
679 client_valid =
680 ipc_send_reply(client, json_string, (uint32_t)strlen(json_string));
681 json_object_put(modes); // free
682 goto exit_cleanup;
683 }
684
685 case IPC_GET_CONFIG:
686 {
687 json_object *json = json_object_new_object();
688 json_object_object_add(json, "config", json_object_new_string(config->current_config));
689 const char *json_string = json_object_to_json_string(json);
690 client_valid =
691 ipc_send_reply(client, json_string, (uint32_t)strlen(json_string));
692 json_object_put(json); // free
693 goto exit_cleanup;
694 }
695
670 default: 696 default:
671 wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command); 697 wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command);
672 goto exit_cleanup; 698 goto exit_cleanup;