diff options
author | Brendan Taylor <whateley@gmail.com> | 2010-11-24 15:13:02 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2010-11-24 15:13:02 -0700 |
commit | b5b38b968697becad4034b5803d39ff6c78aa107 (patch) | |
tree | 4160a304f1dde3d728b39aa0c6ff107cb9951041 /examples/data/scripts/follow.sh | |
parent | 3659b1d8bc32956d1be5e25a6c30a085953f0435 (diff) |
make follow.sh use the utils scripts, restore mode changing functionality
Diffstat (limited to 'examples/data/scripts/follow.sh')
-rwxr-xr-x | examples/data/scripts/follow.sh | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index ba59575..c8ded84 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -1,21 +1,23 @@ #!/bin/sh -config=$1; -shift -pid=$1; -shift -xid=$1; -shift -fifo=$1; -shift -socket=$1; -shift -url=$1; -shift -title=$1; -shift +# This script is just a wrapper around follow.js that lets us change uzbl's mode +# after a link is selected. -case $(echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' | socat - unix-connect:$socket) in - *XXXEMIT_FORM_ACTIVEXXX*) echo 'event FORM_ACTIVE' | socat - unix-connect:$socket ;; - *XXXRESET_MODEXXX*) echo 'set mode=' | socat - unix-connect:$socket ;; +. "$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 + echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' > "$UZBL_FIFO" + exit +fi + +result=$(echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' | socat - unix-connect:"$UZBL_SOCKET") +case $result in + *XXXEMIT_FORM_ACTIVEXXX*) + # a form element was selected + echo 'event FORM_ACTIVE' > "$UZBL_FIFO" ;; + *XXXRESET_MODEXXX*) + # a link was selected, reset uzbl's input mode + echo 'set mode=' > "$UZBL_FIFO" ;; esac |