|
@@ -11,14 +11,41 @@ clipln() {
|
11
|
11
|
#
|
12
|
12
|
# Print primary clipboard and \n
|
13
|
13
|
#
|
14
|
|
- xclip -o -selection primary 2>/dev/null
|
|
14
|
+ case $1 in
|
|
15
|
+ 1) s=primary ;;
|
|
16
|
+ 2) s=secondary ;;
|
|
17
|
+ c) s=clipboard ;;
|
|
18
|
+ esac
|
|
19
|
+ xclip -o -selection $s 2>/dev/null
|
15
|
20
|
echo ""
|
16
|
21
|
}
|
17
|
22
|
|
18
|
|
-debug "\$@=$@"
|
|
23
|
+src=args
|
|
24
|
+while true; do case "$1" in
|
|
25
|
+ -f) src=file; file=$2; shift 2 ;;
|
|
26
|
+ -1) src=clp1; shift ;;
|
|
27
|
+ -2) src=clp2; shift ;;
|
|
28
|
+ -c) src=clpc; shift ;;
|
|
29
|
+ -C) src=clpx; shift ;;
|
|
30
|
+ *) break ;;
|
|
31
|
+esac done
|
|
32
|
+
|
|
33
|
+debug "\$@='$@'"
|
|
34
|
+debug "src='$src'"
|
|
35
|
+
|
|
36
|
+case "$src" in
|
|
37
|
+ args) uri="$(echo "$@" | find_uri)" ;;
|
|
38
|
+ file) uri="$(cat "$file" | find_uri)" ;;
|
|
39
|
+ clp1) uri="$(clipln 1 | find_uri)" ;;
|
|
40
|
+ clp2) uri="$(clipln 2 | find_uri)" ;;
|
|
41
|
+ clpc) uri="$(clipln c | find_uri)" ;;
|
|
42
|
+ clpx) uri="$(clipln 1 | find_uri)"
|
|
43
|
+ uri="$(clipln 2 | find_uri)"
|
|
44
|
+ uri="$(clipln c | find_uri)"
|
|
45
|
+ ;;
|
|
46
|
+esac
|
|
47
|
+debug -v uri
|
19
|
48
|
|
20
|
|
-test -z "$uri" && uri="$(echo "$@" | find_uri)"
|
21
|
|
-test -z "$uri" && uri="$(clipln | find_uri)"
|
22
|
49
|
test -z "$uri" && uri="$(cfgrep -p www.bookmark.default)"
|
23
|
50
|
|
24
|
51
|
echo "$uri"
|