@@ -913,6 +913,7 @@ const struct option long_options[] = {
913913 {"history-file" , required_argument , NULL , 0 },
914914 {"fuzzy-match" , required_argument , NULL , 0 },
915915 {"require-match" , required_argument , NULL , 0 },
916+ {"auto-accept-single" , required_argument , NULL , 0 },
916917 {"hide-input" , required_argument , NULL , 0 },
917918 {"hidden-character" , required_argument , NULL , 0 },
918919 {"drun-launch" , required_argument , NULL , 0 },
@@ -1198,7 +1199,7 @@ int main(int argc, char *argv[])
11981199 }
11991200
12001201 parse_args (& tofi , argc , argv );
1201- log_debug ("Config done\n" );
1202+ log_debug ("Config done. \n" );
12021203
12031204 if (!tofi .multiple_instance && lock_check ()) {
12041205 log_error ("Another instance of tofi is already running.\n" );
@@ -1498,6 +1499,12 @@ int main(int argc, char *argv[])
14981499 }
14991500 tofi .window .entry .results = string_ref_vec_copy (& tofi .window .entry .commands );
15001501
1502+ if (tofi .auto_accept_single && tofi .window .entry .results .count == 1 ) {
1503+ log_debug ("Only one result, exiting.\n" );
1504+ do_submit (& tofi );
1505+ return EXIT_SUCCESS ;
1506+ }
1507+
15011508 /*
15021509 * Next, we create the Wayland surface, which takes on the
15031510 * layer shell role.
0 commit comments