diff options
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r-- | swaymsg/main.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 450df673..2f9cfb14 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -160,10 +160,22 @@ static void pretty_print_clipboard(json_object *v) { | |||
160 | struct json_object_iterator iter = json_object_iter_begin(v); | 160 | struct json_object_iterator iter = json_object_iter_begin(v); |
161 | struct json_object_iterator end = json_object_iter_end(v); | 161 | struct json_object_iterator end = json_object_iter_end(v); |
162 | if (!json_object_iter_equal(&iter, &end)) { | 162 | if (!json_object_iter_equal(&iter, &end)) { |
163 | printf("%s\n", json_object_get_string( | 163 | json_object *obj = json_object_iter_peek_value(&iter); |
164 | json_object_iter_peek_value(&iter))); | 164 | if (success(obj, false)) { |
165 | json_object *content; | ||
166 | json_object_object_get_ex(obj, "content", &content); | ||
167 | printf("%s\n", json_object_get_string(content)); | ||
168 | } else { | ||
169 | json_object *error; | ||
170 | json_object_object_get_ex(obj, "error", &error); | ||
171 | printf("Error: %s\n", json_object_get_string(error)); | ||
172 | } | ||
165 | } | 173 | } |
166 | } | 174 | } |
175 | } else { | ||
176 | json_object *error; | ||
177 | json_object_object_get_ex(v, "error", &error); | ||
178 | printf("Error: %s\n", json_object_get_string(error)); | ||
167 | } | 179 | } |
168 | } | 180 | } |
169 | 181 | ||