aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/scripts/plugins/keycmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/data/uzbl/scripts/plugins/keycmd.py')
-rw-r--r--examples/data/uzbl/scripts/plugins/keycmd.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/examples/data/uzbl/scripts/plugins/keycmd.py b/examples/data/uzbl/scripts/plugins/keycmd.py
index 7abb042..4e67a50 100644
--- a/examples/data/uzbl/scripts/plugins/keycmd.py
+++ b/examples/data/uzbl/scripts/plugins/keycmd.py
@@ -17,6 +17,17 @@ _SIMPLEKEYS = {
}
+def keycmd_escape(keycmd):
+ '''Prevent outgoing keycmd values from expanding inside the
+ status_format.'''
+
+ for char in ['\\', '@']:
+ if char in keycmd:
+ keycmd = keycmd.replace(char, '\\'+char)
+
+ return keycmd
+
+
def get_regex(regex):
'''Compiling regular expressions is a very time consuming so return a
pre-compiled regex match object if possible.'''
@@ -139,14 +150,15 @@ def update_event(uzbl, keylet):
if keylet.modcmd:
keycmd = keylet.to_string()
uzbl.event('MODCMD_UPDATE', keylet)
- if keycmd == keylet.to_string():
- config['keycmd'] = keylet.to_string()
+ if 'modcmd_updates' not in config or config['modcmd_updates'] == '1':
+ if keycmd == keylet.to_string():
+ config['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'] = keylet.cmd
+ config['keycmd'] = keycmd_escape(keycmd)
def key_press(uzbl, key):