diff options
author | 2009-11-03 16:38:16 +0100 | |
---|---|---|
committer | 2009-11-03 16:38:16 +0100 | |
commit | 1551b09aebc2d426b109638657b706ead38c3e19 (patch) | |
tree | 3ad736ba5398dc1ac3e8d7127977cfc83a22f56a | |
parent | 75e07e0b666fef7947c9b81caf13743577ac725b (diff) | |
parent | 2dcf30f60e9e8381fc7ccca92dbf4490e33d55ed (diff) |
Merge branch 'experimental' of git://github.com/mason-larobina/uzbl into experimental
-rw-r--r-- | examples/config/uzbl/config | 1 | ||||
-rw-r--r-- | examples/data/uzbl/plugins/bind.py | 21 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/event_manager.py | 7 | ||||
-rwxr-xr-x | uzbl-browser | 18 |
4 files changed, 30 insertions, 17 deletions
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index d72be2c..57d1ea5 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..b8494fe 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,28 @@ class Bind(object): self.bid = self.nextbid() self.split = split = find_prompts(glob) - self.prompts = split[1::2] + self.prompts = [] + for (prompt, set) in zip(split[1::3], split[2::3]): + if set and set[0] == set[-1] and set[0] in ['"', "'"]: + # Remove quotes around set. + set = set[1:-1] + + self.prompts.append((prompt, set)) # 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 +288,7 @@ def parse_bind_event(uzbl, args): def set_stack_mode(uzbl, prompt): + prompt, set = prompt if uzbl.get_mode() != 'stack': uzbl.set_mode('stack') @@ -290,6 +297,10 @@ def set_stack_mode(uzbl, prompt): uzbl.set('keycmd_prompt', prompt) + if set: + # Go through uzbl-core to expand potential @-variables + uzbl.send('event SET_KEYCMD %s' % set) + def clear_stack(uzbl, mode): bind_dict = get_bind_dict(uzbl) diff --git a/examples/data/uzbl/scripts/event_manager.py b/examples/data/uzbl/scripts/event_manager.py index 9c269c7..dee42c5 100755 --- a/examples/data/uzbl/scripts/event_manager.py +++ b/examples/data/uzbl/scripts/event_manager.py @@ -813,7 +813,8 @@ if __name__ == "__main__": config['verbose'] = True if options.plugin_dirs: - plugin_dirs = map(str.strip, options.plugin_dirs.split(':')) + plugin_dirs = map(os.path.realpath, map(str.strip, + options.plugin_dirs.split(':'))) config['plugin_dirs'] = plugin_dirs echo("plugin search dirs: %r" % plugin_dirs) @@ -842,11 +843,11 @@ if __name__ == "__main__": echo('will auto close.') if options.pid: - config['pid_file'] = options.pid + config['pid_file'] = os.path.realpath(options.pid) echo("pid file location: %r" % config['pid_file']) if options.socket: - config['server_socket'] = options.socket + config['server_socket'] = os.path.realpath(options.socket) echo("daemon socket location: %s" % config['server_socket']) if options.daemon: diff --git a/uzbl-browser b/uzbl-browser index 7cc8002..5ff72e9 100755 --- a/uzbl-browser +++ b/uzbl-browser @@ -35,17 +35,17 @@ do echo "could not create $dir" >&2 exit 2 fi - # if we're initialising a new config directory, put the default (recommended) config in it - if [ "$dir" == $XDG_CONFIG_HOME/uzbl ] - then - if ! cp $PREFIX/share/uzbl/examples/config/uzbl/config $XDG_CONFIG_HOME/uzbl/config - then - echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2 - exit 3 - fi - fi fi done +# if no config exists yet in the recommended location, put the default (recommended) config there +if [ ! -f $XDG_CONFIG_HOME/uzbl/config ] +then + if ! cp $PREFIX/share/uzbl/examples/config/uzbl/config $XDG_CONFIG_HOME/uzbl/config + then + echo "Could not copy default config to $XDG_CONFIG_HOME/uzbl/config" >&2 + exit 3 + fi +fi if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ] then |