aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/config
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-01-04 10:50:37 -0700
committerGravatar Brendan Taylor <whateley@gmail.com>2011-01-04 10:50:37 -0700
commit0e40979506f1c82e6cc9182416962370d787e9b3 (patch)
treee1283027fdf4c43a22e50e57f60af83975ca11a9 /examples/config
parent0f3d7ef6f8150e30ebab28895ddb4c4c3beefb8c (diff)
use NEW_WINDOW event in examples that open new windows
Diffstat (limited to 'examples/config')
-rw-r--r--examples/config/config31
1 files changed, 15 insertions, 16 deletions
diff --git a/examples/config/config b/examples/config/config
index f2d55b0..7bc0087 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 ${1:+-u "$1"}' %r
-# Open in current window
+# 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
@@ -186,7 +192,7 @@ set ebind = @mode_bind global,-insert
# --- Mouse bindings ---------------------------------------------------------
# Middle click open in new window
-@bind <Button2> = sh 'if [ "$1" ]; then uzbl-browser -u "$1"; 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 +201,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
@@ -275,18 +281,17 @@ set ebind = @mode_bind global,-insert
@cbind yu = sh 'echo -n "$UZBL_URI" | xclip'
@cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI
@cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip'
-@cbind yY = sh 'echo -n "$1" | 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 +329,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