diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-07-10 22:05:33 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 22:05:33 +1000 |
commit | 8afe68f92063ff6db061f721868f601b2fc20191 (patch) | |
tree | 751b5569e4e05149c7a7cd7e0d8084be5ff62063 /swaymsg | |
parent | c1bb73f8652f367ee7b7b82f5fc13aff51145358 (diff) | |
parent | 23c1c26c3fedf5470dbee9fe97c2374a48588863 (diff) |
Merge pull request #2232 from ianyfan/ipc
Add some missing ipc message types from i3
Diffstat (limited to 'swaymsg')
-rw-r--r-- | swaymsg/main.c | 17 | ||||
-rw-r--r-- | swaymsg/swaymsg.1.scd | 6 |
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) { printf("sway version %s\n", json_object_get_string(ver)); } +static void pretty_print_config(json_object *c) { + json_object *config; + json_object_object_get_ex(c, "config", &config); + printf("%s\n", json_object_get_string(config)); +} + static void pretty_print_clipboard(json_object *v) { if (success(v, true)) { if (json_object_is_type(v, json_type_array)) { @@ -277,7 +283,7 @@ static void pretty_print(int type, json_object *resp) { if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD && - type != IPC_GET_SEATS) { + type != IPC_GET_SEATS && type != IPC_GET_CONFIG) { printf("%s\n", json_object_to_json_string_ext(resp, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); return; @@ -288,6 +294,11 @@ static void pretty_print(int type, json_object *resp) { return; } + if (type == IPC_GET_CONFIG) { + pretty_print_config(resp); + return; + } + if (type == IPC_GET_CLIPBOARD) { pretty_print_clipboard(resp); return; @@ -407,6 +418,10 @@ int main(int argc, char **argv) { type = IPC_GET_BAR_CONFIG; } else if (strcasecmp(cmdtype, "get_version") == 0) { type = IPC_GET_VERSION; + } else if (strcasecmp(cmdtype, "get_binding_modes") == 0) { + type = IPC_GET_BINDING_MODES; + } else if (strcasecmp(cmdtype, "get_config") == 0) { + type = IPC_GET_CONFIG; } else if (strcasecmp(cmdtype, "get_clipboard") == 0) { type = IPC_GET_CLIPBOARD; } 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] *get\_version* Get JSON-encoded version information for the running instance of sway. +*get\_binding\_modes* + Gets a JSON-encoded list of currently configured binding modes. + +*get\_config* + Gets a JSON-encoded copy of the current configuration. + *get\_clipboard* Get JSON-encoded information about the clipboard. Returns the current clipboard mime-types if called without |