diff options
author | Brian Ashworth <RedSoxFan@users.noreply.github.com> | 2018-05-12 12:43:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-12 12:43:34 -0400 |
commit | ec60e24f75f778b378206366057df4efae4b8630 (patch) | |
tree | a2b6ce2f6f28b294ae6cbb8cbf49b107138215f5 /sway/ipc-json.c | |
parent | e3625d8f337d61c5d2ba1266679b9053168cd0ae (diff) | |
parent | b1c33ecc256c58c7ecee28e2f4507dd374727d62 (diff) |
Merge branch 'master' into edge-borders
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r-- | sway/ipc-json.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index ea7fd9ad..ad37216f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -267,6 +267,31 @@ json_object *ipc_json_describe_input(struct sway_input_device *device) { return object; } +json_object *ipc_json_describe_seat(struct sway_seat *seat) { + if (!(sway_assert(seat, "Seat must not be null"))) { + return NULL; + } + + json_object *object = json_object_new_object(); + struct sway_container *focus = seat_get_focus(seat); + + json_object_object_add(object, "name", + json_object_new_string(seat->wlr_seat->name)); + json_object_object_add(object, "capabilities", + json_object_new_int(seat->wlr_seat->capabilities)); + json_object_object_add(object, "focus", + json_object_new_int(focus ? focus->id : 0)); + + json_object *devices = json_object_new_array(); + struct sway_seat_device *device = NULL; + wl_list_for_each(device, &seat->devices, link) { + json_object_array_add(devices, ipc_json_describe_input(device->input_device)); + } + json_object_object_add(object, "devices", devices); + + return object; +} + json_object *ipc_json_describe_bar_config(struct bar_config *bar) { if (!sway_assert(bar, "Bar must not be NULL")) { return NULL; |