mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
ipc show focused container
This commit is contained in:
parent
4b781356a4
commit
ad879c99e0
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
||||||
#include "sway/ipc-json.h"
|
#include "sway/ipc-json.h"
|
||||||
#include "sway/container.h"
|
#include "sway/container.h"
|
||||||
#include "sway/output.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_box.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
|
||||||
|
@ -95,11 +97,15 @@ json_object *ipc_json_describe_container(swayc_t *c) {
|
||||||
return NULL;
|
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 = json_object_new_object();
|
||||||
|
|
||||||
json_object_object_add(object, "id", json_object_new_int((int)c->id));
|
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, "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, "rect", ipc_json_create_rect(c));
|
||||||
|
json_object_object_add(object, "focused", json_object_new_boolean(focused));
|
||||||
|
|
||||||
switch (c->type) {
|
switch (c->type) {
|
||||||
case C_ROOT:
|
case C_ROOT:
|
||||||
|
|
Loading…
Reference in a new issue