diff options
author | Phil Jones <philj56@gmail.com> | 2023-04-09 18:26:52 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2023-04-09 18:26:52 +0100 |
commit | cfab8efa406c7ff1063cb6ef89cb41028d0e826e (patch) | |
tree | 35f5931295bcd430189002fc68abf1acdc03bf9c /src/main.c | |
parent | 0fe8548a6534a80aa81c288629799a752f0060c2 (diff) |
Add --auto-accept-single option.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -913,6 +913,7 @@ const struct option long_options[] = { {"history-file", required_argument, NULL, 0}, {"fuzzy-match", required_argument, NULL, 0}, {"require-match", required_argument, NULL, 0}, + {"auto-accept-single", required_argument, NULL, 0}, {"hide-input", required_argument, NULL, 0}, {"hidden-character", required_argument, NULL, 0}, {"drun-launch", required_argument, NULL, 0}, @@ -1198,7 +1199,7 @@ int main(int argc, char *argv[]) } parse_args(&tofi, argc, argv); - log_debug("Config done\n"); + log_debug("Config done.\n"); if (!tofi.multiple_instance && lock_check()) { log_error("Another instance of tofi is already running.\n"); @@ -1498,6 +1499,12 @@ int main(int argc, char *argv[]) } tofi.window.entry.results = string_ref_vec_copy(&tofi.window.entry.commands); + if (tofi.auto_accept_single && tofi.window.entry.results.count == 1) { + log_debug("Only one result, exiting.\n"); + do_submit(&tofi); + return EXIT_SUCCESS; + } + /* * Next, we create the Wayland surface, which takes on the * layer shell role. |