aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-24 13:34:47 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-02-24 13:34:47 -0500
commit2154b7c7d623d99e2623f1928f6e77e95255a2d3 (patch)
treea57176801941d44a9bd6ac4e3d776f2f905a4f38 /sway/commands.c
parentremove checks for command handlers (diff)
downloadsway-2154b7c7d623d99e2623f1928f6e77e95255a2d3.tar.gz
sway-2154b7c7d623d99e2623f1928f6e77e95255a2d3.tar.zst
sway-2154b7c7d623d99e2623f1928f6e77e95255a2d3.zip
add config handlers
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c19
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[] = {
138 { "input", cmd_input }, 138 { "input", cmd_input },
139 { "output", cmd_output }, 139 { "output", cmd_output },
140 { "seat", cmd_seat }, 140 { "seat", cmd_seat },
141 { "set", cmd_set },
142 { "workspace", cmd_workspace }, 141 { "workspace", cmd_workspace },
143}; 142};
144 143
145/** 144/**
145 * Commands that can *only* run in the config loading context
146 * Keep alphabetized
147 */
148static struct cmd_handler config_handlers[] = {
149 { "set", cmd_set },
150};
151
152/**
146 * Commands that can *not* run in the config loading context 153 * Commands that can *not* run in the config loading context
147 * Keep alphabetized 154 * Keep alphabetized
148 */ 155 */
@@ -215,6 +222,16 @@ static struct cmd_handler *find_handler(char *line, enum cmd_status block) {
215 } 222 }
216 } 223 }
217 224
225 if (config->reading) {
226 res = bsearch(&d, config_handlers,
227 sizeof(config_handlers) / sizeof(struct cmd_handler),
228 sizeof(struct cmd_handler), handler_compare);
229
230 if (res) {
231 return res;
232 }
233 }
234
218 res = bsearch(&d, handlers, 235 res = bsearch(&d, handlers,
219 sizeof(handlers) / sizeof(struct cmd_handler), 236 sizeof(handlers) / sizeof(struct cmd_handler),
220 sizeof(struct cmd_handler), handler_compare); 237 sizeof(struct cmd_handler), handler_compare);