aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-03-12 13:48:42 +0100
committeremersion <contact@emersion.fr>2018-03-12 13:48:42 +0100
commit4ab55060644a9c7f01e8f257b7dd34067adfaaf8 (patch)
tree837339ed8929c7c21630b3f4b49d53a0482b5a97 /sway
parent3035db74df147aa5fe7252a626c8c767e5e30631 (diff)
ipc: add output modes
Diffstat (limited to 'sway')
-rw-r--r--sway/ipc-json.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 213c8fb6..977f1ecb 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -78,6 +78,20 @@ static void ipc_json_describe_output(swayc_t *container, json_object *object) {
json_object_new_string(ipc_json_get_output_transform(wlr_output->transform)));
// TODO WLR need to set "current_workspace" to the currently focused
// workspace in a way that makes sense with multiseat
+
+ json_object *modes_array = json_object_new_array();
+ struct wlr_output_mode *mode;
+ wl_list_for_each(mode, &wlr_output->modes, link) {
+ json_object *mode_object = json_object_new_object();
+ json_object_object_add(mode_object, "width",
+ json_object_new_int(mode->width));
+ json_object_object_add(mode_object, "height",
+ json_object_new_int(mode->height));
+ json_object_object_add(mode_object, "refresh",
+ json_object_new_int(mode->refresh));
+ json_object_array_add(modes_array, mode_object);
+ }
+ json_object_object_add(object, "modes", modes_array);
}
static void ipc_json_describe_workspace(swayc_t *workspace, json_object *object) {