Re: [dev] [dmenu] sorted unlimited history

From: Peter Hartman <>
Date: Mon, 11 Mar 2013 16:37:41 -0400

2013/3/11 Chris Johnson <>:
> 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

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

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"

if [ ! -f "/home/peterjh/$exe" ] ; then

if [ $? -eq 0 ]; then
        sed -i "\|$exe|d" $HISTFILE
        echo "$exe" >> $HISTFILE
        case "$opt" in
            okular "$exe" &
              run-mailcap "$exe" &

sic dicit magister P
Université du Québec à Montréal / Loyola University Chicago
gpg 1024D/ED6EF59B (7D1A 522F D08E 30F6 FA42 B269 B860 352B ED6E F59B)
gpg --keyserver --recv-keys ED6EF59B
Received on Mon Mar 11 2013 - 21:37:41 CET

This archive was generated by hypermail 2.3.0 : Mon Mar 11 2013 - 21:48:05 CET