sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit a482a7fd7e44f8f3eb912e97bba37eec44478c7d
parent bd9e4cdc760a63c0139d5273d4c8d93c6f44228a
Author: Thuban <thuban@singularity.fr>
Date:   Thu, 20 Jun 2013 10:05:57 +0200

added script section to dmenu, with one example

Diffstat:
Atools.suckless.org/dmenu/scripts/index.md | 13+++++++++++++
Atools.suckless.org/dmenu/scripts/run-recent | 23+++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/dmenu/scripts/index.md b/tools.suckless.org/dmenu/scripts/index.md @@ -0,0 +1,13 @@ +Scripts using dmenu +===== + +dmenu's user, feel free to add your own scripts, or comment existents. + +Download +-------- + +* [run-recent](run-recent) : List recent commands first. End a command + with ";" to run it in e terminal. + [source](https://bbs.archlinux.org/viewtopic.php?id=56646&p=12) + + diff --git a/tools.suckless.org/dmenu/scripts/run-recent b/tools.suckless.org/dmenu/scripts/run-recent @@ -0,0 +1,23 @@ +#!/bin/sh +# end a command with ; to run in a terminal + +SB="#336699" +SF="#ccc" +NB="#111" +NF="#ccc" +OPTIONS="-fn $FN -nb $NB -nf $NF -sb $SB -sf $SF -i" + +DMENU="dmenu -i $OPTIONS" +TERMI="st -e" +CACHE="$HOME/.dmenu_cache_recent" + +touch $CACHE +MOST_USED=`sort $CACHE | uniq -c | sort -r | colrm 1 8` +RUN=`(echo "$MOST_USED"; dmenu_path | grep -vxF "$MOST_USED") | $DMENU $@` && +(echo $RUN; head -n 99 $CACHE) > $CACHE.$$ && +mv $CACHE.$$ $CACHE + +case $RUN in + *\;) exec `echo $TERMI $RUN | sed -e 's/;$//'`;; + *) exec $RUN;; +esac