diff options
author | emersion <contact@emersion.fr> | 2017-12-29 11:16:57 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-12-29 11:16:57 +0100 |
commit | fff67906e189e3d64860557db99b5af49d848315 (patch) | |
tree | bfebfbe7f4d4f225194792ba39798b4caed2ba6f /swaymsg/main.c | |
parent | Merge pull request #1540 from emersion/output-command-refactor (diff) | |
download | sway-fff67906e189e3d64860557db99b5af49d848315.tar.gz sway-fff67906e189e3d64860557db99b5af49d848315.tar.zst sway-fff67906e189e3d64860557db99b5af49d848315.zip |
Pretty-print all output info in swaymsg -t get_outputs
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r-- | swaymsg/main.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index b431872a..8a720fca 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -107,29 +107,42 @@ static void pretty_print_input(json_object *i) { | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static void pretty_print_output(json_object *o) { | 109 | static void pretty_print_output(json_object *o) { |
110 | json_object *name, *rect, *focused, *active, *ws, *scale; | 110 | json_object *name, *rect, *focused, *active, *ws; |
111 | json_object_object_get_ex(o, "name", &name); | 111 | json_object_object_get_ex(o, "name", &name); |
112 | json_object_object_get_ex(o, "rect", &rect); | 112 | json_object_object_get_ex(o, "rect", &rect); |
113 | json_object_object_get_ex(o, "focused", &focused); | 113 | json_object_object_get_ex(o, "focused", &focused); |
114 | json_object_object_get_ex(o, "active", &active); | 114 | json_object_object_get_ex(o, "active", &active); |
115 | json_object_object_get_ex(o, "current_workspace", &ws); | 115 | json_object_object_get_ex(o, "current_workspace", &ws); |
116 | json_object *make, *model, *serial, *scale, *refresh, *transform; | ||
117 | json_object_object_get_ex(o, "make", &make); | ||
118 | json_object_object_get_ex(o, "model", &model); | ||
119 | json_object_object_get_ex(o, "serial", &serial); | ||
116 | json_object_object_get_ex(o, "scale", &scale); | 120 | json_object_object_get_ex(o, "scale", &scale); |
121 | json_object_object_get_ex(o, "refresh", &refresh); | ||
122 | json_object_object_get_ex(o, "transform", &transform); | ||
117 | json_object *x, *y, *width, *height; | 123 | json_object *x, *y, *width, *height; |
118 | json_object_object_get_ex(rect, "x", &x); | 124 | json_object_object_get_ex(rect, "x", &x); |
119 | json_object_object_get_ex(rect, "y", &y); | 125 | json_object_object_get_ex(rect, "y", &y); |
120 | json_object_object_get_ex(rect, "width", &width); | 126 | json_object_object_get_ex(rect, "width", &width); |
121 | json_object_object_get_ex(rect, "height", &height); | 127 | json_object_object_get_ex(rect, "height", &height); |
122 | printf( | 128 | printf( |
123 | "Output %s%s%s\n" | 129 | "Output %s '%s %s %s'%s%s\n" |
124 | " Geometry: %dx%d @ %d,%d\n" | 130 | " Mode: %dx%d @ %f Hz\n" |
131 | " Position: %d,%d\n" | ||
125 | " Scale factor: %dx\n" | 132 | " Scale factor: %dx\n" |
133 | " Transform: %s\n" | ||
126 | " Workspace: %s\n\n", | 134 | " Workspace: %s\n\n", |
127 | json_object_get_string(name), | 135 | json_object_get_string(name), |
136 | json_object_get_string(make), | ||
137 | json_object_get_string(model), | ||
138 | json_object_get_string(serial), | ||
128 | json_object_get_boolean(focused) ? " (focused)" : "", | 139 | json_object_get_boolean(focused) ? " (focused)" : "", |
129 | !json_object_get_boolean(active) ? " (inactive)" : "", | 140 | !json_object_get_boolean(active) ? " (inactive)" : "", |
130 | json_object_get_int(width), json_object_get_int(height), | 141 | json_object_get_int(width), json_object_get_int(height), |
142 | (float)json_object_get_int(refresh) / 1000, | ||
131 | json_object_get_int(x), json_object_get_int(y), | 143 | json_object_get_int(x), json_object_get_int(y), |
132 | json_object_get_int(scale), | 144 | json_object_get_int(scale), |
145 | json_object_get_string(transform), | ||
133 | json_object_get_string(ws) | 146 | json_object_get_string(ws) |
134 | ); | 147 | ); |
135 | } | 148 | } |