mirror of
https://github.com/swaywm/sway.git
synced 2025-11-22 06:59:48 -05:00
Add support for command policies in config file
This commit is contained in:
parent
0d395681fe
commit
f23880b1fd
7 changed files with 142 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue