diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index ed8da3dc..b52eb200 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -138,11 +138,18 @@ static struct cmd_handler handlers[] = { { "input", cmd_input }, { "output", cmd_output }, { "seat", cmd_seat }, - { "set", cmd_set }, { "workspace", cmd_workspace }, }; /** + * Commands that can *only* run in the config loading context + * Keep alphabetized + */ +static struct cmd_handler config_handlers[] = { + { "set", cmd_set }, +}; + +/** * Commands that can *not* run in the config loading context * Keep alphabetized */ @@ -215,6 +222,16 @@ static struct cmd_handler *find_handler(char *line, enum cmd_status block) { } } + if (config->reading) { + res = bsearch(&d, config_handlers, + sizeof(config_handlers) / sizeof(struct cmd_handler), + sizeof(struct cmd_handler), handler_compare); + + if (res) { + return res; + } + } + res = bsearch(&d, handlers, sizeof(handlers) / sizeof(struct cmd_handler), sizeof(struct cmd_handler), handler_compare); |