From 3e8a012e4191bbe4da394049fef6e5df3ad9ef6f Mon Sep 17 00:00:00 2001 From: ZachIR Date: Thu, 17 Jul 2025 15:01:11 -0500 Subject: Add -b flag for bottom --- src/config.c | 2 ++ src/main.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 52e14d8..8239a24 100644 --- a/src/config.c +++ b/src/config.c @@ -319,6 +319,8 @@ bool parse_option(struct tofi *tofi, const char *filename, size_t lineno, const free(config); free(tmp); } + } else if (strcasecmp(option, "bottom") == 0) { + tofi->anchor = ANCHOR_BOTTOM; } 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 e91838f..1bb0982 100644 --- a/src/main.c +++ b/src/main.c @@ -828,6 +828,7 @@ static void usage(bool err) "Basic options:\n" " -h, --help Print this message and exit.\n" " -c, --config Specify a config file.\n" +" -b, --bottom Anchor to the bottom of the screen.\n" " --prompt-text Prompt text.\n" " --width Width of the window.\n" " --height Height of the window.\n" @@ -842,6 +843,7 @@ static void usage(bool err) /* Option parsing with getopt. */ const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, + {"bottom", no_argument, NULL, 'b'}, {"config", required_argument, NULL, 'c'}, {"include", required_argument, NULL, 0}, {"anchor", required_argument, NULL, 0}, @@ -929,7 +931,7 @@ const struct option long_options[] = { {"late-keyboard-init", optional_argument, NULL, 'k'}, {NULL, 0, NULL, 0} }; -const char *short_options = ":hc:"; +const char *short_options = ":bhc:"; static void parse_args(struct tofi *tofi, int argc, char *argv[]) { @@ -977,6 +979,10 @@ static void parse_args(struct tofi *tofi, int argc, char *argv[]) if (!config_apply(tofi, long_options[option_index].name, optarg)) { exit(EXIT_FAILURE); } + } else if (opt == 'b') { + if (!config_apply(tofi, "bottom", optarg)) { + exit(EXIT_FAILURE); + } } else if (opt == 'k') { /* * Backwards compatibility for --late-keyboard-init not -- cgit v1.2.3