Introduced a new GET_BINDING_MODES message type and reply. (#2376)
This type dumps all currently configured binding modes. fixes #2375
This commit is contained in:
committed by
Michael Stapelberg
parent
63d0823016
commit
b1d70f25b3
25
src/ipc.c
25
src/ipc.c
@ -958,6 +958,28 @@ IPC_HANDLER(get_bar_config) {
|
||||
y(free);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a list of configured binding modes
|
||||
*
|
||||
*/
|
||||
IPC_HANDLER(get_binding_modes) {
|
||||
yajl_gen gen = ygenalloc();
|
||||
|
||||
y(array_open);
|
||||
struct Mode *mode;
|
||||
SLIST_FOREACH(mode, &modes, modes) {
|
||||
ystr(mode->name);
|
||||
}
|
||||
y(array_close);
|
||||
|
||||
const unsigned char *payload;
|
||||
ylength length;
|
||||
y(get_buf, &payload, &length);
|
||||
|
||||
ipc_send_message(fd, length, I3_IPC_REPLY_TYPE_BINDING_MODES, payload);
|
||||
y(free);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for the YAJL parser (will be called when a string is parsed).
|
||||
*
|
||||
@ -1034,7 +1056,7 @@ IPC_HANDLER(subscribe) {
|
||||
|
||||
/* The index of each callback function corresponds to the numeric
|
||||
* value of the message type (see include/i3/ipc.h) */
|
||||
handler_t handlers[8] = {
|
||||
handler_t handlers[9] = {
|
||||
handle_command,
|
||||
handle_get_workspaces,
|
||||
handle_subscribe,
|
||||
@ -1043,6 +1065,7 @@ handler_t handlers[8] = {
|
||||
handle_get_marks,
|
||||
handle_get_bar_config,
|
||||
handle_get_version,
|
||||
handle_get_binding_modes,
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user