From 08736255a3ba16f6b810fd4eee91fe4e1ab92e35 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 19 Jul 2018 16:41:02 +1000 Subject: [PATCH] Defer the focus commands --- sway/commands.c | 2 +- sway/commands/focus.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sway/commands.c b/sway/commands.c index a3e6a500..73c968ea 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -103,6 +103,7 @@ static struct cmd_handler handlers[] = { { "exec_always", cmd_exec_always }, { "floating_maximum_size", cmd_floating_maximum_size }, { "floating_minimum_size", cmd_floating_minimum_size }, + { "focus", cmd_focus }, { "focus_follows_mouse", cmd_focus_follows_mouse }, { "focus_wrapping", cmd_focus_wrapping }, { "font", cmd_font }, @@ -137,7 +138,6 @@ static struct cmd_handler command_handlers[] = { { "border", cmd_border }, { "exit", cmd_exit }, { "floating", cmd_floating }, - { "focus", cmd_focus }, { "fullscreen", cmd_fullscreen }, { "kill", cmd_kill }, { "layout", cmd_layout }, diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 2426a7f4..894025ad 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -84,6 +84,9 @@ static struct cmd_results *focus_output(struct sway_container *con, } struct cmd_results *cmd_focus(int argc, char **argv) { + if (config->reading || !config->active) { + return cmd_results_new(CMD_DEFER, NULL, NULL); + } struct sway_container *con = config->handler_context.current_container; struct sway_seat *seat = config->handler_context.seat; if (con->type < C_WORKSPACE) {