From: Dieter Plaetinck Date: Sun, 17 May 2009 14:09:59 +0000 (+0200) Subject: working yank script X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=2a552a8707a84158d34f4fd4f28fee9aa07f2ff6;p=uzbl-mobile working yank script --- diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 9196f4c..faf0162 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -79,6 +79,9 @@ bind i = insert_mode bind B = spawn ./examples/scripts/insert_bookmark.sh bind U = spawn ./examples/scripts/load_url_from_history.sh bind u = spawn ./examples/scripts/load_url_from_bookmarks.sh +# with the sample yank script, you can yank one of the arguments into clipboard/selection +bind yurl = spawn ./examples/scripts/yank.sh 8 primary +bind ytitle = spawn ./examples/scripts/yank.sh 9 clipboard bind ZZ = exit bind S = script alert("hi"); # example showing how to use sh diff --git a/examples/scripts/yank.sh b/examples/scripts/yank.sh index 0429f19..d4926be 100755 --- a/examples/scripts/yank.sh +++ b/examples/scripts/yank.sh @@ -1,10 +1,11 @@ # use this script to pipe any variable to xclip, so you have it in your clipboard -exit -# this script is not done yet - -# can we make this universal? -# add xclip to optdeps +# in your uzbl config, make the first argument the number of the (later) argument you want to use (see README for list of args) +# make the 2nd argument one of : primary, secondary, clipboard. +# examples: +# bind yurl = spawn ./examples/scripts/yank.sh 8 primary +# bind ytitle = spawn ./examples/scripts/yank.sh 9 clipboard which xclip &>/dev/null || exit 1 +[ "$2" == primary -o "$2" == secondary -o "$2" == clipboard ] || exit 2 -echo -n `eval "$3"` #| xclip \ No newline at end of file +echo -n "${!1}" | xclip -selection $2 \ No newline at end of file