diff options
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index b459b5ce..e161c756 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -562,15 +562,23 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { | |||
562 | return json; | 562 | return json; |
563 | } | 563 | } |
564 | 564 | ||
565 | void ipc_event_workspace(swayc_t *old, swayc_t *new) { | 565 | void ipc_event_workspace(swayc_t *old, swayc_t *new, const char *change) { |
566 | json_object *obj = json_object_new_object(); | 566 | json_object *obj = json_object_new_object(); |
567 | json_object_object_add(obj, "change", json_object_new_string("focus")); | 567 | json_object_object_add(obj, "change", json_object_new_string(change)); |
568 | if (old) { | 568 | if (strcmp("focus", change) == 0) { |
569 | json_object_object_add(obj, "old", ipc_json_describe_workspace(old)); | 569 | if (old) { |
570 | json_object_object_add(obj, "old", ipc_json_describe_workspace(old)); | ||
571 | } else { | ||
572 | json_object_object_add(obj, "old", NULL); | ||
573 | } | ||
574 | } | ||
575 | |||
576 | if (new) { | ||
577 | json_object_object_add(obj, "current", ipc_json_describe_workspace(new)); | ||
570 | } else { | 578 | } else { |
571 | json_object_object_add(obj, "old", NULL); | 579 | json_object_object_add(obj, "current", NULL); |
572 | } | 580 | } |
573 | json_object_object_add(obj, "current", ipc_json_describe_workspace(new)); | 581 | |
574 | const char *json_string = json_object_to_json_string(obj); | 582 | const char *json_string = json_object_to_json_string(obj); |
575 | 583 | ||
576 | for (int i = 0; i < ipc_client_list->length; i++) { | 584 | for (int i = 0; i < ipc_client_list->length; i++) { |