diff options
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | callbacks.c | 2 | ||||
-rw-r--r-- | examples/config/uzbl/config | 4 | ||||
-rw-r--r-- | examples/data/uzbl/plugins/bind.py | 110 | ||||
-rw-r--r-- | examples/data/uzbl/plugins/keycmd.py | 47 | ||||
-rw-r--r-- | examples/data/uzbl/plugins/on_event.py | 5 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/uzbl-cookie-daemon (renamed from examples/data/uzbl/scripts/cookie_daemon.py) | 0 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/uzbl-event-manager (renamed from examples/data/uzbl/scripts/event_manager.py) | 12 | ||||
-rwxr-xr-x | examples/data/uzbl/scripts/uzbl-tabbed (renamed from examples/data/uzbl/scripts/uzbl_tabbed.py) | 0 | ||||
-rw-r--r-- | tests/test-command.c | 18 | ||||
-rw-r--r-- | tests/test-expand.c | 18 | ||||
-rwxr-xr-x | uzbl-browser | 12 |
13 files changed, 120 insertions, 132 deletions
@@ -40,6 +40,7 @@ uzbl-core: ${OBJ} uzbl-browser: uzbl-core # packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system +# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to PREFIX?=/usr/local INSTALLDIR?=$(DESTDIR)$(PREFIX) @@ -62,11 +63,11 @@ test-dev: uzbl-core XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config ./uzbl-core --uri http://www.uzbl.org --verbose test-dev-browser: uzbl-browser - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/cookie_daemon.py start -nv & - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/event_manager.py start -nv & + XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/uzbl-cookie-daemon start -nv & + XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/uzbl-event-manager start -nv & XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:`pwd`/examples/data/uzbl/scripts/:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/cookie_daemon.py stop -v - XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/event_manager.py stop -v + XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/uzbl-cookie-daemon stop -v + XDG_DATA_HOME=./examples/data XDG_CACHE_HOME=./examples/cache XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./examples/data/uzbl/scripts/uzbl-event-manager stop -v test-share: uzbl-core XDG_DATA_HOME=${INSTALLDIR}/share/uzbl/examples/data XDG_CONFIG_HOME=${INSTALLDIR}/share/uzbl/examples/config ./uzbl-core --uri http://www.uzbl.org --verbose @@ -98,17 +99,16 @@ install-uzbl-core: all install-uzbl-browser: all install -d $(INSTALLDIR)/bin install -m755 uzbl-browser $(INSTALLDIR)/bin/uzbl-browser - install -m755 examples/data/uzbl/scripts/cookie_daemon.py $(INSTALLDIR)/bin/cookie_daemon.py - install -m755 examples/data/uzbl/scripts/event_manager.py $(INSTALLDIR)/bin/event_manager.py + install -m755 examples/data/uzbl/scripts/uzbl-cookie-daemon $(INSTALLDIR)/bin/uzbl-cookie-daemon + install -m755 examples/data/uzbl/scripts/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager sed -i 's#^PREFIX=.*#PREFIX=$(PREFIX)#' $(INSTALLDIR)/bin/uzbl-browser - sed -i "s#^PREFIX = None#PREFIX = '$(PREFIX)'#" $(INSTALLDIR)/bin/event_manager.py + sed -i "s#^PREFIX = .*#PREFIX = '$(PREFIX)'#" $(INSTALLDIR)/bin/uzbl-event-manager + sed -i 's#^set prefix.*=.*#set prefix = $(PREFIX)#' $(INSTALLDIR)/share/uzbl/examples/config/uzbl/config install-uzbl-tabbed: all install -d $(INSTALLDIR)/bin - install -m755 examples/data/uzbl/scripts/uzbl_tabbed.py $(INSTALLDIR)/bin/uzbl-tabbed + install -m755 examples/data/uzbl/scripts/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed uninstall: rm -rf $(INSTALLDIR)/bin/uzbl-* - rm -rf $(INSTALLDIR)/bin/cookie_daemon.py - rm -rf $(INSTALLDIR)/bin/event_manager.py rm -rf $(INSTALLDIR)/share/uzbl @@ -161,6 +161,8 @@ The following commands are recognized: - if you use `chain` with a handler script which must return some output (such as a cookie handler -- uzbl will wait for and use its output), use sync_spawn or sync_sh instead of spawn or sh in the command that should give the output * `event <event_name> [event_details]` - send custom event +* `request <request_name> [request_details]` + - send custom request (same idea as events, but to be processed by EM, not uzbl-core) * `menu_add <label> = <uzbl command>` * `menu_link_add <label> = <uzbl command>` * `menu_image_add <label> = <uzbl command>` @@ -179,7 +181,7 @@ The following commands are recognized: * `hardcopy` - open print dialog * `include <file>` - - read contents of file and interprete commands + - read contents of file and interpret commands ### VARIABLES AND CONSTANTS diff --git a/callbacks.c b/callbacks.c index cf7a867..18ea2e0 100644 --- a/callbacks.c +++ b/callbacks.c @@ -40,7 +40,7 @@ void cmd_set_geometry() { int ret=0, x=0, y=0; unsigned int w=0, h=0; - + /* we used to use gtk_window_parse_geometry() but that didn't work how it was supposed to */ ret = XParseGeometry(uzbl.gui.geometry, &x, &y, &w, &h); if(ret & XValue) gtk_window_move((GtkWindow *)uzbl.gui.main_window, x, y); diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config index 090ebd2..33783ac 100644 --- a/examples/config/uzbl/config +++ b/examples/config/uzbl/config @@ -1,6 +1,8 @@ # example uzbl config. # all settings are optional. you can use uzbl without any config at all (but it won't do much) +set prefix = /usr/local + # === Shortcuts ============================================================== # request BIND <keycmd> = <command> @@ -21,7 +23,7 @@ set set_status = set status_message = set shell_cmd = sh -c # Spawn path shortcuts. In spawn the first dir+path match is used in "dir1:dir2:dir3:executable" -set scripts_dir = $XDG_DATA_HOME/uzbl:/usr/local/share/uzbl/examples/data/uzbl:scripts +set scripts_dir = $XDG_DATA_HOME/uzbl:@prefix/share/uzbl/examples/data/uzbl:scripts # === Handlers =============================================================== diff --git a/examples/data/uzbl/plugins/bind.py b/examples/data/uzbl/plugins/bind.py index b8494fe..530cc80 100644 --- a/examples/data/uzbl/plugins/bind.py +++ b/examples/data/uzbl/plugins/bind.py @@ -11,12 +11,11 @@ And it is also possible to execute a function on activation: import sys import re -from event_manager import config, counter, iscallable, isiterable -# Export these variables/functions to uzbl.<name> +# Export these functions to uzbl.<name> __export__ = ['bind', 'del_bind', 'del_bind_by_glob', 'get_binds'] -# Hold the bind lists per uzbl instance. +# Hold the bind dicts for each uzbl instance. UZBLS = {} # Commonly used regular expressions. @@ -24,20 +23,7 @@ starts_with_mod = re.compile('^<([A-Z][A-Za-z0-9-_]*)>') find_prompts = re.compile('<([^:>]*):(\"[^\"]*\"|\'[^\']*\'|[^>]*)>').split # For accessing a bind glob stack. -MOD_CMD, ON_EXEC, HAS_ARGS, GLOB, MORE = range(5) - - -class BindParseError(Exception): - pass - - -def echo(msg): - if config['verbose']: - print 'bind plugin:', msg - - -def error(msg): - sys.stderr.write('bind plugin: error: %s\n' % msg) +ON_EXEC, HAS_ARGS, MOD_CMD, GLOB, MORE = range(5) def ismodbind(glob): @@ -46,25 +32,25 @@ def ismodbind(glob): return bool(starts_with_mod.match(glob)) -def sort_mods(glob): - '''Mods are sorted in the keylet.to_string() result so make sure that - bind commands also have their mod keys sorted.''' +def split_glob(glob): + '''Take a string of the form "<Mod1><Mod2>cmd _" and return a list of the + modkeys in the glob and the command.''' - mods = [] + mods = set() while True: match = starts_with_mod.match(glob) if not match: break end = match.span()[1] - mods.append(glob[:end]) + mods.add(glob[:end]) glob = glob[end:] - return '%s%s' % (''.join(sorted(mods)), glob) + return (mods, glob) def add_instance(uzbl, *args): - UZBLS[uzbl] = {'binds': [], 'depth': 0, 'filter': [], + UZBLS[uzbl] = {'binds': [], 'depth': 0, 'stack': [], 'args': [], 'last_mode': ''} @@ -100,7 +86,7 @@ def get_filtered_binds(uzbl): bind_dict = get_bind_dict(uzbl) if bind_dict['depth']: - return list(bind_dict['filter']) + return list(bind_dict['stack']) return list(bind_dict['binds']) @@ -132,10 +118,11 @@ def del_bind_by_glob(uzbl, glob): class Bind(object): - nextbid = counter().next + # Class attribute to hold the number of Bind classes created. + counter = [0,] def __init__(self, glob, handler, *args, **kargs): - self.is_callable = iscallable(handler) + self.is_callable = callable(handler) self._repr_cache = None if not glob: @@ -149,14 +136,17 @@ class Bind(object): elif kargs: raise ArgumentError('cannot supply kargs for uzbl commands') - elif isiterable(handler): + elif hasattr(handler, '__iter__'): self.commands = handler else: self.commands = [handler,] + list(args) self.glob = glob - self.bid = self.nextbid() + + # Assign unique id. + self.counter[0] += 1 + self.bid = self.counter[0] self.split = split = find_prompts(glob) self.prompts = [] @@ -171,13 +161,13 @@ class Bind(object): for glob in split[:-1:3]: if glob.endswith('*'): msg = "token '*' not at the end of a prompt bind: %r" % split - raise BindParseError(msg) + raise SyntaxError(msg) # Check that there is nothing like: fl<prompt1:><prompt2:>_ for glob in split[3::3]: if not glob: msg = 'found null segment after first prompt: %r' % split - raise BindParseError(msg) + raise SyntaxError(msg) stack = [] for (index, glob) in enumerate(reversed(split[::3])): @@ -191,7 +181,8 @@ class Bind(object): has_args = True if glob[-1] in ['*', '_'] else False glob = glob[:-1] if has_args else glob - stack.append((mod_cmd, on_exec, has_args, glob, index)) + mods, glob = split_glob(glob) + stack.append((on_exec, has_args, mods, glob, index)) self.stack = list(reversed(stack)) self.is_global = (len(self.stack) == 1 and self.stack[0][MOD_CMD]) @@ -261,7 +252,6 @@ def bind(uzbl, glob, handler, *args, **kargs): # Mods come from the keycmd sorted so make sure the modkeys in the bind # command are sorted too. - glob = sort_mods(glob) del_bind_by_glob(uzbl, glob) binds = get_binds(uzbl) @@ -277,11 +267,11 @@ def parse_bind_event(uzbl, args): '''Break "event BIND fl* = js follownums.js" into (glob, command).''' if not args: - return error('missing bind arguments') + raise ArgumentError('missing bind arguments') split = map(unicode.strip, args.split('=', 1)) if len(split) != 2: - return error('missing "=" in bind definition: %r' % args) + raise ArgumentError('missing delimiter in bind: %r' % args) glob, command = split bind(uzbl, glob, command) @@ -309,40 +299,30 @@ def clear_stack(uzbl, mode): if mode != "stack": bind_dict = get_bind_dict(uzbl) - bind_dict['filter'] = [] + bind_dict['stack'] = [] bind_dict['depth'] = 0 bind_dict['args'] = [] bind_dict['last_mode'] = mode -def filter_bind(uzbl, bind_dict, bind): - '''Remove a bind from the stack filter list.''' - - if bind in bind_dict['filter']: - bind_dict['filter'].remove(bind) - - if not bind_dict['filter']: - uzbl.set_mode() +def match_and_exec(uzbl, bind, depth, keylet, mod_event=False): + bind_dict = get_bind_dict(uzbl) + (on_exec, has_args, mod_cmd, glob, more) = bind[depth] + held = keylet.held + cmd = keylet.modcmd if mod_cmd else keylet.keycmd -def match_and_exec(uzbl, bind, depth, keycmd): - bind_dict = get_bind_dict(uzbl) - (mod_cmd, on_exec, has_args, glob, more) = bind[depth] + if mod_cmd and held != mod_cmd: + return False if has_args: - if not keycmd.startswith(glob): - if not mod_cmd: - filter_bind(uzbl, bind_dict, bind) - + if not cmd.startswith(glob): return False - args = [keycmd[len(glob):],] - - elif keycmd != glob: - if not mod_cmd: - filter_bind(uzbl, bind_dict, bind) + args = [cmd[len(glob):],] + elif cmd != glob: return False else: @@ -358,12 +338,12 @@ def match_and_exec(uzbl, bind, depth, keycmd): elif more: if bind_dict['depth'] == depth: globalcmds = [cmd for cmd in bind_dict['binds'] if cmd.is_global] - bind_dict['filter'] = [bind,] + globalcmds + bind_dict['stack'] = [bind,] + globalcmds bind_dict['args'] += args bind_dict['depth'] = depth + 1 - elif bind not in bind_dict['filter']: - bind_dict['filter'].append(bind) + elif bind not in bind_dict['stack']: + bind_dict['stack'].append(bind) set_stack_mode(uzbl, bind.prompts[depth]) return False @@ -379,49 +359,45 @@ def match_and_exec(uzbl, bind, depth, keycmd): def keycmd_update(uzbl, keylet): depth = get_stack_depth(uzbl) - keycmd = keylet.get_keycmd() for bind in get_filtered_binds(uzbl): t = bind[depth] if t[MOD_CMD] or t[ON_EXEC]: continue - if match_and_exec(uzbl, bind, depth, keycmd): + if match_and_exec(uzbl, bind, depth, keylet): return def keycmd_exec(uzbl, keylet): depth = get_stack_depth(uzbl) - keycmd = keylet.get_keycmd() for bind in get_filtered_binds(uzbl): t = bind[depth] if t[MOD_CMD] or not t[ON_EXEC]: continue - if match_and_exec(uzbl, bind, depth, keycmd): + if match_and_exec(uzbl, bind, depth, keylet): return uzbl.clear_keycmd() def modcmd_update(uzbl, keylet): depth = get_stack_depth(uzbl) - keycmd = keylet.get_modcmd() for bind in get_filtered_binds(uzbl): t = bind[depth] if not t[MOD_CMD] or t[ON_EXEC]: continue - if match_and_exec(uzbl, bind, depth, keycmd): + if match_and_exec(uzbl, bind, depth, keylet): return def modcmd_exec(uzbl, keylet): depth = get_stack_depth(uzbl) - keycmd = keylet.get_modcmd() for bind in get_filtered_binds(uzbl): t = bind[depth] if not t[MOD_CMD] or not t[ON_EXEC]: continue - if match_and_exec(uzbl, bind, depth, keycmd): + if match_and_exec(uzbl, bind, depth, keylet): return uzbl.clear_modcmd() diff --git a/examples/data/uzbl/plugins/keycmd.py b/examples/data/uzbl/plugins/keycmd.py index 8961f74..0477303 100644 --- a/examples/data/uzbl/plugins/keycmd.py +++ b/examples/data/uzbl/plugins/keycmd.py @@ -31,7 +31,7 @@ class Keylet(object): def __init__(self): # Modcmd tracking - self.held = [] + self.held = set() self.modcmd = '' self.is_modcmd = False @@ -58,7 +58,7 @@ class Keylet(object): if not self.is_modcmd: return '' - return ''.join(['<%s>' % key for key in self.held]) + self.modcmd + return ''.join(self.held) + self.modcmd def key_modmap(self, key): @@ -99,6 +99,10 @@ def add_modmap(uzbl, key, map=None): '''Add modmaps.''' keylet = get_keylet(uzbl) + + if key[0] == "<" and key[-1] == ">": + key = key[1:-1] + if not map: if key in keylet.modmap: map = keylet.modmap[key] @@ -169,7 +173,7 @@ def clear_modcmd(uzbl, clear_held=False): k.is_modcmd = False k._repr_cache = False if clear_held: - k.held = [] + k.held = set() config = uzbl.get_config() if 'modcmd' not in config or config['modcmd'] != '': @@ -233,6 +237,16 @@ def inject_str(str, index, inj): return "%s%s%s" % (str[:index], inj, str[index:]) +def chevronate(key): + '''If a modkey isn't already chevronated then chevronate it. Ignore all + other keys.''' + + if len(key) == 1: + return key + + return "<%s>" % key.strip("<>") + + def key_press(uzbl, key): '''Handle KEY_PRESS events. Things done by this function include: @@ -243,15 +257,13 @@ def key_press(uzbl, key): 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.''' - if key.startswith('Shift_'): - return - k = get_keylet(uzbl) - key = k.key_modmap(key.strip()) - if key.startswith("ISO_"): + key = chevronate(k.key_modmap(key.strip())) + + if key.startswith("<ISO_") or key == '<Shift>': return - if key == 'Space' and not k.held and k.keycmd: + if key.lower() == '<space>' and not k.held and k.keycmd: k.keycmd = inject_str(k.keycmd, k.cursor, ' ') k.cursor += 1 @@ -267,12 +279,11 @@ def key_press(uzbl, key): elif len(key) > 1: k.is_modcmd = True - if key == 'Shift-Tab' and 'Tab' in k.held: - k.held.remove('Tab') + if key == '<Shift-Tab>' and '<Tab>' in k.held: + k.held.remove('<Tab>') if key not in k.held: - k.held.append(key) - k.held.sort() + k.held.add(key) else: k.is_modcmd = True @@ -290,13 +301,13 @@ def key_release(uzbl, key): 4. Update the keycmd uzbl variable if anything changed.''' k = get_keylet(uzbl) - key = k.key_modmap(key) + key = chevronate(k.key_modmap(key)) - if key in ['Shift', 'Tab'] and 'Shift-Tab' in k.held: - key = 'Shift-Tab' + if key in ['<Shift>', '<Tab>'] and '<Shift-Tab>' in k.held: + key = '<Shift-Tab>' - elif key in ['Shift', 'Alt'] and 'Meta' in k.held: - key = 'Meta' + elif key in ['<Shift>', '<Alt>'] and '<Meta>' in k.held: + key = '<Meta>' if key in k.held: if k.is_modcmd: diff --git a/examples/data/uzbl/plugins/on_event.py b/examples/data/uzbl/plugins/on_event.py index 242f9b0..3dfc3fa 100644 --- a/examples/data/uzbl/plugins/on_event.py +++ b/examples/data/uzbl/plugins/on_event.py @@ -18,16 +18,11 @@ Usage: import sys import re -from event_manager import config __export__ = ['get_on_events', 'on_event'] UZBLS = {} -def echo(msg): - if config['verbose']: - print 'on_event plugin:', msg - def error(msg): sys.stderr.write('on_event plugin: error: %s\n' % msg) diff --git a/examples/data/uzbl/scripts/cookie_daemon.py b/examples/data/uzbl/scripts/uzbl-cookie-daemon index 87a2e87..87a2e87 100755 --- a/examples/data/uzbl/scripts/cookie_daemon.py +++ b/examples/data/uzbl/scripts/uzbl-cookie-daemon diff --git a/examples/data/uzbl/scripts/event_manager.py b/examples/data/uzbl/scripts/uzbl-event-manager index dee42c5..8f43836 100755 --- a/examples/data/uzbl/scripts/event_manager.py +++ b/examples/data/uzbl/scripts/uzbl-event-manager @@ -45,12 +45,8 @@ from traceback import print_exc # ::: Default configuration section :::::::::::::::::::::::::::::::::::::::::: # ============================================================================ -# Automagically set during `make install` -PREFIX = None - -# Check if PREFIX not set and set to default /usr/local/ -if not PREFIX: - PREFIX = '/usr/local/' +# `make install` will put the correct value here for your system +PREFIX = '/usr/local/' def xdghome(key, default): '''Attempts to use the environ XDG_*_HOME paths if they exist otherwise @@ -335,6 +331,10 @@ class EventHandler(object): class UzblInstance(object): + + # Give all plugins access to the main config dict. + config = config + def __init__(self, parent, client_socket): # Internal variables. diff --git a/examples/data/uzbl/scripts/uzbl_tabbed.py b/examples/data/uzbl/scripts/uzbl-tabbed index bb9b9a2..bb9b9a2 100755 --- a/examples/data/uzbl/scripts/uzbl_tabbed.py +++ b/examples/data/uzbl/scripts/uzbl-tabbed diff --git a/tests/test-command.c b/tests/test-command.c index 769a1a9..49f3bb8 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -178,9 +178,9 @@ test_set_variable (struct EventFixture *ef, const void *data) { (void) data; /* set a string */ - parse_cmd_line("set status_message = A Simple Testing Message", NULL); - ASSERT_EVENT(ef, "VARIABLE_SET status_message str A Simple Testing Message"); - g_assert_cmpstr("A Simple Testing Message", ==, uzbl.gui.sbar.msg); + parse_cmd_line("set useragent = Uzbl browser kthxbye!", NULL); + ASSERT_EVENT(ef, "VARIABLE_SET useragent str Uzbl browser kthxbye!"); + g_assert_cmpstr("Uzbl browser kthxbye!", ==, uzbl.net.useragent); /* set an int */ parse_cmd_line("set forward_keys = 0", NULL); @@ -306,9 +306,9 @@ test_js (void) { g_assert_cmpstr("X345", ==, result->str); /* uzbl commands can be run from javascript */ - uzbl.gui.sbar.msg = "Test message"; - parse_cmd_line("js Uzbl.run('print @status_message').toUpperCase();", result); - g_assert_cmpstr("TEST MESSAGE", ==, result->str); + uzbl.net.useragent = "Test useragent"; + parse_cmd_line("js Uzbl.run('print @useragent').toUpperCase();", result); + g_assert_cmpstr("TEST USERAGENT", ==, result->str); g_string_free(result, TRUE); } @@ -330,8 +330,8 @@ test_run_handler_arg_order (void) { void test_run_handler_expand (void) { - uzbl.gui.sbar.msg = "Test message"; - run_handler("sync_spawn echo @status_message", "result:"); + uzbl.net.useragent = "Test uzbl uzr agent"; + run_handler("sync_spawn echo @useragent", "result:"); assert(uzbl.comm.sync_stdout); @@ -340,7 +340,7 @@ test_run_handler_expand (void) { /* the rest of the result should be the arguments passed to run_handler. */ /* the user-specified arguments to the handler should have been expanded */ - g_assert_cmpstr("result: Test message\n", ==, rest); + g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, rest); } int diff --git a/tests/test-expand.c b/tests/test-expand.c index 855d9b4..ef07c80 100644 --- a/tests/test-expand.c +++ b/tests/test-expand.c @@ -64,9 +64,9 @@ test_NAME (void) { } void -test_status_message (void) { - uzbl.gui.sbar.msg = "Hello from frosty Edmonton!"; - g_assert_cmpstr(expand("@status_message", 0), ==, "Hello from frosty Edmonton!"); +test_useragent (void) { + uzbl.net.useragent = "This is the uzbl browser (sort of). and btw: Hello from frosty Edmonton!"; + g_assert_cmpstr(expand("@useragent", 0), ==, "This is the uzbl browser (sort of). and btw: Hello from frosty Edmonton!"); } void @@ -171,12 +171,12 @@ test_escape_expansion (void) { void test_nested (void) { - uzbl.gui.sbar.msg = "xxx"; - g_assert_cmpstr(expand("@<\"..@status_message..\">@", 0), ==, "..xxx.."); - g_assert_cmpstr(expand("@<\"..\\@status_message..\">@", 0), ==, "..@status_message.."); + uzbl.net.useragent = "xxx"; + g_assert_cmpstr(expand("@<\"..@useragent..\">@", 0), ==, "..xxx.."); + g_assert_cmpstr(expand("@<\"..\\@useragent..\">@", 0), ==, "..@useragent.."); - g_assert_cmpstr(expand("@(echo ..@status_message..)@", 0), ==, "..xxx.."); - g_assert_cmpstr(expand("@(echo ..\\@status_message..)@", 0), ==, "..@status_message.."); + g_assert_cmpstr(expand("@(echo ..@useragent..)@", 0), ==, "..xxx.."); + g_assert_cmpstr(expand("@(echo ..\\@useragent..)@", 0), ==, "..@useragent.."); } int @@ -185,7 +185,7 @@ main (int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); g_test_add_func("/test-expand/@keycmd", test_keycmd); - g_test_add_func("/test-expand/@status_message", test_status_message); + g_test_add_func("/test-expand/@useragent", test_useragent); g_test_add_func("/test-expand/@uri", test_uri); g_test_add_func("/test-expand/@TITLE", test_TITLE); g_test_add_func("/test-expand/@SELECTED_URI", test_SELECTED_URI); diff --git a/uzbl-browser b/uzbl-browser index 5ff72e9..eebf9e3 100755 --- a/uzbl-browser +++ b/uzbl-browser @@ -47,18 +47,20 @@ then fi fi -if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ] -then +# Uncomment this for a slight speedup at the expense of not having +# stale cookie daemon sockets cleaned up. +#if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ] +#then # if you want to customize it, copy to your $XDG_DATA_HOME/uzbl/scripts/ and update $PATH - cookie_daemon.py -fi + uzbl-cookie-daemon -v start +#fi DAEMON_SOCKET=$XDG_CACHE_HOME/uzbl/event_daemon DAEMON_PID=${DAEMON_SOCKET}.pid #if [ -f "$DAEMON_PID" ] #then - event_manager.py -va start + uzbl-event-manager -va start #fi uzbl-core "$@" --connect-socket $DAEMON_SOCKET | grep -v ^EVENT |