aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-02-16 21:34:10 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2011-02-16 21:37:24 -0700
commit82fa30898161800e2a4fdc8129d1f99cdd4c545e (patch)
tree56490b47f92508fe8318e94d8e83c4f28515a87d /examples
parent05357cb88daca76428437a960f973f8a4058938f (diff)
formfiller: use the util dir for file location, editor and dmenu config
Diffstat (limited to 'examples')
-rwxr-xr-x[-rw-r--r--]examples/data/scripts/formfiller.sh35
1 files changed, 16 insertions, 19 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 9b35fbe..3dc9dc4 100644..100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -9,29 +9,18 @@
#
action=$1
-shift $#
-keydir=$HOME/etc/uzbl/dforms
+. "$UZBL_UTIL_DIR/uzbl-dir.sh"
+. "$UZBL_UTIL_DIR/editor.sh"
-mkdir -p "$keydir" || exit
-
-Ed () { "${VTERM:-xterm}" -e "${VISUAL:-${EDITOR:-vi}}" "$@"; }
-
-Dmenu ()
-{
- dmenu -p "choose profile" \
- ${DMENU_FONT+-fn "$DMENU_FONT"} \
- -nb "#0f0f0f" -nf "#4e7093" -sb "#003d7c" -sf "#3a9bff" \
- -l 4 \
- "$@"
-}
+mkdir -p "$UZBL_FORMS_DIR" || exit
domain=${UZBL_URI#*://}
domain=${domain%%/*}
test "$domain" || exit
-file=$keydir/$domain
+file=$UZBL_FORMS_DIR/$domain
GenForm ()
{
@@ -48,10 +37,18 @@ GenForm ()
}
GetOption ()
+{
+ DMENU_SCHEME=formfiller
+ DMENU_PROMPT="choose profile"
+ DMENU_LINES=4
+
+ . "$UZBL_UTIL_DIR/dmenu.sh"
+
if [ $(grep -c '^!profile' "$1") -gt 1 ]
- then sed -n 's/^!profile=//p' "$1" | Dmenu
+ then sed -n 's/^!profile=//p' "$1" | $DMENU
else sed -n 's/^!profile=//p' "$1"
fi
+}
ParseProfile ()
{
@@ -100,12 +97,12 @@ New ()
echo '!'
} >> "$file"
chmod 600 "$file"
- Ed "$file"
+ $UZBL_EDITOR "$file"
}
Edit ()
if [ -e "$file" ]
- then Ed "$file"
+ then $UZBL_EDITOR "$file"
else New
fi
@@ -131,7 +128,7 @@ Once ()
GenForm > "$tmpfile"
chmod 600 "$tmpfile"
- Ed "$tmpfile"
+ $UZBL_EDITOR "$tmpfile"
test -e "$tmpfile" &&
ParseFields < "$tmpfile" \