diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-05 17:56:32 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-06-06 20:11:24 -0400 |
commit | a1b5b93d299bfe129f2b3409a7f642049fcce1d6 (patch) | |
tree | 4d87f5ab8f0f18ada1fc12a4eb4ba3b5d0350527 /swaymsg/main.c | |
parent | 22c1c4beb4baa369f883fb5360c40158513c8e10 (diff) |
Store sway_outputs so that they can be reenabled
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r-- | swaymsg/main.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 8a53474b..29f2a907 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c @@ -174,26 +174,35 @@ static void pretty_print_output(json_object *o) { json_object *modes; json_object_object_get_ex(o, "modes", &modes); - printf( - "Output %s '%s %s %s'%s%s\n" - " Current mode: %dx%d @ %f Hz\n" - " Position: %d,%d\n" - " Scale factor: %dx\n" - " Transform: %s\n" - " Workspace: %s\n", - json_object_get_string(name), - json_object_get_string(make), - json_object_get_string(model), - json_object_get_string(serial), - json_object_get_boolean(focused) ? " (focused)" : "", - !json_object_get_boolean(active) ? " (inactive)" : "", - json_object_get_int(width), json_object_get_int(height), - (float)json_object_get_int(refresh) / 1000, - json_object_get_int(x), json_object_get_int(y), - json_object_get_int(scale), - json_object_get_string(transform), - json_object_get_string(ws) - ); + if (json_object_get_boolean(active)) { + printf( + "Output %s '%s %s %s'%s\n" + " Current mode: %dx%d @ %f Hz\n" + " Position: %d,%d\n" + " Scale factor: %dx\n" + " Transform: %s\n" + " Workspace: %s\n", + json_object_get_string(name), + json_object_get_string(make), + json_object_get_string(model), + json_object_get_string(serial), + json_object_get_boolean(focused) ? " (focused)" : "", + json_object_get_int(width), json_object_get_int(height), + (float)json_object_get_int(refresh) / 1000, + json_object_get_int(x), json_object_get_int(y), + json_object_get_int(scale), + json_object_get_string(transform), + json_object_get_string(ws) + ); + } else { + printf( + "Output %s '%s %s %s' (inactive)", + json_object_get_string(name), + json_object_get_string(make), + json_object_get_string(model), + json_object_get_string(serial) + ); + } size_t modes_len = json_object_array_length(modes); if (modes_len > 0) { |