aboutsummaryrefslogtreecommitdiffstats
path: root/swaymsg
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <RyanDwyer@users.noreply.github.com>2018-07-10 22:05:33 +1000
committerLibravatar GitHub <noreply@github.com>2018-07-10 22:05:33 +1000
commit8afe68f92063ff6db061f721868f601b2fc20191 (patch)
tree751b5569e4e05149c7a7cd7e0d8084be5ff62063 /swaymsg
parentMerge pull request #2236 from kupospelov/fix-stacked-layout (diff)
parentAdd get_config message type to ipc (diff)
downloadsway-8afe68f92063ff6db061f721868f601b2fc20191.tar.gz
sway-8afe68f92063ff6db061f721868f601b2fc20191.tar.zst
sway-8afe68f92063ff6db061f721868f601b2fc20191.zip
Merge pull request #2232 from ianyfan/ipc
Add some missing ipc message types from i3
Diffstat (limited to 'swaymsg')
-rw-r--r--swaymsg/main.c17
-rw-r--r--swaymsg/swaymsg.1.scd6
2 files changed, 22 insertions, 1 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c
index 542ca819..4c068f69 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -240,6 +240,12 @@ static void pretty_print_version(json_object *v) {
240 printf("sway version %s\n", json_object_get_string(ver)); 240 printf("sway version %s\n", json_object_get_string(ver));
241} 241}
242 242
243static void pretty_print_config(json_object *c) {
244 json_object *config;
245 json_object_object_get_ex(c, "config", &config);
246 printf("%s\n", json_object_get_string(config));
247}
248
243static void pretty_print_clipboard(json_object *v) { 249static void pretty_print_clipboard(json_object *v) {
244 if (success(v, true)) { 250 if (success(v, true)) {
245 if (json_object_is_type(v, json_type_array)) { 251 if (json_object_is_type(v, json_type_array)) {
@@ -277,7 +283,7 @@ static void pretty_print(int type, json_object *resp) {
277 if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && 283 if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES &&
278 type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && 284 type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS &&
279 type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD && 285 type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD &&
280 type != IPC_GET_SEATS) { 286 type != IPC_GET_SEATS && type != IPC_GET_CONFIG) {
281 printf("%s\n", json_object_to_json_string_ext(resp, 287 printf("%s\n", json_object_to_json_string_ext(resp,
282 JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); 288 JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED));
283 return; 289 return;
@@ -288,6 +294,11 @@ static void pretty_print(int type, json_object *resp) {
288 return; 294 return;
289 } 295 }
290 296
297 if (type == IPC_GET_CONFIG) {
298 pretty_print_config(resp);
299 return;
300 }
301
291 if (type == IPC_GET_CLIPBOARD) { 302 if (type == IPC_GET_CLIPBOARD) {
292 pretty_print_clipboard(resp); 303 pretty_print_clipboard(resp);
293 return; 304 return;
@@ -407,6 +418,10 @@ int main(int argc, char **argv) {
407 type = IPC_GET_BAR_CONFIG; 418 type = IPC_GET_BAR_CONFIG;
408 } else if (strcasecmp(cmdtype, "get_version") == 0) { 419 } else if (strcasecmp(cmdtype, "get_version") == 0) {
409 type = IPC_GET_VERSION; 420 type = IPC_GET_VERSION;
421 } else if (strcasecmp(cmdtype, "get_binding_modes") == 0) {
422 type = IPC_GET_BINDING_MODES;
423 } else if (strcasecmp(cmdtype, "get_config") == 0) {
424 type = IPC_GET_CONFIG;
410 } else if (strcasecmp(cmdtype, "get_clipboard") == 0) { 425 } else if (strcasecmp(cmdtype, "get_clipboard") == 0) {
411 type = IPC_GET_CLIPBOARD; 426 type = IPC_GET_CLIPBOARD;
412 } else { 427 } else {
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd
index 1aa6a1b0..59a706d4 100644
--- a/swaymsg/swaymsg.1.scd
+++ b/swaymsg/swaymsg.1.scd
@@ -59,6 +59,12 @@ _swaymsg_ [options...] [message]
59*get\_version* 59*get\_version*
60 Get JSON-encoded version information for the running instance of sway. 60 Get JSON-encoded version information for the running instance of sway.
61 61
62*get\_binding\_modes*
63 Gets a JSON-encoded list of currently configured binding modes.
64
65*get\_config*
66 Gets a JSON-encoded copy of the current configuration.
67
62*get\_clipboard* 68*get\_clipboard*
63 Get JSON-encoded information about the clipboard. 69 Get JSON-encoded information about the clipboard.
64 Returns the current clipboard mime-types if called without 70 Returns the current clipboard mime-types if called without