Introduction
Introduction Statistics Contact Development Disclaimer Help
run-recent - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
run-recent (636B)
---
1 #!/bin/sh
2 # end a command with ; to run in a terminal
3
4 term="${TERMINAL:-st} -e"
5 cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
6 cache="$cachedir/dmenu_recent"
7
8 touch "$cache"
9
10 # cleaning
11 while read cmd
12 do
13 command -v ${cmd%;} &>/dev/null || sed -i "/$cmd/d" $cache
14 done < <(sort -u $cache)
15
16 most_used=$(sort "$cache" | uniq -c | sort -rh | sed 's/\s*//' | cut -d'…
17 run=$((echo "$most_used"; dmenu_path | grep -vxF "$most_used") | dmenu -…
18
19 [ -z "$run" ] && exit 1
20
21 (echo "$run"; head -n 99 "$cache") > "$cache.$$"
22 mv "$cache.$$" "$cache"
23
24 case "$run" in
25 *\;) exec $(echo $term ${run%;}) ;;
26 *) exec "$run" ;;
27 esac
28
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.