summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2025-07-17 15:05:19 -0500
committerZachIR <zachir@librem.one>2025-07-17 15:05:19 -0500
commit4576231a059b4001427e392f94d6ece2c1ae9ef4 (patch)
tree8bfc32bb542947ed51dda43c995279ec5f55220e
parent384ae5ab297bfae189532b4290179daeb3e89fad (diff)
Add -r require flag
-rw-r--r--src/config.c2
-rw-r--r--src/main.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index d45e62b..98015ce 100644
--- a/src/config.c
+++ b/src/config.c
@@ -323,6 +323,8 @@ bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const
tofi->anchor = ANCHOR_BOTTOM;
} else if (strcasecmp(option, "password") == 0) {
tofi->window.entry.hide_input = true;
+ } else if (strcasecmp(option, "require") == 0) {
+ tofi->require_match = true;
} else if (strcasecmp(option, "anchor") == 0) {
uint32_t val = parse_anchor(filename, lineno, value, &err);
if (!err) {
diff --git a/src/main.c b/src/main.c
index 74a26d7..7049a1c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -846,6 +846,7 @@ const struct option long_options[] = {
{"help", no_argument, NULL, 'h'},
{"bottom", no_argument, NULL, 'b'},
{"password", no_argument, NULL, 'P'},
+ {"require", no_argument, NULL, 'r'},
{"config", required_argument, NULL, 'c'},
{"include", required_argument, NULL, 0},
{"anchor", required_argument, NULL, 0},
@@ -933,7 +934,7 @@ const struct option long_options[] = {
{"late-keyboard-init", optional_argument, NULL, 'k'},
{NULL, 0, NULL, 0}
};
-const char *short_options = ":bhPc:";
+const char *short_options = ":bhPr:c:";
static void parse_args(struct tofi *tofi, int argc, char *argv[])
{
@@ -989,6 +990,10 @@ static void parse_args(struct tofi *tofi, int argc, char *argv[])
if (!config_apply(tofi, "password", optarg)) {
exit(EXIT_FAILURE);
}
+ } else if (opt == 'r') {
+ if (!config_apply(tofi, "require", optarg)) {
+ exit(EXIT_FAILURE);
+ }
} else if (opt == 'k') {
/*
* Backwards compatibility for --late-keyboard-init not