mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21:28 +00:00
Add get_binding_modes message type to ipc
This commit is contained in:
parent
c1bb73f865
commit
5fd36164a0
|
@ -13,6 +13,7 @@ enum ipc_command_type {
|
||||||
IPC_GET_MARKS = 5,
|
IPC_GET_MARKS = 5,
|
||||||
IPC_GET_BAR_CONFIG = 6,
|
IPC_GET_BAR_CONFIG = 6,
|
||||||
IPC_GET_VERSION = 7,
|
IPC_GET_VERSION = 7,
|
||||||
|
IPC_GET_BINDING_MODES = 8,
|
||||||
|
|
||||||
// sway-specific command types
|
// sway-specific command types
|
||||||
IPC_GET_INPUTS = 100,
|
IPC_GET_INPUTS = 100,
|
||||||
|
|
|
@ -667,6 +667,20 @@ void ipc_client_handle_command(struct ipc_client *client) {
|
||||||
goto exit_cleanup;
|
goto exit_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IPC_GET_BINDING_MODES:
|
||||||
|
{
|
||||||
|
json_object *modes = json_object_new_array();
|
||||||
|
for (int i = 0; i < config->modes->length; i++) {
|
||||||
|
struct sway_mode *mode = config->modes->items[i];
|
||||||
|
json_object_array_add(modes, json_object_new_string(mode->name));
|
||||||
|
}
|
||||||
|
const char *json_string = json_object_to_json_string(modes);
|
||||||
|
client_valid =
|
||||||
|
ipc_send_reply(client, json_string, (uint32_t)strlen(json_string));
|
||||||
|
json_object_put(modes); // free
|
||||||
|
goto exit_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command);
|
wlr_log(WLR_INFO, "Unknown IPC command type %i", client->current_command);
|
||||||
goto exit_cleanup;
|
goto exit_cleanup;
|
||||||
|
|
|
@ -407,6 +407,8 @@ int main(int argc, char **argv) {
|
||||||
type = IPC_GET_BAR_CONFIG;
|
type = IPC_GET_BAR_CONFIG;
|
||||||
} else if (strcasecmp(cmdtype, "get_version") == 0) {
|
} else if (strcasecmp(cmdtype, "get_version") == 0) {
|
||||||
type = IPC_GET_VERSION;
|
type = IPC_GET_VERSION;
|
||||||
|
} else if (strcasecmp(cmdtype, "get_binding_modes") == 0) {
|
||||||
|
type = IPC_GET_BINDING_MODES;
|
||||||
} else if (strcasecmp(cmdtype, "get_clipboard") == 0) {
|
} else if (strcasecmp(cmdtype, "get_clipboard") == 0) {
|
||||||
type = IPC_GET_CLIPBOARD;
|
type = IPC_GET_CLIPBOARD;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,6 +59,9 @@ _swaymsg_ [options...] [message]
|
||||||
*get\_version*
|
*get\_version*
|
||||||
Get JSON-encoded version information for the running instance of sway.
|
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\_clipboard*
|
*get\_clipboard*
|
||||||
Get JSON-encoded information about the clipboard.
|
Get JSON-encoded information about the clipboard.
|
||||||
Returns the current clipboard mime-types if called without
|
Returns the current clipboard mime-types if called without
|
||||||
|
|
Loading…
Reference in a new issue