summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 5d5087b1..47f7533c 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -180,6 +180,7 @@ static struct cmd_handler handlers[] = {
180 { "hide_edge_borders", cmd_hide_edge_borders }, 180 { "hide_edge_borders", cmd_hide_edge_borders },
181 { "include", cmd_include }, 181 { "include", cmd_include },
182 { "input", cmd_input }, 182 { "input", cmd_input },
183 { "ipc", cmd_ipc },
183 { "kill", cmd_kill }, 184 { "kill", cmd_kill },
184 { "layout", cmd_layout }, 185 { "layout", cmd_layout },
185 { "log_colors", cmd_log_colors }, 186 { "log_colors", cmd_log_colors },
@@ -292,6 +293,26 @@ static struct cmd_handler bar_colors_handlers[] = {
292 { "urgent_workspace", bar_colors_cmd_urgent_workspace }, 293 { "urgent_workspace", bar_colors_cmd_urgent_workspace },
293}; 294};
294 295
296static struct cmd_handler ipc_handlers[] = {
297 { "bar-config", cmd_ipc_cmd },
298 { "command", cmd_ipc_cmd },
299 { "events", cmd_ipc_events },
300 { "inputs", cmd_ipc_cmd },
301 { "marks", cmd_ipc_cmd },
302 { "outputs", cmd_ipc_cmd },
303 { "tree", cmd_ipc_cmd },
304 { "workspaces", cmd_ipc_cmd },
305};
306
307static struct cmd_handler ipc_event_handlers[] = {
308 { "binding", cmd_ipc_event_cmd },
309 { "input", cmd_ipc_event_cmd },
310 { "mode", cmd_ipc_event_cmd },
311 { "output", cmd_ipc_event_cmd },
312 { "window", cmd_ipc_event_cmd },
313 { "workspace", cmd_ipc_event_cmd },
314};
315
295static int handler_compare(const void *_a, const void *_b) { 316static int handler_compare(const void *_a, const void *_b) {
296 const struct cmd_handler *a = _a; 317 const struct cmd_handler *a = _a;
297 const struct cmd_handler *b = _b; 318 const struct cmd_handler *b = _b;
@@ -311,10 +332,17 @@ static struct cmd_handler *find_handler(char *line, enum cmd_status block) {
311 sizeof(bar_colors_handlers) / sizeof(struct cmd_handler), 332 sizeof(bar_colors_handlers) / sizeof(struct cmd_handler),
312 sizeof(struct cmd_handler), handler_compare); 333 sizeof(struct cmd_handler), handler_compare);
313 } else if (block == CMD_BLOCK_INPUT) { 334 } else if (block == CMD_BLOCK_INPUT) {
314 sway_log(L_DEBUG, "looking at input handlers");
315 res = bsearch(&d, input_handlers, 335 res = bsearch(&d, input_handlers,
316 sizeof(input_handlers) / sizeof(struct cmd_handler), 336 sizeof(input_handlers) / sizeof(struct cmd_handler),
317 sizeof(struct cmd_handler), handler_compare); 337 sizeof(struct cmd_handler), handler_compare);
338 } else if (block == CMD_BLOCK_IPC) {
339 res = bsearch(&d, ipc_handlers,
340 sizeof(ipc_handlers) / sizeof(struct cmd_handler),
341 sizeof(struct cmd_handler), handler_compare);
342 } else if (block == CMD_BLOCK_IPC_EVENTS) {
343 res = bsearch(&d, ipc_event_handlers,
344 sizeof(ipc_event_handlers) / sizeof(struct cmd_handler),
345 sizeof(struct cmd_handler), handler_compare);
318 } else { 346 } else {
319 res = bsearch(&d, handlers, 347 res = bsearch(&d, handlers,
320 sizeof(handlers) / sizeof(struct cmd_handler), 348 sizeof(handlers) / sizeof(struct cmd_handler),