aboutsummaryrefslogtreecommitdiff
path: root/clip
diff options
context:
space:
mode:
Diffstat (limited to 'clip')
-rwxr-xr-xclip18
1 files changed, 13 insertions, 5 deletions
diff --git a/clip b/clip
index 4f1ae25..dbd3f33 100755
--- a/clip
+++ b/clip
@@ -7,12 +7,20 @@
7# Bugs (wontfix): the program fails if it can't create the temporary 7# Bugs (wontfix): the program fails if it can't create the temporary
8# directory with the designated name. 8# directory with the designated name.
9 9
10# Requires: xsel, dmenu 10# Usage: clip [-m menu]
11 11
12# TODO: improve formatting in dmenu 12# Requires: xsel, dmenu (or similar)
13 13
14menu="dmenu" 14menu="dmenu -i -l 25"
15menuopts="-l 25" 15
16while getopts "m:" opt; do
17 case "$opt" in
18 m)
19 menu="$OPTARG"
20 ;;
21 esac
22done
23shift `expr $OPTIND - 1`
16 24
17dir="/tmp/clipdir" 25dir="/tmp/clipdir"
18mkdir -p "$dir" 26mkdir -p "$dir"
@@ -38,7 +46,7 @@ for f in $dir/*; do
38 printf "$fclean ($nlines) | $(head -n 1 $f)\n" >> "$lines" 46 printf "$fclean ($nlines) | $(head -n 1 $f)\n" >> "$lines"
39done 47done
40 48
41selected=$(sort -r $lines | $menu $menuopts | awk '{print $1}') 49selected=$(sort -r $lines | $menu | awk '{print $1}')
42if [ -n "$selected" ]; then 50if [ -n "$selected" ]; then
43 xsel -ib < "$dir/$selected" 51 xsel -ib < "$dir/$selected"
44fi 52fi

Generated with cgit - Back to sebastiano.tronto.net