diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-26 17:40:38 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-02-26 19:07:59 -0500 |
commit | ad879c99e0f41b1003b764cb0fc8512319b0f517 (patch) | |
tree | 68aedf3e2e0e5c0c274d469d429f6a94683c46a9 /sway | |
parent | 4b781356a4501ea6fc648f3d3a4abcd061bf51cd (diff) |
ipc show focused container
Diffstat (limited to 'sway')
-rw-r--r-- | sway/ipc-json.c | 6 |
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 @@ #include "sway/ipc-json.h" #include "sway/container.h" #include "sway/output.h" +#include "sway/input/input-manager.h" +#include "sway/input/seat.h" #include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output.h> @@ -95,11 +97,15 @@ json_object *ipc_json_describe_container(swayc_t *c) { return NULL; } + struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); + bool focused = sway_seat_get_focus(seat) == c; + json_object *object = json_object_new_object(); json_object_object_add(object, "id", json_object_new_int((int)c->id)); json_object_object_add(object, "name", (c->name) ? json_object_new_string(c->name) : NULL); json_object_object_add(object, "rect", ipc_json_create_rect(c)); + json_object_object_add(object, "focused", json_object_new_boolean(focused)); switch (c->type) { case C_ROOT: |