aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-26 17:40:38 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-02-26 19:07:59 -0500
commitad879c99e0f41b1003b764cb0fc8512319b0f517 (patch)
tree68aedf3e2e0e5c0c274d469d429f6a94683c46a9 /sway/ipc-json.c
parentFix wlr_render_with_matrix call (diff)
downloadsway-ad879c99e0f41b1003b764cb0fc8512319b0f517.tar.gz
sway-ad879c99e0f41b1003b764cb0fc8512319b0f517.tar.zst
sway-ad879c99e0f41b1003b764cb0fc8512319b0f517.zip
ipc show focused container
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index f0afdc9f..213c8fb6 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -5,6 +5,8 @@
5#include "sway/ipc-json.h" 5#include "sway/ipc-json.h"
6#include "sway/container.h" 6#include "sway/container.h"
7#include "sway/output.h" 7#include "sway/output.h"
8#include "sway/input/input-manager.h"
9#include "sway/input/seat.h"
8#include <wlr/types/wlr_box.h> 10#include <wlr/types/wlr_box.h>
9#include <wlr/types/wlr_output.h> 11#include <wlr/types/wlr_output.h>
10 12
@@ -95,11 +97,15 @@ json_object *ipc_json_describe_container(swayc_t *c) {
95 return NULL; 97 return NULL;
96 } 98 }
97 99
100 struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager);
101 bool focused = sway_seat_get_focus(seat) == c;
102
98 json_object *object = json_object_new_object(); 103 json_object *object = json_object_new_object();
99 104
100 json_object_object_add(object, "id", json_object_new_int((int)c->id)); 105 json_object_object_add(object, "id", json_object_new_int((int)c->id));
101 json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL); 106 json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL);
102 json_object_object_add(object, "rect", ipc_json_create_rect(c)); 107 json_object_object_add(object, "rect", ipc_json_create_rect(c));
108 json_object_object_add(object, "focused", json_object_new_boolean(focused));
103 109
104 switch (c->type) { 110 switch (c->type) {
105 case C_ROOT: 111 case C_ROOT: