-#undef I3__FILE__
-#define I3__FILE__ "ipc.c"
/*
* vim:ts=4:sw=4:expandtab
*
*
*/
#include "all.h"
+
#include "yajl_utils.h"
+#include <stdint.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) {
y(map_open);
ystr("id");
- y(integer, (long int)con);
+ y(integer, (uintptr_t)con);
ystr("type");
switch (con->type) {
ystr("focus");
y(array_open);
TAILQ_FOREACH(node, &(con->focus_head), focused) {
- y(integer, (long int)node);
+ y(integer, (uintptr_t)node);
}
y(array_close);
if (match->restart_mode)
continue;
y(map_open);
- if (match->dock != -1) {
+ if (match->dock != M_DONTCHECK) {
ystr("dock");
y(integer, match->dock);
ystr("insert_where");
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).
*
/* 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,
handle_get_marks,
handle_get_bar_config,
handle_get_version,
+ handle_get_binding_modes,
};
/*