From e211c19ca4729ad498a58ca6bbdf6b5ce9ef22ea Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 29 Nov 2010 17:49:01 -0700 Subject: use the new $UZBL_* env vars exclusively --- examples/data/scripts/download.sh | 1 - examples/data/scripts/follow.sh | 2 -- examples/data/scripts/formfiller.sh | 1 - examples/data/scripts/go_input.sh | 19 ++----------------- examples/data/scripts/history.sh | 2 +- examples/data/scripts/insert_bookmark.sh | 1 - examples/data/scripts/load_url_from_bookmarks.sh | 1 - examples/data/scripts/load_url_from_history.sh | 1 - examples/data/scripts/session.sh | 3 ++- examples/data/scripts/userscript.sh | 16 +++++++--------- examples/data/scripts/userscripts.sh | 2 +- examples/data/scripts/util/uzbl-args.sh | 17 ----------------- examples/data/scripts/util/uzbl-window.sh | 6 ------ 13 files changed, 13 insertions(+), 59 deletions(-) delete mode 100644 examples/data/scripts/util/uzbl-args.sh (limited to 'examples/data') diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index 606aa62..cc3cd99 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -2,7 +2,6 @@ # just an example of how you could handle your downloads # try some pattern matching on the uri to determine what we should do -. $UZBL_UTIL_DIR/uzbl-args.sh . $UZBL_UTIL_DIR/uzbl-dir.sh # Some sites block the default wget --user-agent.. diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index c8ded84..d1560bf 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -3,8 +3,6 @@ # This script is just a wrapper around follow.js that lets us change uzbl's mode # after a link is selected. -. "$UZBL_UTIL_DIR"/uzbl-args.sh - # if socat is installed then we can change Uzbl's input mode once a link is # selected; otherwise we just select a link. if ! which socat >/dev/null 2>&1; then diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index b2e61ec..0f04f8a 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -45,7 +45,6 @@ DMENU_OPTIONS="vertical resize" . $UZBL_UTIL_DIR/dmenu.sh . $UZBL_UTIL_DIR/editor.sh -. $UZBL_UTIL_DIR/uzbl-args.sh . $UZBL_UTIL_DIR/uzbl-dir.sh RAND=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c 1-5) diff --git a/examples/data/scripts/go_input.sh b/examples/data/scripts/go_input.sh index c873dd8..ace0e79 100755 --- a/examples/data/scripts/go_input.sh +++ b/examples/data/scripts/go_input.sh @@ -1,20 +1,5 @@ #!/bin/sh -config=$1; -shift -pid=$1; -shift -xid=$1; -shift -fifo=$1; -shift -socket=$1; -shift -url=$1; -shift -title=$1; -shift - -case $(echo 'script @scripts_dir/go_input.js' | socat - unix-connect:$socket) in - *XXXEMIT_FORM_ACTIVEXXX*) echo 'event FORM_ACTIVE' | socat - unix-connect:$socket ;; +case $(echo 'script @scripts_dir/go_input.js' | socat - unix-connect:"$UZBL_SOCKET") in + *XXXEMIT_FORM_ACTIVEXXX*) echo 'event FORM_ACTIVE' > "$UZBL_FIFO" ;; esac diff --git a/examples/data/scripts/history.sh b/examples/data/scripts/history.sh index 0561fe9..167aed7 100755 --- a/examples/data/scripts/history.sh +++ b/examples/data/scripts/history.sh @@ -4,4 +4,4 @@ [ -w "$UZBL_HISTORY_FILE" ] || [ ! -a "$UZBL_HISTORY_FILE" ] || exit 1 -echo $(date +'%Y-%m-%d %H:%M:%S')" $6 $7" >> $UZBL_HISTORY_FILE +echo $(date +'%Y-%m-%d %H:%M:%S')" $UZBL_URL $UZBL_TITLE" >> $UZBL_HISTORY_FILE diff --git a/examples/data/scripts/insert_bookmark.sh b/examples/data/scripts/insert_bookmark.sh index 24f7241..294d314 100755 --- a/examples/data/scripts/insert_bookmark.sh +++ b/examples/data/scripts/insert_bookmark.sh @@ -1,6 +1,5 @@ #!/bin/sh -. "$UZBL_UTIL_DIR"/uzbl-args.sh . "$UZBL_UTIL_DIR"/uzbl-dir.sh [ -d "$UZBL_DATA_DIR" ] || exit 1 diff --git a/examples/data/scripts/load_url_from_bookmarks.sh b/examples/data/scripts/load_url_from_bookmarks.sh index 9346526..a5d9586 100755 --- a/examples/data/scripts/load_url_from_bookmarks.sh +++ b/examples/data/scripts/load_url_from_bookmarks.sh @@ -6,7 +6,6 @@ DMENU_SCHEME="bookmarks" DMENU_OPTIONS="xmms vertical resize" . "$UZBL_UTIL_DIR"/dmenu.sh -. "$UZBL_UTIL_DIR"/uzbl-args.sh . "$UZBL_UTIL_DIR"/uzbl-dir.sh [ -r "$UZBL_BOOKMARKS_FILE" ] || exit 1 diff --git a/examples/data/scripts/load_url_from_history.sh b/examples/data/scripts/load_url_from_history.sh index 4499e7f..4782cca 100755 --- a/examples/data/scripts/load_url_from_history.sh +++ b/examples/data/scripts/load_url_from_history.sh @@ -4,7 +4,6 @@ DMENU_SCHEME="history" DMENU_OPTIONS="xmms vertical resize" . "$UZBL_UTIL_DIR"/dmenu.sh -. "$UZBL_UTIL_DIR"/uzbl-args.sh . "$UZBL_UTIL_DIR"/uzbl-dir.sh [ -r "$UZBL_HISTORY_FILE" ] || exit 1 diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index 203cd52..c69b7e3 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -29,7 +29,8 @@ UZBL="uzbl-browser -c $UZBL_CONFIG_FILE" # add custom flags and whatever here. if [ $# -gt 1 ]; then # this script is being run from uzbl, rather than standalone - . "$UZBL_UTIL_DIR"/uzbl-args.sh + # discard the uzbl arguments + shift 7 fi scriptfile=$0 # this script diff --git a/examples/data/scripts/userscript.sh b/examples/data/scripts/userscript.sh index 33a24ae..1e76fd2 100755 --- a/examples/data/scripts/userscript.sh +++ b/examples/data/scripts/userscript.sh @@ -2,13 +2,11 @@ if [ $# = "3" ] then - fifo="$1" - url="$2" - SCRIPT="$3" + UZBL_FIFO=$1 + UZBL_URL=$2 + SCRIPT=$3 else - fifo="$4" - url="$6" - SCRIPT="$8" + SCRIPT=$8 fi # Extract metadata chunk @@ -18,7 +16,7 @@ SHOULD_RUN=false # Assume this script will not be included for INCLUDE in `echo "$META" | grep "^\s*\/\/\s*@include"`; do # Munge into grep pattern INCLUDE="`echo "$INCLUDE" | sed -e 's/^\s*\/\/\s*@include\s*//' -e 's/\./\\\\./g' -e 's/\*/.*/g' -e 's/[\r\n]//g'`" - if echo "$url" | grep -x "$INCLUDE"; then + if echo "$UZBL_URL" | grep -x "$INCLUDE"; then SHOULD_RUN=true break fi @@ -28,7 +26,7 @@ done for EXCLUDE in `echo "$META" | grep "^\s*\/\/\s*@exclude"`; do # Munge into grep pattern EXCLUDE="`echo "$EXCLUDE" | sed -e 's/^\s*\/\/\s*@exclude\s*//' -e 's/\./\\\\./g' -e 's/\*/.*/g' -e 's/[\r\n]//g'`" - if echo "$url" | grep -x "$EXCLUDE"; then + if echo "$UZBL_URL" | grep -x "$EXCLUDE"; then SHOULD_RUN=false break fi @@ -36,5 +34,5 @@ done # Run the script if [ $SHOULD_RUN = true ]; then - echo "script '$SCRIPT'" > "$fifo" + echo "script '$SCRIPT'" > "$UZBL_FIFO" fi diff --git a/examples/data/scripts/userscripts.sh b/examples/data/scripts/userscripts.sh index 8896224..2c66ed8 100755 --- a/examples/data/scripts/userscripts.sh +++ b/examples/data/scripts/userscripts.sh @@ -4,5 +4,5 @@ scripts_dir="$XDG_DATA_HOME/uzbl/userscripts" for SCRIPT in $(grep -rlx "\s*//\s*==UserScript==\s*" "$scripts_dir") do - $XDG_DATA_HOME/uzbl/scripts/userscript.sh "$4" "$6" "$SCRIPT" + $XDG_DATA_HOME/uzbl/scripts/userscript.sh "$UZBL_FIFO" "$UZBL_URL" "$SCRIPT" done diff --git a/examples/data/scripts/util/uzbl-args.sh b/examples/data/scripts/util/uzbl-args.sh deleted file mode 100644 index 7a3dbe5..0000000 --- a/examples/data/scripts/util/uzbl-args.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Arguments from uzbl - -UZBL_CONFIG=$1 -shift -UZBL_PID=$1 -shift -UZBL_XID=$1 -shift -UZBL_FIFO=$1 -shift -UZBL_SOCKET=$1 -shift -UZBL_URL=$1 -shift -UZBL_TITLE=$1 -shift diff --git a/examples/data/scripts/util/uzbl-window.sh b/examples/data/scripts/util/uzbl-window.sh index b2771e4..a7e92eb 100644 --- a/examples/data/scripts/util/uzbl-window.sh +++ b/examples/data/scripts/util/uzbl-window.sh @@ -1,12 +1,6 @@ #!/bin/sh # uzbl window detection -if [ -z "$UZBL_XID" ]; then - echo "Error: UZBL_XID not set" - echo "Please source uzbl-args.sh first" - exit 1 -fi - UZBL_WIN_POS=$(xwininfo -id $UZBL_XID | \ sed -ne 's/Corners:[ ]*[+-]\([0-9]*\)[+-]\([0-9]*\).*$/\1 \2/p') UZBL_WIN_SIZE=$(xwininfo -id $UZBL_XID | \ -- cgit v1.2.3