diff options
author | 2018-05-11 23:51:47 +1000 | |
---|---|---|
committer | 2018-05-12 18:17:36 +1000 | |
commit | c72940837c24b5df99c95667befe2e4e5c64575a (patch) | |
tree | eae77f45803c33f0825ee134956b9dac292a52b1 /sway/ipc-json.c | |
parent | Merge pull request #1952 from Dudemanguy911/fix-crash-on-fullscreen (diff) | |
download | sway-c72940837c24b5df99c95667befe2e4e5c64575a.tar.gz sway-c72940837c24b5df99c95667befe2e4e5c64575a.tar.zst sway-c72940837c24b5df99c95667befe2e4e5c64575a.zip |
Implement IPC get_seats command
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) { | |||
267 | return object; | 267 | return object; |
268 | } | 268 | } |
269 | 269 | ||
270 | json_object *ipc_json_describe_seat(struct sway_seat *seat) { | ||
271 | if (!(sway_assert(seat, "Seat must not be null"))) { | ||
272 | return NULL; | ||
273 | } | ||
274 | |||
275 | json_object *object = json_object_new_object(); | ||
276 | struct sway_container *focus = seat_get_focus(seat); | ||
277 | |||
278 | json_object_object_add(object, "name", | ||
279 | json_object_new_string(seat->wlr_seat->name)); | ||
280 | json_object_object_add(object, "capabilities", | ||
281 | json_object_new_int(seat->wlr_seat->capabilities)); | ||
282 | json_object_object_add(object, "focus", | ||
283 | json_object_new_int(focus ? focus->id : 0)); | ||
284 | |||
285 | json_object *devices = json_object_new_array(); | ||
286 | struct sway_seat_device *device = NULL; | ||
287 | wl_list_for_each(device, &seat->devices, link) { | ||
288 | json_object_array_add(devices, ipc_json_describe_input(device->input_device)); | ||
289 | } | ||
290 | json_object_object_add(object, "devices", devices); | ||
291 | |||
292 | return object; | ||
293 | } | ||
294 | |||
270 | json_object *ipc_json_describe_bar_config(struct bar_config *bar) { | 295 | json_object *ipc_json_describe_bar_config(struct bar_config *bar) { |
271 | if (!sway_assert(bar, "Bar must not be NULL")) { | 296 | if (!sway_assert(bar, "Bar must not be NULL")) { |
272 | return NULL; | 297 | return NULL; |