Defer the focus commands

master
Ryan Dwyer 6 years ago
parent a173b79c54
commit 08736255a3

@ -103,6 +103,7 @@ static struct cmd_handler handlers[] = {
{ "exec_always", cmd_exec_always }, { "exec_always", cmd_exec_always },
{ "floating_maximum_size", cmd_floating_maximum_size }, { "floating_maximum_size", cmd_floating_maximum_size },
{ "floating_minimum_size", cmd_floating_minimum_size }, { "floating_minimum_size", cmd_floating_minimum_size },
{ "focus", cmd_focus },
{ "focus_follows_mouse", cmd_focus_follows_mouse }, { "focus_follows_mouse", cmd_focus_follows_mouse },
{ "focus_wrapping", cmd_focus_wrapping }, { "focus_wrapping", cmd_focus_wrapping },
{ "font", cmd_font }, { "font", cmd_font },
@ -137,7 +138,6 @@ static struct cmd_handler command_handlers[] = {
{ "border", cmd_border }, { "border", cmd_border },
{ "exit", cmd_exit }, { "exit", cmd_exit },
{ "floating", cmd_floating }, { "floating", cmd_floating },
{ "focus", cmd_focus },
{ "fullscreen", cmd_fullscreen }, { "fullscreen", cmd_fullscreen },
{ "kill", cmd_kill }, { "kill", cmd_kill },
{ "layout", cmd_layout }, { "layout", cmd_layout },

@ -84,6 +84,9 @@ static struct cmd_results *focus_output(struct sway_container *con,
} }
struct cmd_results *cmd_focus(int argc, char **argv) { 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_container *con = config->handler_context.current_container;
struct sway_seat *seat = config->handler_context.seat; struct sway_seat *seat = config->handler_context.seat;
if (con->type < C_WORKSPACE) { if (con->type < C_WORKSPACE) {

Loading…
Cancel
Save