Chris, functionality that you demand could easily be provided by this
simple script.
Syntax is obvious and even described inside the script.
Enjoy!
https://gist.github.com/ElectronicRU/5138928


2013/3/12 Chris Johnson <[email protected]>:
> I thought of the check for whether or not it exists when I was working on
> it, but I wasn't sure what all to check for.  I only use it to run
> executable files so for my case it's easy, but I wasn't sure what all might
> get put in there.  When I asked in the irc channel there was some mention of
> things other than files that would show up in the list, so I decided not to
> worry about the check and let the user prune bogus history items some other
> way.  I think someone put together an example to do the pruning that was
> basically a one line bash script which could be run separately from dmenu
> itself.
>
>
> On Mon, Mar 11, 2013 at 4:37 PM, Peter Hartman <[email protected]>
> wrote:
>>
>> 2013/3/11 Chris Johnson <[email protected]>:
>> > I created a patch to have sorted (first by number of previous runs, then
>> > by
>> > most recent) and unlimited history.  It is similar to the patch from
>> > Peter
>> > John Hartman, but modified in the following ways:
>>
>> Hi Chris,
>>
>> That's neat.  I moved to using a shell script wrapper to dmenu to do
>> history --- I believe those scripts are on the website --- but it
>> won't do the neat trick of moving things to the top based on how often
>> they are used.  I'd advocate something like this get moved into dmenu
>> tip.
>>
>> It'd also be nice (more generally, even without the history patch, but
>> especially with it) to have a check to verify that the file still
>> exists.  For instance, I use the history feature on dmenu when I open
>> pdf files on my system, e.g. [1] where .dmenu_cache_pdfs is generated
>> via a cron script.  But, of course, sometimes I will move or rename
>> pdf files around, and then the history file will be all dumb.  It'd be
>> a one-line fix.
>>
>> [1] pdf-opener
>>
>> #!/bin/bash
>> HISTFILE=~/.dmenu_cache_pdfs.hist
>> CACHEFILE=~/.dmenu_cache_pdfs
>> exe=$(tac $HISTFILE $CACHEFILE | sed 's|^/home/peterjh/||'| dmenu -p
>> "*" -i -l 10)
>>
>> echo "$exe"
>> case "$exe" in
>>  o*) opt="okular"
>>      exe=$(echo "$exe" | sed 's/^o //')
>>  ;;
>>  *) opt="mailcap"
>>  ;;
>> esac
>>
>> if [ ! -f "/home/peterjh/$exe" ] ; then
>>   exit
>> fi
>>
>> if [ $? -eq 0 ]; then
>>         exe="/home/peterjh/$exe"
>>         sed -i "\|$exe|d" $HISTFILE
>>         echo "$exe" >> $HISTFILE
>>         case "$opt" in
>>           okular)
>>             okular "$exe" &
>>             ;;
>>           mailcap)
>>             run-mailcap "$exe" &
>>             ;;
>>     esac
>> fi
>>
>>
>>
>>
>> --
>> sic dicit magister P
>> Université du Québec à Montréal / Loyola University Chicago
>> http://individual.utoronto.ca/peterjh
>> gpg 1024D/ED6EF59B (7D1A 522F D08E 30F6 FA42 B269 B860 352B ED6E F59B)
>> gpg --keyserver pgp.mit.edu --recv-keys ED6EF59B
>>
>

Reply via email to