diff options
Diffstat (limited to 'swaymsg')
-rw-r--r-- | swaymsg/main.c | 44 | ||||
-rw-r--r-- | swaymsg/swaymsg.1.scd | 6 |
2 files changed, 2 insertions, 48 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 4c068f69..c4141ca5 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -246,44 +246,11 @@ static void pretty_print_config(json_object *c) { | |||
246 | printf("%s\n", json_object_get_string(config)); | 246 | printf("%s\n", json_object_get_string(config)); |
247 | } | 247 | } |
248 | 248 | ||
249 | static void pretty_print_clipboard(json_object *v) { | ||
250 | if (success(v, true)) { | ||
251 | if (json_object_is_type(v, json_type_array)) { | ||
252 | for (size_t i = 0; i < json_object_array_length(v); ++i) { | ||
253 | json_object *o = json_object_array_get_idx(v, i); | ||
254 | printf("%s\n", json_object_get_string(o)); | ||
255 | } | ||
256 | } else { | ||
257 | // NOTE: could be extended to print all received types | ||
258 | // instead just the first one when sways ipc server | ||
259 | // supports it | ||
260 | struct json_object_iterator iter = json_object_iter_begin(v); | ||
261 | struct json_object_iterator end = json_object_iter_end(v); | ||
262 | if (!json_object_iter_equal(&iter, &end)) { | ||
263 | json_object *obj = json_object_iter_peek_value(&iter); | ||
264 | if (success(obj, false)) { | ||
265 | json_object *content; | ||
266 | json_object_object_get_ex(obj, "content", &content); | ||
267 | printf("%s\n", json_object_get_string(content)); | ||
268 | } else { | ||
269 | json_object *error; | ||
270 | json_object_object_get_ex(obj, "error", &error); | ||
271 | printf("Error: %s\n", json_object_get_string(error)); | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | } else { | ||
276 | json_object *error; | ||
277 | json_object_object_get_ex(v, "error", &error); | ||
278 | printf("Error: %s\n", json_object_get_string(error)); | ||
279 | } | ||
280 | } | ||
281 | |||
282 | static void pretty_print(int type, json_object *resp) { | 249 | static void pretty_print(int type, json_object *resp) { |
283 | if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && | 250 | if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && |
284 | type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && | 251 | type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && |
285 | type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD && | 252 | type != IPC_GET_VERSION && type != IPC_GET_SEATS && |
286 | type != IPC_GET_SEATS && type != IPC_GET_CONFIG) { | 253 | type != IPC_GET_CONFIG) { |
287 | printf("%s\n", json_object_to_json_string_ext(resp, | 254 | printf("%s\n", json_object_to_json_string_ext(resp, |
288 | JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); | 255 | JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); |
289 | return; | 256 | return; |
@@ -299,11 +266,6 @@ static void pretty_print(int type, json_object *resp) { | |||
299 | return; | 266 | return; |
300 | } | 267 | } |
301 | 268 | ||
302 | if (type == IPC_GET_CLIPBOARD) { | ||
303 | pretty_print_clipboard(resp); | ||
304 | return; | ||
305 | } | ||
306 | |||
307 | json_object *obj; | 269 | json_object *obj; |
308 | size_t len = json_object_array_length(resp); | 270 | size_t len = json_object_array_length(resp); |
309 | for (size_t i = 0; i < len; ++i) { | 271 | for (size_t i = 0; i < len; ++i) { |
@@ -422,8 +384,6 @@ int main(int argc, char **argv) { | |||
422 | type = IPC_GET_BINDING_MODES; | 384 | type = IPC_GET_BINDING_MODES; |
423 | } else if (strcasecmp(cmdtype, "get_config") == 0) { | 385 | } else if (strcasecmp(cmdtype, "get_config") == 0) { |
424 | type = IPC_GET_CONFIG; | 386 | type = IPC_GET_CONFIG; |
425 | } else if (strcasecmp(cmdtype, "get_clipboard") == 0) { | ||
426 | type = IPC_GET_CLIPBOARD; | ||
427 | } else { | 387 | } else { |
428 | sway_abort("Unknown message type %s", cmdtype); | 388 | sway_abort("Unknown message type %s", cmdtype); |
429 | } | 389 | } |
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd index 59a706d4..a6e279da 100644 --- a/swaymsg/swaymsg.1.scd +++ b/swaymsg/swaymsg.1.scd | |||
@@ -64,9 +64,3 @@ _swaymsg_ [options...] [message] | |||
64 | 64 | ||
65 | *get\_config* | 65 | *get\_config* |
66 | Gets a JSON-encoded copy of the current configuration. | 66 | Gets a JSON-encoded copy of the current configuration. |
67 | |||
68 | *get\_clipboard* | ||
69 | Get JSON-encoded information about the clipboard. | ||
70 | Returns the current clipboard mime-types if called without | ||
71 | arguments, otherwise returns the clipboard data in the requested | ||
72 | formats. Encodes the data using base64 for non-text mime types. | ||