aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config22
-rw-r--r--examples/data/plugins/bind.py8
-rw-r--r--examples/data/plugins/history.py2
-rw-r--r--examples/data/plugins/keycmd.py218
-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
11 files changed, 132 insertions, 183 deletions
diff --git a/examples/config/config b/examples/config/config
index 8ed533f..029ce57 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -91,7 +91,7 @@ set download_handler = sync_spawn @scripts_dir/download.sh
#@on_event CONFIG_CHANGED print Config changed: %1 = %2
# Scroll percentage calculation
-@on_event SCROLL_VERT set scroll_message = \@<(function(){var p='--';if(%3!=%2){p=(%1/(%3-%4));p=Math.round(10000*p)/100;};return p+'%';})()>\@
+@on_event SCROLL_VERT set scroll_message = \@<(function(){var p='--';if(%3<=%4){p=(%1/(%3-%4));p=Math.round(10000*p)/100;};return p+'%';})()>\@
# === Behaviour and appearance ===============================================
@@ -154,15 +154,11 @@ set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname
@modmap <space> <Space>
@modmap <KP_Enter> <Enter>
-#modkey_addition <Key1> <Key2> <Result>
-@modkey_addition <Shift> <Ctrl> <Meta>
-@modkey_addition <Shift> <Tab> <Shift-Tab>
-@modkey_addition <Shift> <Insert> <Shift-Insert>
-
#ignore_key <glob>
@ignore_key <ISO_*>
@ignore_key <Shift>
@ignore_key <Multi_key>
+@ignore_key <Mod2>
# --- Bind aliases -----------------------------------------------------------
@@ -200,7 +196,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
@@ -290,8 +286,8 @@ set ebind = @mode_bind global,-insert
# Use socat to directly inject commands into uzbl-core and view events
# raised by uzbl-core:
-@cbind <Ctrl><Alt>t = sh 'xterm -e "socat unix-connect:\"$UZBL_SOCKET\" -"'
-#@cbind <Ctrl><Alt>t = sh 'urxvt -e socat unix-connect:"$UZBL_SOCKET" -'
+@cbind <Ctrl><Mod1>t = sh 'xterm -e "socat unix-connect:\"$UZBL_SOCKET\" -"'
+#@cbind <Ctrl><Mod1>t = sh 'urxvt -e socat unix-connect:"$UZBL_SOCKET" -'
# Uri opening prompts
@cbind o<uri:>_ = uri %s
@@ -326,7 +322,7 @@ set ebind = @mode_bind global,-insert
# Start a new uzbl instance from the page in primary selection
@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'
@@ -337,6 +333,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
@@ -355,10 +355,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/bind.py b/examples/data/plugins/bind.py
index 69fd863..fc8b392 100644
--- a/examples/data/plugins/bind.py
+++ b/examples/data/plugins/bind.py
@@ -372,11 +372,11 @@ def mode_changed(uzbl, mode):
uzbl.bindlet.reset()
-def match_and_exec(uzbl, bind, depth, keylet, bindlet):
+def match_and_exec(uzbl, bind, depth, modstate, keylet, bindlet):
(on_exec, has_args, mod_cmd, glob, more) = bind[depth]
cmd = keylet.modcmd if mod_cmd else keylet.keycmd
- if mod_cmd and keylet.held != mod_cmd:
+ if mod_cmd and modstate != mod_cmd:
return False
if has_args:
@@ -415,7 +415,7 @@ def match_and_exec(uzbl, bind, depth, keylet, bindlet):
return True
-def key_event(uzbl, keylet, mod_cmd=False, on_exec=False):
+def key_event(uzbl, modstate, keylet, mod_cmd=False, on_exec=False):
bindlet = uzbl.bindlet
depth = bindlet.depth
for bind in bindlet.get_binds():
@@ -423,7 +423,7 @@ def key_event(uzbl, keylet, mod_cmd=False, on_exec=False):
if (bool(t[MOD_CMD]) != mod_cmd) or (t[ON_EXEC] != on_exec):
continue
- if match_and_exec(uzbl, bind, depth, keylet, bindlet):
+ if match_and_exec(uzbl, bind, depth, modstate, keylet, bindlet):
return
bindlet.after()
diff --git a/examples/data/plugins/history.py b/examples/data/plugins/history.py
index 5e9e4e1..f42f86f 100644
--- a/examples/data/plugins/history.py
+++ b/examples/data/plugins/history.py
@@ -83,7 +83,7 @@ class History(object):
def __str__(self):
return "(History %s, %s)" % (self.cursor, self.prompt)
-def keycmd_exec(uzbl, keylet):
+def keycmd_exec(uzbl, modstate, keylet):
cmd = keylet.get_keycmd()
if cmd:
uzbl.history.add(cmd)
diff --git a/examples/data/plugins/keycmd.py b/examples/data/plugins/keycmd.py
index 928c597..1bb70e3 100644
--- a/examples/data/plugins/keycmd.py
+++ b/examples/data/plugins/keycmd.py
@@ -17,13 +17,10 @@ def uzbl_escape(str):
class Keylet(object):
- '''Small per-instance object that tracks all the keys held and characters
- typed.'''
+ '''Small per-instance object that tracks characters typed.'''
def __init__(self):
# Modcmd tracking
- self.held = set()
- self.ignored = set()
self.modcmd = ''
self.is_modcmd = False
@@ -33,7 +30,6 @@ class Keylet(object):
self.modmaps = {}
self.ignores = {}
- self.additions = {}
def get_keycmd(self):
@@ -48,7 +44,7 @@ class Keylet(object):
if not self.is_modcmd:
return ''
- return ''.join(self.held) + self.modcmd
+ return self.modcmd
def modmap_key(self, key):
@@ -65,28 +61,6 @@ class Keylet(object):
return key
- def find_addition(self, modkey):
- '''Key has just been pressed, check if this key + the held list
- results in a modkey addition. Return that addition and remove all
- modkeys that created it.'''
-
- # Intersection of (held list + modkey) and additions.
- added = (self.held | set([modkey])) & set(self.additions.keys())
- for key in added:
- if key == modkey or modkey in self.additions[key]:
- self.held -= self.additions[key]
- return key
-
- # Held list + ignored list + modkey.
- modkeys = self.held | self.ignored | set([modkey])
- for (key, value) in self.additions.items():
- if modkeys.issuperset(value):
- self.held -= value
- return key
-
- return modkey
-
-
def key_ignored(self, key):
'''Check if the given key is ignored by any ignore rules.'''
@@ -104,9 +78,6 @@ class Keylet(object):
if self.is_modcmd:
l.append('modcmd=%r' % self.get_modcmd())
- elif self.held:
- l.append('held=%r' % ''.join(sorted(self.held)))
-
if self.keycmd:
l.append('keycmd=%r' % self.get_keycmd())
@@ -132,10 +103,7 @@ def add_modmap(uzbl, key, map):
assert len(key)
modmaps = uzbl.keylet.modmaps
- if key[0] == "<" and key[-1] == ">":
- key = key[1:-1]
-
- modmaps[key] = map
+ modmaps[key.strip('<>')] = map.strip('<>')
uzbl.event("NEW_MODMAP", key, map)
@@ -171,45 +139,6 @@ def add_key_ignore(uzbl, glob):
uzbl.event('NEW_KEY_IGNORE', glob)
-def add_modkey_addition(uzbl, modkeys, result):
- '''Add a modkey addition definition.
-
- Examples:
- set mod_addition = request MODKEY_ADDITION
- @mod_addition <Shift> <Control> <Meta>
- @mod_addition <Left> <Up> <Left-Up>
- @mod_addition <Right> <Up> <Right-Up>
- ...
-
- Then:
- @bind <Right-Up> = <command1>
- @bind <Meta>o = <command2>
- ...
- '''
-
- additions = uzbl.keylet.additions
- modkeys = set(modkeys)
-
- assert len(modkeys) and result and result not in modkeys
-
- for (existing_result, existing_modkeys) in additions.items():
- if existing_result != result:
- assert modkeys != existing_modkeys
-
- additions[result] = modkeys
- uzbl.event('NEW_MODKEY_ADDITION', modkeys, result)
-
-
-def modkey_addition_parse(uzbl, modkeys):
- '''Parse modkey addition definition.'''
-
- keys = filter(None, map(unicode.strip, modkeys.split(" ")))
- keys = ['<%s>' % key.strip("<>") for key in keys if key.strip("<>")]
-
- assert len(keys) > 1
- add_modkey_addition(uzbl, keys[:-1], keys[-1])
-
-
def clear_keycmd(uzbl, *args):
'''Clear the keycmd for this uzbl instance.'''
@@ -220,15 +149,12 @@ def clear_keycmd(uzbl, *args):
uzbl.event('KEYCMD_CLEARED')
-def clear_modcmd(uzbl, clear_held=False):
+def clear_modcmd(uzbl):
'''Clear the modcmd for this uzbl instance.'''
k = uzbl.keylet
k.modcmd = ''
k.is_modcmd = False
- if clear_held:
- k.ignored = set()
- k.held = set()
del uzbl.config['modcmd']
uzbl.event('MODCMD_CLEARED')
@@ -244,28 +170,22 @@ def clear_current(uzbl):
clear_keycmd(uzbl)
-def focus_changed(uzbl, *args):
- '''Focus to the uzbl instance has now been lost which means all currently
- held keys in the held list will not get a KEY_RELEASE event so clear the
- entire held list.'''
-
- clear_modcmd(uzbl, clear_held=True)
-
-
-def update_event(uzbl, k, execute=True):
+def update_event(uzbl, modstate, k, execute=True):
'''Raise keycmd & modcmd update events.'''
- keycmd, modcmd = k.get_keycmd(), k.get_modcmd()
+ keycmd, modcmd = k.get_keycmd(), ''.join(modstate) + k.get_modcmd()
if k.is_modcmd:
- uzbl.event('MODCMD_UPDATE', k)
+ logger.debug('modcmd_update, %s' % modcmd)
+ uzbl.event('MODCMD_UPDATE', modstate, k)
else:
- uzbl.event('KEYCMD_UPDATE', k)
+ logger.debug('keycmd_update, %s' % keycmd)
+ uzbl.event('KEYCMD_UPDATE', modstate, k)
if uzbl.config.get('modcmd_updates', '1') == '1':
- new_modcmd = k.get_modcmd()
- if not new_modcmd:
+ new_modcmd = ''.join(modstate) + k.get_modcmd()
+ if not new_modcmd or not k.is_modcmd:
del uzbl.config['modcmd']
elif new_modcmd == modcmd:
@@ -293,54 +213,38 @@ def inject_str(str, index, inj):
return "%s%s%s" % (str[:index], inj, str[index:])
-def get_keylet_and_key(uzbl, key, add=True):
- '''Return the keylet and apply any transformations to the key as defined
- by the modmapping or modkey addition rules. Return None if the key is
- ignored.'''
-
+def parse_key_event(uzbl, key):
+ ''' Build a set from the modstate part of the event, and pass all keys through modmap '''
keylet = uzbl.keylet
- key = keylet.modmap_key(key)
- if len(key) == 1:
- return (keylet, key)
-
- modkey = "<%s>" % key.strip("<>")
-
- if keylet.key_ignored(modkey):
- if add:
- keylet.ignored.add(modkey)
-
- elif modkey in keylet.ignored:
- keylet.ignored.remove(modkey)
- modkey = keylet.find_addition(modkey)
-
- if keylet.key_ignored(modkey):
- return (keylet, None)
-
- return (keylet, modkey)
+ modstate, key = splitquoted(key)
+ modstate = set(['<%s>' % keylet.modmap_key(k) for k in modstate.split('|') if k])
+
+ key = keylet.modmap_key(key)
+ return modstate, key
def key_press(uzbl, key):
'''Handle KEY_PRESS events. Things done by this function include:
1. Ignore all shift key presses (shift can be detected by capital chars)
- 3. In non-modcmd mode:
+ 2. In non-modcmd mode:
a. append char to keycmd
- 4. If not in modcmd mode and a modkey was pressed set modcmd mode.
- 5. If in modcmd mode the pressed key is added to the held keys list.
- 6. Keycmd is updated and events raised if anything is changed.'''
+ 3. If not in modcmd mode and a modkey was pressed set modcmd mode.
+ 4. Keycmd is updated and events raised if anything is changed.'''
- (k, key) = get_keylet_and_key(uzbl, key.strip())
- if not key:
- return
+ k = uzbl.keylet
+ modstate, key = parse_key_event(uzbl, key)
+ k.is_modcmd = any(not k.key_ignored(m) for m in modstate)
- if key.lower() == '<space>' and not k.held and k.keycmd:
+ logger.debug('key press modstate=%s' % str(modstate))
+ if key.lower() == 'space' and not k.is_modcmd and k.keycmd:
k.keycmd = inject_str(k.keycmd, k.cursor, ' ')
k.cursor += 1
- elif not k.held and len(key) == 1:
-
+ elif not k.is_modcmd and len(key) == 1:
if uzbl.config.get('keycmd_events', '1') != '1':
+ # TODO, make a note on what's going on here
k.keycmd = ''
k.cursor = 0
del uzbl.config['keycmd']
@@ -349,33 +253,29 @@ def key_press(uzbl, key):
k.keycmd = inject_str(k.keycmd, k.cursor, key)
k.cursor += 1
- elif len(key) > 1:
- k.is_modcmd = True
- if key not in k.held:
- k.held.add(key)
+ elif len(key) == 1:
+ k.modcmd += key
else:
- k.is_modcmd = True
- k.modcmd += key
+ if not k.key_ignored('<%s>' % key):
+ modstate.add('<%s>' % key)
+ k.is_modcmd = True
- update_event(uzbl, k)
+ update_event(uzbl, modstate, k)
def key_release(uzbl, key):
'''Respond to KEY_RELEASE event. Things done by this function include:
- 1. Remove the key from the keylet held list.
- 2. If in a mod-command then raise a MODCMD_EXEC.
- 3. Check if any modkey is held, if so set modcmd mode.
- 4. Update the keycmd uzbl variable if anything changed.'''
-
- (k, key) = get_keylet_and_key(uzbl, key.strip(), add=False)
+ 1. If in a mod-command then raise a MODCMD_EXEC.
+ 2. Update the keycmd uzbl variable if anything changed.'''
+ k = uzbl.keylet
+ modstate, key = parse_key_event(uzbl, key)
- if key in k.held:
+ if len(key) > 1:
if k.is_modcmd:
- uzbl.event('MODCMD_EXEC', k)
+ uzbl.event('MODCMD_EXEC', modstate, k)
- k.held.remove(key)
clear_modcmd(uzbl)
@@ -385,7 +285,7 @@ def set_keycmd(uzbl, keycmd):
k = uzbl.keylet
k.keycmd = keycmd
k.cursor = len(keycmd)
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
def inject_keycmd(uzbl, keycmd):
@@ -394,7 +294,7 @@ def inject_keycmd(uzbl, keycmd):
k = uzbl.keylet
k.keycmd = inject_str(k.keycmd, k.cursor, keycmd)
k.cursor += len(keycmd)
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
def append_keycmd(uzbl, keycmd):
@@ -403,23 +303,29 @@ def append_keycmd(uzbl, keycmd):
k = uzbl.keylet
k.keycmd += keycmd
k.cursor = len(k.keycmd)
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), 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)
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
def keycmd_backspace(uzbl, *args):
@@ -431,7 +337,7 @@ def keycmd_backspace(uzbl, *args):
k.keycmd = k.keycmd[:k.cursor-1] + k.keycmd[k.cursor:]
k.cursor -= 1
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
def keycmd_delete(uzbl, *args):
@@ -442,14 +348,14 @@ def keycmd_delete(uzbl, *args):
return
k.keycmd = k.keycmd[:k.cursor] + k.keycmd[k.cursor+1:]
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
def keycmd_exec_current(uzbl, *args):
'''Raise a KEYCMD_EXEC with the current keylet and then clear the
keycmd.'''
- uzbl.event('KEYCMD_EXEC', uzbl.keylet)
+ uzbl.event('KEYCMD_EXEC', set(), uzbl.keylet)
clear_keycmd(uzbl)
@@ -476,7 +382,7 @@ def set_cursor_pos(uzbl, index):
cursor = len(k.keycmd)
k.cursor = cursor
- update_event(uzbl, k, False)
+ update_event(uzbl, set(), k, False)
# plugin init hook
@@ -485,8 +391,6 @@ def init(uzbl):
connect_dict(uzbl, {
'APPEND_KEYCMD': append_keycmd,
- 'FOCUS_GAINED': focus_changed,
- 'FOCUS_LOST': focus_changed,
'IGNORE_KEY': add_key_ignore,
'INJECT_KEYCMD': inject_keycmd,
'KEYCMD_BACKSPACE': keycmd_backspace,
@@ -496,7 +400,8 @@ def init(uzbl):
'KEYCMD_CLEAR': clear_keycmd,
'KEY_PRESS': key_press,
'KEY_RELEASE': key_release,
- 'MODKEY_ADDITION': modkey_addition_parse,
+ 'MOD_PRESS': key_press,
+ 'MOD_RELEASE': key_release,
'MODMAP': modmap_parse,
'SET_CURSOR_POS': set_cursor_pos,
'SET_KEYCMD': set_keycmd,
@@ -504,7 +409,6 @@ def init(uzbl):
export_dict(uzbl, {
'add_key_ignore': add_key_ignore,
- 'add_modkey_addition': add_modkey_addition,
'add_modmap': add_modmap,
'append_keycmd': append_keycmd,
'clear_current': clear_current,
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"