Re : [dev] dmenu : auto confirm when only one item remains

From: Julien Steinhauser <Julien.Steinhauser_AT_orange.fr>
Date: Fri, 14 Aug 2009 10:32:52 +0200

Donald Chai a écrit :
> I'm glad it works well for you, this minor change should work for
> matching on substrings as well:
>
> diff -r 9b203c5c180d dmenu.c
> --- a/dmenu.c Sat Apr 18 12:50:12 2009 +0100
> +++ b/dmenu.c Thu Aug 13 11:24:18 2009 -0700
> @@ -69,6 +69,7 @@
> /* variables */
> static char *maxname = NULL;
> static char *prompt = NULL;
> +static Bool autoconfirm = False;
> static char text[4096];
> static int cmdw = 0;
> static int promptw = 0;
> @@ -514,6 +515,12 @@
> }
> curr = prev = next = sel = item;
> calcoffsets();
> +
> + if(autoconfirm && item && !item->right) {
> + fprintf(stdout, "%s", item->text);
> + fflush(stdout);
> + running = False;
> + }
> }
>
> void
> @@ -674,6 +681,8 @@
> fstrncmp = strncasecmp;
> fstrstr = cistrstr;
> }
> + else if(!strcmp(argv[i], "-a"))
> + autoconfirm = True;
> else if(!strcmp(argv[i], "-b"))
> topbar = False;
> else if(!strcmp(argv[i], "-fn")) {
>
He He, this one is also good,
I think that actually both methods have advantages,

I use the one on top, your second proposal with the -a option in dmenu_run,
to browse my whole path as in a large list, it gives more chances
that many item begin similar so the substring selector helps a lot.

I use your first proposal on short lists as it lowers the number of item
faster
than your second proposal and make it possible to select item in 1 or 2
keystrokes on <50 items list.
I just have to give attention to name item with different first letters.

Thank you again for these two patchs ( and also for the sh script tip). :)
Received on Fri Aug 14 2009 - 08:32:52 UTC

This archive was generated by hypermail 2.2.0 : Sun Aug 16 2009 - 14:18:48 UTC