aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-22 17:55:20 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-22 17:55:20 +0800
commit62a70a38d8d62e46d8b8b1d9442a0b8ea2e7c0a2 (patch)
tree81cf05e88f218b3af395e13b76b1c8cc6ba24abb /examples
parent12a23eb6a95ddb65173d547f5ee74da979a51f38 (diff)
Fixed "config[key] = value" and "uzbl.set(key, value)" behaviour.
Diffstat (limited to 'examples')
-rw-r--r--examples/data/uzbl/scripts/plugins/config.py7
-rw-r--r--examples/data/uzbl/scripts/plugins/keycmd.py12
2 files changed, 11 insertions, 8 deletions
diff --git a/examples/data/uzbl/scripts/plugins/config.py b/examples/data/uzbl/scripts/plugins/config.py
index 32114e9..dc2070a 100644
--- a/examples/data/uzbl/scripts/plugins/config.py
+++ b/examples/data/uzbl/scripts/plugins/config.py
@@ -35,9 +35,7 @@ def set(uzbl, key, value):
if '\n' in value:
value = value.replace("\n", "\\n")
- config = get_config(uzbl)
- if key not in config or unicode(config[key]) != unicode(value):
- uzbl.send('set %s = %s' % (key, value))
+ uzbl.send('set %s = %s' % (key, value))
def add_instance(uzbl, *args):
@@ -63,7 +61,8 @@ class ConfigDict(dict):
def __setitem__(self, key, value):
'''Makes "config[key] = value" a wrapper for the set function.'''
- set(self._uzbl, key, value)
+ if key not in self or unicode(self[key]) != unicode(value):
+ set(self._uzbl, key, value)
def variable_set(uzbl, args):
diff --git a/examples/data/uzbl/scripts/plugins/keycmd.py b/examples/data/uzbl/scripts/plugins/keycmd.py
index 4e67a50..4b243a7 100644
--- a/examples/data/uzbl/scripts/plugins/keycmd.py
+++ b/examples/data/uzbl/scripts/plugins/keycmd.py
@@ -150,15 +150,19 @@ def update_event(uzbl, keylet):
if keylet.modcmd:
keycmd = keylet.to_string()
uzbl.event('MODCMD_UPDATE', keylet)
- if 'modcmd_updates' not in config or config['modcmd_updates'] == '1':
- if keycmd == keylet.to_string():
- config['keycmd'] = keycmd_escape(keycmd)
+ if keycmd != keylet.to_string():
+ return
+
+ if 'modcmd_updates' in config and config['modcmd_updates'] != '1':
+ return
+
+ uzbl.set('keycmd', keycmd_escape(keycmd))
elif 'keycmd_events' not in config or config['keycmd_events'] == '1':
keycmd = keylet.cmd
uzbl.event('KEYCMD_UPDATE', keylet)
if keycmd == keylet.cmd:
- config['keycmd'] = keycmd_escape(keycmd)
+ uzbl.set('keycmd', keycmd_escape(keycmd))
def key_press(uzbl, key):