aboutsummaryrefslogtreecommitdiffstats
path: root/swaymsg/main.c
diff options
context:
space:
mode:
authorLibravatar Alex Maese <memaese@hotmail.com>2022-06-09 19:17:14 -0500
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2022-09-19 07:26:45 -0400
commitcffb006feba52c318e66f73c3463032fa76782dc (patch)
treebfcc9e01653f6d1938f5fb37122589d52aec45e3 /swaymsg/main.c
parentsway: add non-desktop outputs to json when running `swaymsg -t get_outputs` (diff)
downloadsway-cffb006feba52c318e66f73c3463032fa76782dc.tar.gz
sway-cffb006feba52c318e66f73c3463032fa76782dc.tar.zst
sway-cffb006feba52c318e66f73c3463032fa76782dc.zip
swaymsg: show non-desktop property when pretty printing outputs
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r--swaymsg/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c
index c08406e2..c4e2b0bf 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -185,12 +185,13 @@ static void pretty_print_seat(json_object *i) {
185} 185}
186 186
187static void pretty_print_output(json_object *o) { 187static void pretty_print_output(json_object *o) {
188 json_object *name, *rect, *focused, *active, *ws, *current_mode; 188 json_object *name, *rect, *focused, *active, *ws, *current_mode, *non_desktop;
189 json_object_object_get_ex(o, "name", &name); 189 json_object_object_get_ex(o, "name", &name);
190 json_object_object_get_ex(o, "rect", &rect); 190 json_object_object_get_ex(o, "rect", &rect);
191 json_object_object_get_ex(o, "focused", &focused); 191 json_object_object_get_ex(o, "focused", &focused);
192 json_object_object_get_ex(o, "active", &active); 192 json_object_object_get_ex(o, "active", &active);
193 json_object_object_get_ex(o, "current_workspace", &ws); 193 json_object_object_get_ex(o, "current_workspace", &ws);
194 json_object_object_get_ex(o, "non_desktop", &non_desktop);
194 json_object *make, *model, *serial, *scale, *scale_filter, *subpixel, 195 json_object *make, *model, *serial, *scale, *scale_filter, *subpixel,
195 *transform, *max_render_time, *adaptive_sync_status; 196 *transform, *max_render_time, *adaptive_sync_status;
196 json_object_object_get_ex(o, "make", &make); 197 json_object_object_get_ex(o, "make", &make);
@@ -213,7 +214,15 @@ static void pretty_print_output(json_object *o) {
213 json_object_object_get_ex(current_mode, "height", &height); 214 json_object_object_get_ex(current_mode, "height", &height);
214 json_object_object_get_ex(current_mode, "refresh", &refresh); 215 json_object_object_get_ex(current_mode, "refresh", &refresh);
215 216
216 if (json_object_get_boolean(active)) { 217 if (json_object_get_boolean(non_desktop)) {
218 printf(
219 "Output %s '%s %s %s' (non-desktop)\n",
220 json_object_get_string(name),
221 json_object_get_string(make),
222 json_object_get_string(model),
223 json_object_get_string(serial)
224 );
225 } else if (json_object_get_boolean(active)) {
217 printf( 226 printf(
218 "Output %s '%s %s %s'%s\n" 227 "Output %s '%s %s %s'%s\n"
219 " Current mode: %dx%d @ %.3f Hz\n" 228 " Current mode: %dx%d @ %.3f Hz\n"