diff options
Diffstat (limited to 'swaymsg')
-rw-r--r-- | swaymsg/main.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 88b14813..c9be3a86 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -125,13 +125,16 @@ static void pretty_print_output(json_object *o) { | |||
125 | json_object_object_get_ex(rect, "y", &y); | 125 | json_object_object_get_ex(rect, "y", &y); |
126 | json_object_object_get_ex(rect, "width", &width); | 126 | json_object_object_get_ex(rect, "width", &width); |
127 | json_object_object_get_ex(rect, "height", &height); | 127 | json_object_object_get_ex(rect, "height", &height); |
128 | json_object *modes; | ||
129 | json_object_object_get_ex(o, "modes", &modes); | ||
130 | |||
128 | printf( | 131 | printf( |
129 | "Output %s '%s %s %s'%s%s\n" | 132 | "Output %s '%s %s %s'%s%s\n" |
130 | " Mode: %dx%d @ %f Hz\n" | 133 | " Current mode: %dx%d @ %f Hz\n" |
131 | " Position: %d,%d\n" | 134 | " Position: %d,%d\n" |
132 | " Scale factor: %dx\n" | 135 | " Scale factor: %dx\n" |
133 | " Transform: %s\n" | 136 | " Transform: %s\n" |
134 | " Workspace: %s\n\n", | 137 | " Workspace: %s\n", |
135 | json_object_get_string(name), | 138 | json_object_get_string(name), |
136 | json_object_get_string(make), | 139 | json_object_get_string(make), |
137 | json_object_get_string(model), | 140 | json_object_get_string(model), |
@@ -145,6 +148,25 @@ static void pretty_print_output(json_object *o) { | |||
145 | json_object_get_string(transform), | 148 | json_object_get_string(transform), |
146 | json_object_get_string(ws) | 149 | json_object_get_string(ws) |
147 | ); | 150 | ); |
151 | |||
152 | size_t modes_len = json_object_array_length(modes); | ||
153 | if (modes_len > 0) { | ||
154 | printf(" Available modes:\n"); | ||
155 | for (size_t i = 0; i < modes_len; ++i) { | ||
156 | json_object *mode = json_object_array_get_idx(modes, i); | ||
157 | |||
158 | json_object *mode_width, *mode_height, *mode_refresh; | ||
159 | json_object_object_get_ex(mode, "width", &mode_width); | ||
160 | json_object_object_get_ex(mode, "height", &mode_height); | ||
161 | json_object_object_get_ex(mode, "refresh", &mode_refresh); | ||
162 | |||
163 | printf(" %dx%d @ %f Hz\n", json_object_get_int(mode_width), | ||
164 | json_object_get_int(mode_height), | ||
165 | (float)json_object_get_int(mode_refresh) / 1000); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | printf("\n"); | ||
148 | } | 170 | } |
149 | 171 | ||
150 | static void pretty_print_version(json_object *v) { | 172 | static void pretty_print_version(json_object *v) { |