aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/follow.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/data/scripts/follow.sh')
-rwxr-xr-xexamples/data/scripts/follow.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh
new file mode 100755
index 0000000..2d666a2
--- /dev/null
+++ b/examples/data/scripts/follow.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# This script is just a wrapper around follow.js that lets us change uzbl's mode
+# after a link is selected.
+
+shift 7
+
+# 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