aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-09-28 10:14:02 +0200
committerSimon Ser <contact@emersion.fr>2022-10-03 13:35:52 +0200
commit78b5c0a77e64b88847d079aade5eae5cc754775c (patch)
treebee99d442bdf9bdbbb9db149861b1029197d13c3
parentf70d1e1b959d218378cb786bcaeb44ea9ed05aa2 (diff)
swaymsg: show mode picture aspect ratio
-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) {
for (size_t i = 0; i < modes_len; ++i) {
json_object *mode = json_object_array_get_idx(modes, i);
- json_object *mode_width, *mode_height, *mode_refresh;
+ json_object *mode_width, *mode_height, *mode_refresh,
+ *mode_picture_aspect_ratio;
json_object_object_get_ex(mode, "width", &mode_width);
json_object_object_get_ex(mode, "height", &mode_height);
json_object_object_get_ex(mode, "refresh", &mode_refresh);
+ json_object_object_get_ex(mode, "picture_aspect_ratio",
+ &mode_picture_aspect_ratio);
- printf(" %dx%d @ %.3f Hz\n", json_object_get_int(mode_width),
+ printf(" %dx%d @ %.3f Hz", json_object_get_int(mode_width),
json_object_get_int(mode_height),
(double)json_object_get_int(mode_refresh) / 1000);
+ if (mode_picture_aspect_ratio &&
+ strcmp("none", json_object_get_string(mode_picture_aspect_ratio)) != 0) {
+ printf(" (%s)", json_object_get_string(mode_picture_aspect_ratio));
+ }
+ printf("\n");
}
}