aboutsummaryrefslogtreecommitdiff
path: root/swaymsg/main.c
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-07-11 18:04:24 +0200
committernyorain <nyorain@gmail.com>2017-07-11 18:04:28 +0200
commit1cca551c6fc69bca76a4992b33ef685371cac26b (patch)
treea81f5598adbfbb53be0b99bdbbf6a224c17145c4 /swaymsg/main.c
parent20888fbb5e19e2bd7e45afb6fdbc2c1ed8cc769d (diff)
Add get_clipbard ipc errors; Adapt swaymsg
Also increase the get_clipboard timeout to 30 secs
Diffstat (limited to 'swaymsg/main.c')
-rw-r--r--swaymsg/main.c16
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) {
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));
}
}