summaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
authorDrew DeVault <[email protected]>2016-12-02 08:10:03 -0500
committerDrew DeVault <[email protected]>2016-12-02 08:10:03 -0500
commitf23880b1fdd70a21b04317c18208a1f3ce356839 (patch)
tree51a54d43531ac28ef014193abef8f4ccd7a78332 /sway/config.c
parent0d395681feb13e41a1ba7f70a4e100e9094547f4 (diff)
Add support for command policies in config file
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index a2f6a728..e55c6dea 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -580,7 +580,13 @@ bool read_config(FILE *file, struct sway_config *config) {
free(line);
continue;
}
- struct cmd_results *res = config_command(line, block);
+ struct cmd_results *res;
+ if (block == CMD_BLOCK_COMMANDS) {
+ // Special case
+ res = config_commands_command(line);
+ } else {
+ res = config_command(line, block);
+ }
switch(res->status) {
case CMD_FAILURE:
case CMD_INVALID:
@@ -626,6 +632,14 @@ bool read_config(FILE *file, struct sway_config *config) {
}
break;
+ case CMD_BLOCK_COMMANDS:
+ if (block == CMD_BLOCK_END) {
+ block = CMD_BLOCK_COMMANDS;
+ } else {
+ sway_log(L_ERROR, "Invalid block '%s'", line);
+ }
+ break;
+
case CMD_BLOCK_END:
switch(block) {
case CMD_BLOCK_MODE:
@@ -651,6 +665,11 @@ bool read_config(FILE *file, struct sway_config *config) {
block = CMD_BLOCK_BAR;
break;
+ case CMD_BLOCK_COMMANDS:
+ sway_log(L_DEBUG, "End of commands block");
+ block = CMD_BLOCK_END;
+ break;
+
case CMD_BLOCK_END:
sway_log(L_ERROR, "Unmatched }");
break;