aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/config/uzbl/config39
-rw-r--r--examples/data/uzbl/plugins/bind.py4
-rw-r--r--examples/data/uzbl/plugins/completion.py3
-rwxr-xr-xexamples/data/uzbl/scripts/uzbl-cookie-daemon8
-rwxr-xr-xexamples/data/uzbl/scripts/uzbl-event-manager8
5 files changed, 34 insertions, 28 deletions
diff --git a/examples/config/uzbl/config b/examples/config/uzbl/config
index 092a369..33e074f 100644
--- a/examples/config/uzbl/config
+++ b/examples/config/uzbl/config
@@ -1,33 +1,36 @@
# 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
+set prefix = /usr/local
# === Shortcuts / Aliases ===================================================
+# Config related events (use the request function):
# request BIND <keycmd> = <command>
-set bind = request BIND
+set bind = request BIND
# request MODE_CONFIG <mode> <key> = <value
-set mode_config = request MODE_CONFIG
-# request TOGGLE_MODES <mode1> <mode2> ... <moden>
-set toggle_modes = event TOGGLE_MODES
+set mode_config = request MODE_CONFIG
# request ON_EVENT <EVENT_NAME> <command>
-set on_event = request ON_EVENT
+set on_event = request ON_EVENT
# request PROGRESS_CONFIG <key> = <value>
-set progress = request PROGRESS_CONFIG
+set progress = request PROGRESS_CONFIG
# request MODMAP From To
-set modmap = request MODMAP
+set modmap = request MODMAP
# request IGNORE_KEY <glob>
-set ignore_key = request IGNORE_KEY
+set ignore_key = request IGNORE_KEY
# request MODKEY_ADDITION <key1> <key2> <keyn> <result>
set modkey_addition = request MODKEY_ADDITION
-set set_mode = set mode =
-set set_status = set status_message =
-set shell_cmd = sh -c
+# Action related events (use the event function):
+# event TOGGLE_MODES <mode1> <mode2> ... <moden>
+set toggle_modes = event TOGGLE_MODES
+
+set set_mode = set mode =
+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:@prefix/share/uzbl/examples/data/uzbl:scripts
+set scripts_dir = $XDG_DATA_HOME/uzbl:@prefix/share/uzbl/examples/data/uzbl:scripts
# Javascipt helpers.
set jsh = js var run=Uzbl.run; function get(k){return run("print \\\@"+k)}; function set(k, v) {run("set "+k+" = "+v)};
@@ -231,15 +234,15 @@ 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
+@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'
+@bind <Ctrl>b<tags:>_ = sh 'echo -e "$6 %s" >> $XDG_DATA_HOME/uzbl/bookmarks'
# Multi-stage bindings with blank prompts (similar behaviour to emacs M-c M-s bindings?)
-@bind <Ctrl>a<:><Ctrl>q = exit
-@bind <Ctrl>a<:><Ctrl>h = uri http://uzbl.org/
+@bind <Ctrl>a<:><Ctrl>q = exit
+@bind <Ctrl>a<:><Ctrl>h = uri http://uzbl.org/
# Inject handy values into the keycmd.
@bind <Ctrl>su = event INJECT_KEYCMD \@uri
diff --git a/examples/data/uzbl/plugins/bind.py b/examples/data/uzbl/plugins/bind.py
index 3dedf16..ee1e0c4 100644
--- a/examples/data/uzbl/plugins/bind.py
+++ b/examples/data/uzbl/plugins/bind.py
@@ -348,11 +348,9 @@ def after_bind(uzbl, bd):
def match_and_exec(uzbl, bind, depth, keylet, bd):
(on_exec, has_args, mod_cmd, glob, more) = bind[depth]
-
- held = keylet.held
cmd = keylet.modcmd if mod_cmd else keylet.keycmd
- if mod_cmd and held != mod_cmd:
+ if mod_cmd and keylet.held != mod_cmd:
return False
if has_args:
diff --git a/examples/data/uzbl/plugins/completion.py b/examples/data/uzbl/plugins/completion.py
index 770f310..8e055e1 100644
--- a/examples/data/uzbl/plugins/completion.py
+++ b/examples/data/uzbl/plugins/completion.py
@@ -29,6 +29,9 @@ def escape(str):
def add_instance(uzbl, *args):
UZBLS[uzbl] = dict(DEFAULTS)
+ # Make sure the config keys for all possible completions are known.
+ uzbl.send('dump_config_as_events')
+
def del_instance(uzbl, *args):
if uzbl in UZBLS:
diff --git a/examples/data/uzbl/scripts/uzbl-cookie-daemon b/examples/data/uzbl/scripts/uzbl-cookie-daemon
index 87a2e87..fde8b8e 100755
--- a/examples/data/uzbl/scripts/uzbl-cookie-daemon
+++ b/examples/data/uzbl/scripts/uzbl-cookie-daemon
@@ -304,6 +304,9 @@ class CookieMonster:
if daemon_running(config['cookie_socket']):
sys.exit(1)
+ # Create cookie daemon socket.
+ self.create_socket()
+
# Daemonize process.
if config['daemon_mode']:
echo("entering daemon mode")
@@ -322,9 +325,6 @@ class CookieMonster:
self._running = True
while self._running:
- # Create cookie daemon socket.
- self.create_socket()
-
try:
# Enter main listen loop.
self.listen()
@@ -345,6 +345,8 @@ class CookieMonster:
# Always delete the socket before calling create again.
self.del_socket()
+ # Create cookie daemon socket.
+ self.create_socket()
def load_whitelist(self):
diff --git a/examples/data/uzbl/scripts/uzbl-event-manager b/examples/data/uzbl/scripts/uzbl-event-manager
index 7a02da9..916259a 100755
--- a/examples/data/uzbl/scripts/uzbl-event-manager
+++ b/examples/data/uzbl/scripts/uzbl-event-manager
@@ -583,16 +583,16 @@ class UzblEventDaemon(dict):
def run(self):
'''Main event daemon loop.'''
+ # Create event daemon socket.
+ self._create_server_socket()
+ echo('listening on: %s' % self.socket_location)
+
if CONFIG['daemon_mode']:
echo('entering daemon mode.')
daemonize()
# The pid has changed so update the pid file.
make_pid_file(CONFIG['pid_file'])
- # Create event daemon socket.
- self._create_server_socket()
- echo('listening on: %s' % self.socket_location)
-
# Now listen for incoming connections and or data.
self.listen()