aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-03 21:41:51 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-11-03 21:41:51 +0800
commitcbee561dbb20bd79a524b29b90802004f78e47d3 (patch)
tree4572c9b503902a6b140f3c6da5e3c8c78a6b0862 /examples
parent7050a3e097a37df80285aa91b9c3da269e3c8ac9 (diff)
parentf9bb1855e4839675ac39eecbfba77dfffcdf36cb (diff)
Merge branch 'prompt' of git://github.com/keis/uzbl into prompt
Diffstat (limited to 'examples')
-rw-r--r--examples/config/uzbl/config1
-rw-r--r--examples/data/uzbl/plugins/bind.py15
2 files changed, 11 insertions, 5 deletions
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config
index d72be2c..4b04d7a 100644
--- a/examples/config/uzbl/config
+++ b/examples/config/uzbl/config
@@ -197,6 +197,7 @@ set formfiller = spawn @scripts_dir/formfiller
# Examples using multi-stage-bindings with text prompts.
@bind o<uri:>_ = uri %s
+@bind O<uri:"\@uri">_ = uri %s
# multi-stage binding way to write bookmarks to file from inside uzbl.
@bind <Ctrl>b<tags:>_ = sh 'echo -e "$6 %s" >> $XDG_DATA_HOME/uzbl/bookmarks'
diff --git a/examples/data/uzbl/plugins/bind.py b/examples/data/uzbl/plugins/bind.py
index 8c932be..356b6bd 100644
--- a/examples/data/uzbl/plugins/bind.py
+++ b/examples/data/uzbl/plugins/bind.py
@@ -21,7 +21,7 @@ UZBLS = {}
# Commonly used regular expressions.
starts_with_mod = re.compile('^<([A-Z][A-Za-z0-9-_]*)>')
-find_prompts = re.compile('<([^:>]*):>').split
+find_prompts = re.compile('<([^:>]*):(\"[^>]*\"|)>').split
# For accessing a bind glob stack.
MOD_CMD, ON_EXEC, HAS_ARGS, GLOB, MORE = range(5)
@@ -159,22 +159,22 @@ class Bind(object):
self.bid = self.nextbid()
self.split = split = find_prompts(glob)
- self.prompts = split[1::2]
+ self.prompts = zip(split[1::3],[x.strip('"') for x in split[2::3]])
# Check that there is nothing like: fl*<int:>*
- for glob in split[:-1:2]:
+ for glob in split[:-1:3]:
if glob.endswith('*'):
msg = "token '*' not at the end of a prompt bind: %r" % split
raise BindParseError(msg)
# Check that there is nothing like: fl<prompt1:><prompt2:>_
- for glob in split[2::2]:
+ for glob in split[3::3]:
if not glob:
msg = 'found null segment after first prompt: %r' % split
raise BindParseError(msg)
stack = []
- for (index, glob) in enumerate(reversed(split[::2])):
+ for (index, glob) in enumerate(reversed(split[::3])):
# Is the binding a MODCMD or KEYCMD:
mod_cmd = ismodbind(glob)
@@ -282,6 +282,7 @@ def parse_bind_event(uzbl, args):
def set_stack_mode(uzbl, prompt):
+ prompt,data = prompt
if uzbl.get_mode() != 'stack':
uzbl.set_mode('stack')
@@ -290,6 +291,10 @@ def set_stack_mode(uzbl, prompt):
uzbl.set('keycmd_prompt', prompt)
+ if data:
+ # go through uzbl-core to expand potential @-variables
+ uzbl.send('event SET_KEYCMD %s' % data)
+
def clear_stack(uzbl, mode):
bind_dict = get_bind_dict(uzbl)