aboutsummaryrefslogtreecommitdiff
path: root/bin/snipmenu
blob: bd54f7db62af3b60cc780d76b9a95d0657fdf1ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
set -e
snipdir="__REPLACE__"
act='type'

while [ $# -gt 0 ] ; do case $1 in
	-s) snipdir="$2"; shift ; shift ;;
	copy) act='copy' ; shift ;;
	type) act='type' ; shift ;;
	*) break ;;
esac ; done

cd "$snipdir"
_file=$(find -L . \! -type d | dmenu "$@")

case $act in
copy) xclip -selection clipboard < "$_file" ;;
type) xdotool type --delay 1ms --clearmodifiers --file "$_file" ;;
esac