diff options
-rw-r--r-- | include/ipc.h | 1 | ||||
-rw-r--r-- | sway/ipc-server.c | 14 | ||||
-rw-r--r-- | swaymsg/main.c | 2 | ||||
-rw-r--r-- | swaymsg/swaymsg.1.scd | 3 |
4 files changed, 20 insertions, 0 deletions
diff --git a/include/ipc.h b/include/ipc.h index 8172c782..c9c5b1cd 100644 --- a/include/ipc.h +++ b/include/ipc.h | |||
@@ -13,6 +13,7 @@ enum ipc_command_type { | |||
13 | IPC_GET_MARKS = 5, | 13 | IPC_GET_MARKS = 5, |
14 | IPC_GET_BAR_CONFIG = 6, | 14 | IPC_GET_BAR_CONFIG = 6, |
15 | IPC_GET_VERSION = 7, | 15 | IPC_GET_VERSION = 7, |
16 | IPC_GET_BINDING_MODES = 8, | ||
16 | 17 | ||
17 | // sway-specific command types | 18 | // sway-specific command types |
18 | IPC_GET_INPUTS = 100, | 19 | IPC_GET_INPUTS = 100, |
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 197851cf..70a4141e 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -667,6 +667,20 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
667 | goto exit_cleanup; | 667 | goto exit_cleanup; |
668 | } | 668 | } |
669 | 669 | ||
670 | case IPC_GET_BINDING_MODES: | ||
671 | { | ||
672 | json_object *modes = json_object_new_array(); | ||
673 | for (int i = 0; i < config->modes->length; i++) { | ||
674 | struct sway_mode *mode = config->modes->items[i]; | ||
675 | json_object_array_add(modes, json_object_new_string(mode->name)); | ||
676 | } | ||
677 | const char *json_string = json_object_to_json_string(modes); | ||
678 | client_valid = | ||
679 | ipc_send_reply(client, json_string, (uint32_t)strlen(json_string)); | ||
680 | json_object_put(modes); // free | ||
681 | goto exit_cleanup; | ||
682 | } | ||
683 | |||
670 | default: | 684 | default: |
671 | wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command); | 685 | wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command); |
672 | goto exit_cleanup; | 686 | goto exit_cleanup; |
diff --git a/swaymsg/main.c b/swaymsg/main.c index 542ca819..42e488f3 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -407,6 +407,8 @@ int main(int argc, char **argv) { | |||
407 | type = IPC_GET_BAR_CONFIG; | 407 | type = IPC_GET_BAR_CONFIG; |
408 | } else if (strcasecmp(cmdtype, "get_version") == 0) { | 408 | } else if (strcasecmp(cmdtype, "get_version") == 0) { |
409 | type = IPC_GET_VERSION; | 409 | type = IPC_GET_VERSION; |
410 | } else if (strcasecmp(cmdtype, "get_binding_modes") == 0) { | ||
411 | type = IPC_GET_BINDING_MODES; | ||
410 | } else if (strcasecmp(cmdtype, "get_clipboard") == 0) { | 412 | } else if (strcasecmp(cmdtype, "get_clipboard") == 0) { |
411 | type = IPC_GET_CLIPBOARD; | 413 | type = IPC_GET_CLIPBOARD; |
412 | } else { | 414 | } else { |
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd index 1aa6a1b0..f9b600b9 100644 --- a/swaymsg/swaymsg.1.scd +++ b/swaymsg/swaymsg.1.scd | |||
@@ -59,6 +59,9 @@ _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 | |||
62 | *get\_clipboard* | 65 | *get\_clipboard* |
63 | Get JSON-encoded information about the clipboard. | 66 | Get JSON-encoded information about the clipboard. |
64 | Returns the current clipboard mime-types if called without | 67 | Returns the current clipboard mime-types if called without |