On Thu, Nov 30, 2006 at 03:34:03PM -0500, Bill Puschmann wrote:

> I'm curious if it would even be possible to allow typing into dmenu before
> the "tab-completion" fields being piped in are populated.

I'm using a cache mechanism -- see my dwm-patches[1]:

Step a)
-------
when I start dwm, I remove my cache:

$ rm -f ~/.dmenu-cache

I have this in a small shell script that is called from my login
manager (wdm) and is run automatically.  It ends running dwm.


Steb b)
-------
I use the following script called dwm-choose to run dmenu (with
history patch applied):

#!/bin/bash
cachefile=~/.dmenu-cache
histfile=~/.dmenu-history
if [ ! -r "$cachefile" ] ; then
        (
                IFS=:
                for dir in $PATH; do
                        for file in "$dir"/*; do
                                [ -x "$file" ] && echo "${file##*/}"
                        done
                done | sort | uniq > "$cachefile"
        )       
fi
exec $(dmenu -normfg \#bbb -normbg \#000 -selfg \#eee -selbg \#000 -hist 
"$histfile" < "$cachefile")


This script only scans the $PATH when the history file does not
exist.  The first call of dmenu is slow, but subsequent calls are
fast.  If I install programs or change my $PATH, I just remove the
cache file manually and the next dmenu call will search the $PATH
again.

Regards,
Christian

[1] http://www.cgarbs.de/dwm-mitch.en.html
-- 
....Christian.Garbs.....................................http://www.cgarbs.de

If you took all of the grains of sand in the world, and lined
them up end to end in a row, you'd be working for the government!
                -- Mr. Interesting


Reply via email to