diff options
author | nyorain <nyorain@gmail.com> | 2017-07-11 18:04:24 +0200 |
---|---|---|
committer | nyorain <nyorain@gmail.com> | 2017-07-11 18:04:28 +0200 |
commit | 1cca551c6fc69bca76a4992b33ef685371cac26b (patch) | |
tree | a81f5598adbfbb53be0b99bdbbf6a224c17145c4 /swaymsg/main.c | |
parent | Close fd in clipboard request (diff) | |
download | sway-1cca551c6fc69bca76a4992b33ef685371cac26b.tar.gz sway-1cca551c6fc69bca76a4992b33ef685371cac26b.tar.zst sway-1cca551c6fc69bca76a4992b33ef685371cac26b.zip |
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.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 | ||