summaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-03 22:00:59 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-03 22:16:36 +0100
commitaa2f754c64605676c9f3586ebf18f667e787c06a (patch)
tree3cd19b37cfe852fa9e2b2f7104fc0c92c4ccdec1 /sway/ipc-server.c
parentMerge pull request #427 from mikkeloscar/ipc-update (diff)
downloadsway-aa2f754c64605676c9f3586ebf18f667e787c06a.tar.gz
sway-aa2f754c64605676c9f3586ebf18f667e787c06a.tar.zst
sway-aa2f754c64605676c9f3586ebf18f667e787c06a.zip
swaybar: Implement binding_mode_indicator
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 2bb25202..ed3977d5 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -293,6 +293,8 @@ void ipc_client_handle_command(struct ipc_client *client) {
293 client->subscribed_events |= IPC_EVENT_WORKSPACE; 293 client->subscribed_events |= IPC_EVENT_WORKSPACE;
294 } else if (strcmp(event_type, "barconfig_update") == 0) { 294 } else if (strcmp(event_type, "barconfig_update") == 0) {
295 client->subscribed_events |= IPC_EVENT_BARCONFIG_UPDATE; 295 client->subscribed_events |= IPC_EVENT_BARCONFIG_UPDATE;
296 } else if (strcmp(event_type, "mode") == 0) {
297 client->subscribed_events |= IPC_EVENT_MODE;
296 } else { 298 } else {
297 ipc_send_reply(client, "{\"success\": false}", 18); 299 ipc_send_reply(client, "{\"success\": false}", 18);
298 ipc_client_disconnect(client); 300 ipc_client_disconnect(client);
@@ -605,3 +607,13 @@ void ipc_event_barconfig_update(struct bar_config *bar) {
605 607
606 json_object_put(json); // free 608 json_object_put(json); // free
607} 609}
610
611void ipc_event_mode(const char *mode) {
612 json_object *obj = json_object_new_object();
613 json_object_object_add(obj, "change", json_object_new_string(mode));
614
615 const char *json_string = json_object_to_json_string(obj);
616 ipc_send_event(json_string, IPC_EVENT_MODE);
617
618 json_object_put(obj); // free
619}