aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Ben Boeckel <mathstuf@gmail.com>2011-03-07 13:19:18 -0500
committerGravatar Brendan Taylor <whateley@gmail.com>2011-04-12 21:05:10 -0600
commiteb00f99bc300fc902beaeaa5385f5994ce904cdc (patch)
tree203b288d8a19f2caa364436dc9ff940be994f37f /examples
parented8f45d6eb21e5a931d55235708bcc73a2191771 (diff)
Add utils to load/save temporary URLs for later
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config4
-rwxr-xr-xexamples/data/scripts/insert_temp.sh8
-rwxr-xr-xexamples/data/scripts/load_url_from_temps.sh23
-rw-r--r--examples/data/scripts/util/dmenu.sh7
-rw-r--r--examples/data/scripts/util/uzbl-dir.sh1
5 files changed, 43 insertions, 0 deletions
diff --git a/examples/config/config b/examples/config/config
index d049f0e..7a4c685 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -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
diff --git a/examples/data/scripts/insert_temp.sh b/examples/data/scripts/insert_temp.sh
new file mode 100755
index 0000000..a67b645
--- /dev/null
+++ b/examples/data/scripts/insert_temp.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. "$UZBL_UTIL_DIR/uzbl-dir.sh"
+. "$UZBL_UTIL_DIR/uzbl-util.sh"
+
+>> "$UZBL_TEMPS_FILE" || exit 1
+
+print "$UZBL_URI $UZBL_TITLE\n" >> "$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..9788b0f
--- /dev/null
+++ b/examples/data/scripts/load_url_from_temps.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+DMENU_SCHEME="temps"
+DMENU_OPTIONS="xmms vertical resize"
+
+. "$UZBL_UTIL_DIR/dmenu.sh"
+. "$UZBL_UTIL_DIR/uzbl-dir.sh"
+. "$UZBL_UTIL_DIR/uzbl-util.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" ] && print "uri $goto\n" > "$UZBL_FIFO"
+#[ -n "$goto" ] && print "uri $goto\n" | 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"