aboutsummaryrefslogtreecommitdiffstats
path: root/swaymsg/main.c
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2022-09-28 10:14:02 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2022-10-03 13:35:52 +0200
commit78b5c0a77e64b88847d079aade5eae5cc754775c (patch)
treebee99d442bdf9bdbbb9db149861b1029197d13c3 /swaymsg/main.c
parentipc: expose mode picture aspect ratio (diff)
downloadsway-78b5c0a77e64b88847d079aade5eae5cc754775c.tar.gz
sway-78b5c0a77e64b88847d079aade5eae5cc754775c.tar.zst
sway-78b5c0a77e64b88847d079aade5eae5cc754775c.zip
swaymsg: show mode picture aspect ratio
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r--swaymsg/main.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c
index c4e2b0bf..c0b5809e 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -271,14 +271,22 @@ static void pretty_print_output(json_object *o) {
271 for (size_t i = 0; i < modes_len; ++i) { 271 for (size_t i = 0; i < modes_len; ++i) {
272 json_object *mode = json_object_array_get_idx(modes, i); 272 json_object *mode = json_object_array_get_idx(modes, i);
273 273
274 json_object *mode_width, *mode_height, *mode_refresh; 274 json_object *mode_width, *mode_height, *mode_refresh,
275 *mode_picture_aspect_ratio;
275 json_object_object_get_ex(mode, "width", &mode_width); 276 json_object_object_get_ex(mode, "width", &mode_width);
276 json_object_object_get_ex(mode, "height", &mode_height); 277 json_object_object_get_ex(mode, "height", &mode_height);
277 json_object_object_get_ex(mode, "refresh", &mode_refresh); 278 json_object_object_get_ex(mode, "refresh", &mode_refresh);
279 json_object_object_get_ex(mode, "picture_aspect_ratio",
280 &mode_picture_aspect_ratio);
278 281
279 printf(" %dx%d @ %.3f Hz\n", json_object_get_int(mode_width), 282 printf(" %dx%d @ %.3f Hz", json_object_get_int(mode_width),
280 json_object_get_int(mode_height), 283 json_object_get_int(mode_height),
281 (double)json_object_get_int(mode_refresh) / 1000); 284 (double)json_object_get_int(mode_refresh) / 1000);
285 if (mode_picture_aspect_ratio &&
286 strcmp("none", json_object_get_string(mode_picture_aspect_ratio)) != 0) {
287 printf(" (%s)", json_object_get_string(mode_picture_aspect_ratio));
288 }
289 printf("\n");
282 } 290 }
283 } 291 }
284 292