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 | 18 | ||||
-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 | ||||
-rwxr-xr-x | uzbl-browser | 12 |
10 files changed, 38 insertions, 39 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 @@ -159,6 +159,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>` @@ -177,7 +179,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..89b0831 100644 --- a/examples/data/uzbl/plugins/bind.py +++ b/examples/data/uzbl/plugins/bind.py @@ -11,7 +11,6 @@ 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__ = ['bind', 'del_bind', 'del_bind_by_glob', 'get_binds'] @@ -31,11 +30,6 @@ 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) @@ -132,10 +126,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 +144,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 = [] 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/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 |