Re: [dev] A dmenu that includes all additional features

From: Fernando C.V. <>
Date: Fri, 16 Sep 2011 03:14:42 +0200

On Sun, Sep 11, 2011 at 11:09 PM, Dieter Plaetinck <> wrote:
> * stable sort. @CLS why I want this: say, for an application launcher, if I
> provide input to dmenu ordered by frequency, that means commands at
> the top are more important then those that come after. (where important
> means: is more likely to be the option the user is looking for)

I'm not really sure what does "stable sort" means, but I modified my
dmenu_run script to make it have some sort of history in
most-recently-used order.

Here it is, in case it's useful:

## Begin of script

        IFS=: # for $PATH :-sepparated entries

        if test "`ls -dt $PATH "$HISTORY" "$CACHE" 2> /dev/null | sed 1q`" !=
"$CACHE"; then
            # Add all the executables in PATH
            mkdir -p "`dirname "$CACHE"`" && lsx $PATH | sort -u >> "$CACHE"

cmd=$(tac "$HISTORY" "$CACHE" | dmenu "$@") || exit

{ # Update history in background
    (echo "g/${cmd}/d"; echo 'wq') | ex -s "$HISTORY"
    echo "$cmd" >> "$HISTORY"
} &

exec sh -c "$cmd"

## End of script

Fernando Carmona Varo
Received on Fri Sep 16 2011 - 03:14:42 CEST

This archive was generated by hypermail 2.2.0 : Fri Sep 16 2011 - 03:24:03 CEST