aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config40
-rwxr-xr-xexamples/data/scripts/auth.py2
-rwxr-xr-xexamples/data/scripts/download.sh1
-rwxr-xr-xexamples/data/scripts/follow.sh2
-rwxr-xr-xexamples/data/scripts/formfiller.sh2
-rwxr-xr-xexamples/data/scripts/load_cookies.sh4
-rwxr-xr-xexamples/data/scripts/per-site-settings.py2
-rwxr-xr-xexamples/data/scripts/scheme.py2
-rwxr-xr-xexamples/data/scripts/session.sh6
-rw-r--r--examples/data/scripts/util/dmenu.sh12
-rwxr-xr-xexamples/data/scripts/uzbl-tabbed4
11 files changed, 37 insertions, 40 deletions
diff --git a/examples/config/config b/examples/config/config
index 96b2034..a2ecdb8 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -48,13 +48,19 @@ set download_handler = sync_spawn @scripts_dir/download.sh
# === Dynamic event handlers =================================================
+# What to do when a website wants to open a new window:
# Open link in new window
-@on_event NEW_WINDOW sh 'uzbl-browser ${8:+-u "$8"}' %r
-# Open in current window
+@on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r
+# Open in current window (also see the REQ_NEW_WINDOW event handler below)
#@on_event NEW_WINDOW uri %s
-# Open in new tab
+# Open in new tab. Other options are NEW_TAB_NEXT, NEW_BG_TAB and NEW_BG_TAB_NEXT.
#@on_event NEW_WINDOW event NEW_TAB %s
+# What to do when the user requests a new window:
+# If your the NEW_WINDOW handler opens the uri in the current window, you'll
+# probably want to change this handler to open a new window or tab.
+@on_event REQ_NEW_WINDOW event NEW_WINDOW %s
+
# Load start handler
@on_event LOAD_START @set_status <span foreground="khaki">wait</span>
# Reset the keycmd on navigation
@@ -105,7 +111,8 @@ set selected_section = <span foreground="#606060">\@[\@SELECTED_URI]\@</span>
set download_section = <span foreground="white">\@downloads</span>
-set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section @download_section</span>
+set status_format = <span font_family="monospace">@mode_section @keycmd_section @progress_section @name_section @status_section @scroll_section @selected_section @download_section</span>
+set status_format_right = <span font_family="monospace"><span foreground="#666">uri:</span> @uri_section</span>
set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI
@@ -119,7 +126,7 @@ set progress.pending =
# === Useragent setup ========================================================
-set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}.@{WEBKIT_MICRO}) (@(+uname -sm)@ [@ARCH_UZBL]) (Commit @COMMIT)
+set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname -sm)@ [@ARCH_UZBL])
# === Configure cookie blacklist ========================================================
# Drop google analytics tracking cookies
@@ -186,7 +193,7 @@ set ebind = @mode_bind global,-insert
# --- Mouse bindings ---------------------------------------------------------
# Middle click open in new window
-@bind <Button2> = sh 'if [ "$8" ]; then uzbl-browser -u "$8"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' \@SELECTED_URI
+@bind <Button2> = sh 'if [ "$1" ]; then echo "event REQ_NEW_WINDOW $1" > "$UZBL_FIFO"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI'
# --- Keyboard bindings ------------------------------------------------------
@@ -195,7 +202,7 @@ set ebind = @mode_bind global,-insert
@cbind :_ = %s
# open a new window or a new tab (see the on_event NEW_WINDOW settings above)
-@cbind w = event NEW_WINDOW
+@cbind w = event REQ_NEW_WINDOW
# Page movement binds
@cbind j = scroll vertical 20
@@ -273,20 +280,19 @@ set ebind = @mode_bind global,-insert
# Yanking & pasting binds
@cbind yu = sh 'echo -n "$UZBL_URI" | xclip'
-@cbind yU = sh 'echo -n $8 | xclip' \@SELECTED_URI
+@cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI
@cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip'
-@cbind yY = sh 'echo -n $8 | xclip' \@SELECTED_URI
# Clone current window
-@cbind c = sh 'uzbl-browser -u "$UZBL_URI"'
+@cbind c = event REQ_NEW_WINDOW \@uri
# Go the page from primary selection
-@cbind p = sh 'echo "uri `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@cbind p = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Go to the page in clipboard
-@cbind P = sh 'echo "uri `xclip -selection clipboard -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@cbind P = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Start a new uzbl instance from the page in primary selection
-@cbind 'p = sh 'exec uzbl-browser --uri "$(xclip -o)"'
+@cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"'
# paste primary selection into keycmd at the cursor position
-@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD `xclip -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
+@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Bookmark inserting binds
@cbind <Ctrl>b<tags:>_ = sh 'echo `printf "$UZBL_URI %s"` >> "$XDG_DATA_HOME"/uzbl/bookmarks'
@@ -324,12 +330,6 @@ set formfiller = spawn @scripts_dir/formfiller.sh
@cbind gN = event NEW_TAB_NEXT
@cbind go<uri:>_ = event NEW_TAB %s
@cbind gO<uri:>_ = event NEW_TAB_NEXT %s
-@cbind gy = sh 'echo "event NEW_TAB `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
-@cbind gY = sh 'echo "event NEW_TAB_NEXT `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"'
-
-# Clone current tab
-@cbind gd = sh 'echo "event NEW_TAB $UZBL_URI" > "$UZBL_FIFO"'
-@cbind gD = sh 'echo "event NEW_TAB_NEXT $UZBL_URI" > "$UZBL_FIFO"'
# Closing / resting
@cbind gC = exit
diff --git a/examples/data/scripts/auth.py b/examples/data/scripts/auth.py
index 9c1b4fc..592a2c6 100755
--- a/examples/data/scripts/auth.py
+++ b/examples/data/scripts/auth.py
@@ -46,7 +46,7 @@ def getText(authInfo, authHost, authRealm):
return rv, output
if __name__ == '__main__':
- rv, output = getText(sys.argv[8], sys.argv[9], sys.argv[10])
+ rv, output = getText(sys.argv[1], sys.argv[2], sys.argv[3])
if (rv == gtk.RESPONSE_OK):
print output;
else:
diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh
index df7a571..c410ad2 100755
--- a/examples/data/scripts/download.sh
+++ b/examples/data/scripts/download.sh
@@ -6,7 +6,6 @@
# that path.
# if nothing is printed to stdout, the download will be cancelled.
-shift 7
. $UZBL_UTIL_DIR/uzbl-dir.sh
# the URL that is being downloaded
diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh
index 2d666a2..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.
-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
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 6e04573..c6822e6 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -53,8 +53,6 @@ MODELINE="> vim:ft=formfiller"
[ -d "$(dirname $UZBL_FORMS_DIR)" ] || exit 1
[ -d $UZBL_FORMS_DIR ] || mkdir $UZBL_FORMS_DIR || exit 1
-shift 7
-
action=$1
domain=$(echo $UZBL_URI | sed 's/\(http\|https\):\/\/\([^\/]\+\)\/.*/\2/')
diff --git a/examples/data/scripts/load_cookies.sh b/examples/data/scripts/load_cookies.sh
index f4c6886..17ec2ad 100755
--- a/examples/data/scripts/load_cookies.sh
+++ b/examples/data/scripts/load_cookies.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-if [ "$8" != "" ]; then
- cookie_file=$8
+if [ "$1" != "" ]; then
+ cookie_file=$1
else
cookie_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/cookies.txt
fi
diff --git a/examples/data/scripts/per-site-settings.py b/examples/data/scripts/per-site-settings.py
index febfd0f..89df4e6 100755
--- a/examples/data/scripts/per-site-settings.py
+++ b/examples/data/scripts/per-site-settings.py
@@ -100,7 +100,7 @@ def write_to_socket(commands, sockpath):
if __name__ == '__main__':
sockpath = os.environ['UZBL_SOCKET']
url = urlparse.urlparse(os.environ['UZBL_URI'])
- filepath = sys.argv[8]
+ filepath = sys.argv[1]
mode = os.stat(filepath)[stat.ST_MODE]
diff --git a/examples/data/scripts/scheme.py b/examples/data/scripts/scheme.py
index 0916466..4b0b7ca 100755
--- a/examples/data/scripts/scheme.py
+++ b/examples/data/scripts/scheme.py
@@ -13,7 +13,7 @@ def detach_open(cmd):
print 'USED'
if __name__ == '__main__':
- uri = sys.argv[8]
+ uri = sys.argv[1]
u = urlparse.urlparse(uri)
if u.scheme == 'mailto':
detach_open(['xterm', '-e', 'mail', u.path])
diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh
index 36e0c19..ee09cf2 100755
--- a/examples/data/scripts/session.sh
+++ b/examples/data/scripts/session.sh
@@ -30,12 +30,6 @@ fi
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
- # discard the uzbl arguments
- shift 7
-fi
-
scriptfile=$(readlink -f $0) # this script
act="$1"
diff --git a/examples/data/scripts/util/dmenu.sh b/examples/data/scripts/util/dmenu.sh
index da61cae..354d7d1 100644
--- a/examples/data/scripts/util/dmenu.sh
+++ b/examples/data/scripts/util/dmenu.sh
@@ -60,10 +60,16 @@ fi
if dmenu --help 2>&1 | grep -q '\[-xs\]'; then
DMENU_XMMS_ARGS="-xs"
DMENU_HAS_XMMS=1
+fi
- if echo $DMENU_OPTIONS | grep -q -w 'xmms'; then
- DMENU_ARGS="$DMENU_ARGS $DMENU_XMMS_ARGS"
- fi
+# Detect the tok patch
+if dmenu --help 2>&1 | grep -q '\[-t\]'; then
+ DMENU_XMMS_ARGS="-t"
+ DMENU_HAS_XMMS=1
+fi
+
+if echo $DMENU_OPTIONS | grep -q -w 'xmms'; then
+ DMENU_ARGS="$DMENU_ARGS $DMENU_XMMS_ARGS"
fi
# Detect the vertical patch
diff --git a/examples/data/scripts/uzbl-tabbed b/examples/data/scripts/uzbl-tabbed
index 0086c04..1d64436 100755
--- a/examples/data/scripts/uzbl-tabbed
+++ b/examples/data/scripts/uzbl-tabbed
@@ -452,7 +452,7 @@ class UzblInstance:
type, args = args.split(" ", 1)
if type == "TITLE_CHANGED":
self.title = args.strip()
- self.title_changed()
+ self.title_changed(False)
elif type == "VARIABLE_SET":
var, _, val = args.split(" ", 2)
@@ -485,6 +485,8 @@ class UzblInstance:
if var == "uri":
self.uri = val.strip()
self.parent.update_tablist()
+ elif type == "LOAD_COMMIT":
+ self.uri = args
elif type == "NEW_TAB":
self.parent.new_tab(args)
elif type == "NEW_BG_TAB":