aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config8
-rw-r--r--examples/data/plugins/keycmd.py14
-rwxr-xr-xexamples/data/scripts/auth.py2
-rwxr-xr-xexamples/data/scripts/download.sh14
-rwxr-xr-xexamples/data/scripts/formfiller.sh12
-rwxr-xr-xexamples/data/scripts/insert_temp.sh7
-rwxr-xr-xexamples/data/scripts/load_url_from_temps.sh22
-rw-r--r--examples/data/scripts/util/dmenu.sh7
-rw-r--r--examples/data/scripts/util/uzbl-dir.sh1
9 files changed, 71 insertions, 16 deletions
diff --git a/examples/config/config b/examples/config/config
index ab7a7da..06cbea0 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -200,7 +200,7 @@ set ebind = @mode_bind global,-insert
@ebind <Delete> = event KEYCMD_DELETE
@ebind <Tab> = event START_COMPLETION
# Readline-ish bindings.
-@ebind <Ctrl>w = event KEYCMD_STRIP_WORD
+@ebind <Ctrl>w = event KEYCMD_STRIP_WORD \ -./&?=
@ebind <Ctrl>u = event SET_KEYCMD
@ebind <Ctrl>a = event SET_CURSOR_POS 0
@ebind <Ctrl>e = event SET_CURSOR_POS -1
@@ -337,6 +337,10 @@ set ebind = @mode_bind global,-insert
@cbind U = spawn @scripts_dir/load_url_from_history.sh
@cbind u = spawn @scripts_dir/load_url_from_bookmarks.sh
+# Temporary bookmarks
+@cbind <Ctrl>d = spawn @scripts_dir/insert_temp.sh
+@cbind D = spawn @scripts_dir/load_url_from_temps.sh
+
# Link following (similar to vimperator and konqueror)
# Set custom keys you wish to use for navigation. Some common examples:
set follow_hint_keys = 0123456789
@@ -353,10 +357,10 @@ set follow_hint_keys = 0123456789
# This implementation allows you to save multiple profiles for each form
# (think about multiple accounts on some website).
set formfiller = spawn @scripts_dir/formfiller.sh
-@cbind za = @formfiller add
@cbind ze = @formfiller edit
@cbind zn = @formfiller new
@cbind zl = @formfiller load
+@cbind zo = @formfiller once
# --- Uzbl tabbed binds ------------------------------------------------------
diff --git a/examples/data/plugins/keycmd.py b/examples/data/plugins/keycmd.py
index 928c597..76e2d75 100644
--- a/examples/data/plugins/keycmd.py
+++ b/examples/data/plugins/keycmd.py
@@ -406,16 +406,22 @@ def append_keycmd(uzbl, keycmd):
update_event(uzbl, k, False)
-def keycmd_strip_word(uzbl, sep):
+def keycmd_strip_word(uzbl, seps):
''' Removes the last word from the keycmd, similar to readline ^W '''
- sep = sep or ' '
+ seps = seps or ' '
k = uzbl.keylet
if not k.keycmd:
return
- head, tail = k.keycmd[:k.cursor].rstrip(sep), k.keycmd[k.cursor:]
- rfind = head.rfind(sep)
+ head, tail = k.keycmd[:k.cursor].rstrip(seps), k.keycmd[k.cursor:]
+ rfind = -1
+ for sep in seps:
+ p = head.rfind(sep)
+ if p >= 0 and rfind < p + 1:
+ rfind = p + 1
+ if rfind == len(head) and head[-1] in seps:
+ rfind -= 1
head = head[:rfind] if rfind + 1 else ''
k.keycmd = head + tail
k.cursor = len(head)
diff --git a/examples/data/scripts/auth.py b/examples/data/scripts/auth.py
index 592a2c6..49fa41e 100755
--- a/examples/data/scripts/auth.py
+++ b/examples/data/scripts/auth.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
import gtk
import sys
diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh
index fe566ed..dbc9caf 100755
--- a/examples/data/scripts/download.sh
+++ b/examples/data/scripts/download.sh
@@ -1,9 +1,17 @@
#!/bin/sh
# uzbl's example configuration sets this script up as its download_handler.
-# when uzbl starts a download it runs this script.
+# this script is run when uzbl encounters a URL that it can't display, and when
+# a download is requested using the 'download' command.
+#
# if the script prints a file path to stdout, uzbl will save the download to
-# that path.
-# if nothing is printed to stdout, the download will be cancelled.
+# that path using it's internal downloader.
+#
+# if nothing is printed to stdout, the internal download will be cancelled.
+# you could do your own download handling in your script that way.
+
+# if $5 is set, it is the path that was passed to uzbl's "download" command.
+# we want to use that if it's available.
+[ -n "$5" ] && echo "$5" && exit
. "$UZBL_UTIL_DIR/uzbl-dir.sh"
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 3dc9dc4..c1171a0 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -66,22 +66,22 @@ ParseFields ()
field = $0
sub ( /[^:]*:/, "", field )
- if ( parts[2] ~ /(text|password|search)/ )
+ if ( parts[2] ~ /^(text|password|search)$/ )
printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n",
parts[1], parts[2], field )
- else if ( parts[2] ~ /(checkbox|radio)/ )
+ else if ( parts[2] ~ /^(checkbox|radio)$/ )
printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",%s);\n",
parts[1], parts[2], parts[3], field )
- else if ( parts[2] == "textarea" ) {
+ else if ( parts[2] ~ /^textarea$/ ) {
field = ""
while (getline) {
if ( /^%/ ) break
sub ( /^\\/, "" )
gsub ( /"/, "\\\"" )
gsub ( /\\/, "\\\\" )
- field = field $0 "\\n"
+ field = field $0 "\\\\n"
}
printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n",
parts[1], parts[2], field )
@@ -116,7 +116,7 @@ Load ()
ParseProfile $option < "$file" \
| ParseFields \
- | sed 's/@/\\@/' \
+ | sed 's/@/\\@/g' \
> "$UZBL_FIFO"
}
@@ -132,7 +132,7 @@ Once ()
test -e "$tmpfile" &&
ParseFields < "$tmpfile" \
- | sed 's/@/\\@' \
+ | sed 's/@/\\@/g' \
> "$UZBL_FIFO"
}
diff --git a/examples/data/scripts/insert_temp.sh b/examples/data/scripts/insert_temp.sh
new file mode 100755
index 0000000..7ed8d22
--- /dev/null
+++ b/examples/data/scripts/insert_temp.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+. "$UZBL_UTIL_DIR/uzbl-dir.sh"
+
+>> "$UZBL_TEMPS_FILE" || exit 1
+
+echo "$UZBL_URI $UZBL_TITLE" >> "$UZBL_TEMPS_FILE"
diff --git a/examples/data/scripts/load_url_from_temps.sh b/examples/data/scripts/load_url_from_temps.sh
new file mode 100755
index 0000000..b46687b
--- /dev/null
+++ b/examples/data/scripts/load_url_from_temps.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+DMENU_SCHEME="temps"
+DMENU_OPTIONS="xmms vertical resize"
+
+. "$UZBL_UTIL_DIR/dmenu.sh"
+. "$UZBL_UTIL_DIR/uzbl-dir.sh"
+
+[ -r "$UZBL_TEMPS_FILE" ] || exit 1
+
+if [ -z "$DMENU_HAS_VERTICAL" ]; then
+ # because they are all after each other, just show the url, not their titles.
+ goto=$( awk '{ print $1 }' "$UZBL_TEMPS_FILE" | $DMENU )
+else
+ # show titles
+ goto=$( $DMENU < "$UZBL_TEMPS_FILE" | cut -d ' ' -f 1 )
+fi
+
+sed -i -e "\<^$goto <d" $UZBL_TEMPS_FILE
+
+[ -n "$goto" ] && echo "uri $goto" > "$UZBL_FIFO"
+#[ -n "$goto" ] && echo "uri $goto" | socat - "unix-connect:$UZBL_SOCKET"
diff --git a/examples/data/scripts/util/dmenu.sh b/examples/data/scripts/util/dmenu.sh
index f0d1651..0b7272e 100644
--- a/examples/data/scripts/util/dmenu.sh
+++ b/examples/data/scripts/util/dmenu.sh
@@ -30,6 +30,13 @@ case "$DMENU_SCHEME" in
SB="#ccffaa"
SF="#303030"
;;
+ # Temps
+ "temps" )
+ NB="#303030"
+ NF="khaki"
+ SB="#ccffaa"
+ SF="#303030"
+ ;;
# Default
* )
NB="#303030"
diff --git a/examples/data/scripts/util/uzbl-dir.sh b/examples/data/scripts/util/uzbl-dir.sh
index 3d28151..82510d8 100644
--- a/examples/data/scripts/util/uzbl-dir.sh
+++ b/examples/data/scripts/util/uzbl-dir.sh
@@ -15,5 +15,6 @@ UZBL_FORMS_DIR="$UZBL_DATA_DIR/dforms"
UZBL_CONFIG_FILE="$UZBL_CONFIG_DIR/config"
UZBL_COOKIE_FILE="$UZBL_DATA_DIR/cookies.txt"
UZBL_BOOKMARKS_FILE="$UZBL_DATA_DIR/bookmarks"
+UZBL_TEMPS_FILE="$UZBL_DATA_DIR/temps"
UZBL_HISTORY_FILE="$UZBL_DATA_DIR/history"
UZBL_SESSION_FILE="$UZBL_DATA_DIR/browser-session"