From 1cca551c6fc69bca76a4992b33ef685371cac26b Mon Sep 17 00:00:00 2001 From: nyorain Date: Tue, 11 Jul 2017 18:04:24 +0200 Subject: Add get_clipbard ipc errors; Adapt swaymsg Also increase the get_clipboard timeout to 30 secs --- swaymsg/main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'swaymsg') 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) { struct json_object_iterator iter = json_object_iter_begin(v); struct json_object_iterator end = json_object_iter_end(v); if (!json_object_iter_equal(&iter, &end)) { - printf("%s\n", json_object_get_string( - json_object_iter_peek_value(&iter))); + json_object *obj = json_object_iter_peek_value(&iter); + if (success(obj, false)) { + json_object *content; + json_object_object_get_ex(obj, "content", &content); + printf("%s\n", json_object_get_string(content)); + } else { + json_object *error; + json_object_object_get_ex(obj, "error", &error); + printf("Error: %s\n", json_object_get_string(error)); + } } } + } else { + json_object *error; + json_object_object_get_ex(v, "error", &error); + printf("Error: %s\n", json_object_get_string(error)); } } -- cgit v1.2.3-54-g00ecf