mirror of
https://github.com/swaywm/sway.git
synced 2025-11-14 06:59:47 -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
23
sway/commands/commands.c
Normal file
23
sway/commands/commands.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "list.h"
|
||||
#include "log.h"
|
||||
|
||||
struct cmd_results *cmd_commands(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "commands", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "{") != 0) {
|
||||
return cmd_results_new(CMD_FAILURE, "commands", "Expected block declaration");
|
||||
}
|
||||
|
||||
if (!config->reading) {
|
||||
return cmd_results_new(CMD_FAILURE, "commands", "Can only be used in config file.");
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_BLOCK_COMMANDS, NULL, NULL);
|
||||
}
|
||||
|
|
@ -20,8 +20,7 @@ static enum secure_feature get_features(int argc, char **argv,
|
|||
{ "keyboard", FEATURE_KEYBOARD },
|
||||
{ "mouse", FEATURE_MOUSE },
|
||||
};
|
||||
size_t names_len = sizeof(feature_names) /
|
||||
(sizeof(char *) + sizeof(enum secure_feature));
|
||||
size_t names_len = 7;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
size_t j;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue