ddd0a4bc67563e4d26b1e4a67390bc3b507bed61
[uzbl-mobile] / examples / data / uzbl / scripts / yank.sh
1 #!/bin/sh
2 # use this script to pipe any variable to xclip, so you have it in your clipboard
3 # in your uzbl config, make the first argument the number of the (later) argument you want to use (see README for list of args)
4 # make the 2nd argument one of : primary, secondary, clipboard.
5 # examples:
6 # bind    yurl      = spawn ./examples/scripts/yank.sh 6 primary
7 # bind    ytitle    = spawn ./examples/scripts/yank.sh 7 clipboard
8
9 clip=xclip
10
11 which xclip &>/dev/null || exit 1
12 [ "x$9" = xprimary -o "x$9" = xsecondary -o "x$9" = xclipboard ] || exit 2
13
14 echo "echo -n '${8}' | $clip -selection $9"
15 echo -n "'${8}' | $clip -selection $9"