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

From: Julien Steinhauser <Julien.Steinhauser_AT_orange.fr>
Date: Thu, 13 Aug 2009 19:05:04 +0200

Julien Steinhauser a écrit :
>
>> IMO very bad idea. If you do that you won't be able to run command
>> with arguments (eg. urxvt -e irssi).
>>
>> Regards,
>> Slawek.
>
> You're right, but dmenu is small enough to have several version in
> /usr/local/bin.
> At the moment, I've one with Fresch patch for vertical display and
> xmms like matching,
> for mpd playlist and uzbl history and bookmarks, one brand new with
> autoconfirmation
> to surf in my directories faster than in shell and launching personnal
> scripts
> which don't need arguments, and a little script to launch terminal
> apps direct from dmenu,
> which is a copy of dmenu_run in which I've added urxvtc -e beetween
> "exec" and "$exe".
>
>
>
>
>
>
Actually, you're not really right, when I tried my new dmenu yesterday,
it had :
1) the patch to autoconfirm when only one item remains

AND

2) the patch to make it auto confirm on exact matching,
that I had found yesterday and just tested before I post my first message.

With the second one, it was obviously not possible to give dmenu an
argument.
Now the second one is removed, I just keep going with the proposal below
that Donald Chai made to me, which works great!

Donald Chai wrote :
Adding the following lines to the end of the match(void) procedure
should do the trick:
        if(item && item==itemend) {
            fprintf(stdout, "%s", item->text);
            fflush(stdout);
            running = False;
        }

To all people who have complained about such patch,
as it could break their personnal scripts
or complicate their life in making impossible
adding arguments to dmenu,

I guess you have done a confusion beetween "exact match autoconfirmation",
which wasn't actually my request and "one remaining item autoconfirmation"

With Donald's proposal, I can still give arguments to dmenu
and none of my scripts are broken.

For those who are still sceptic, just save your actual dmenu,
build a new one with the patch and try it out!

Sure that if one uses dmenu only to browse his complete path,
it won't be very useful as many item begin similar,
but to many other usage, it helps.

Try it simply with the following scripts in your path :
- lsd (for contraction beetween ls and dmenu) :

#!/bin/sh
cd /
index=`ls -dU .*/ */ | dmenu -p $PWD`
[ -z $index ]
if [ $? = 1 ]; then
  cd $index && lsd ; else
  actions
fi

-actions :

#!/bin/sh
index=`cat ~/scripts/actions | dmenu -p "$PWD Launch"`
[ -z $index ]
if [ $? = 1 ]; then
  exec $index&
fi

the ~/scripts/actions file contains just a list of favorite scripts
or programs name separated by new line.
Received on Thu Aug 13 2009 - 17:05:04 UTC

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