aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-03-18 16:15:48 +0100
committerGravatar Brendan Taylor <whateley@gmail.com>2011-04-18 20:23:43 -0600
commitd09026aa3c9a4e8b4fefc114fb9cf126a454d01f (patch)
treee23d7783c3630b43316540ad19ed57cba099712b /examples
parentd2c7da7a03c8f9b76f78636a2374f439dae5c72d (diff)
Ignored keys don't enter modcmd but works in modcmd
* Makes Shift+Insert bind work without breaking normal shift functionality.
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config2
-rw-r--r--examples/data/plugins/keycmd.py12
2 files changed, 6 insertions, 8 deletions
diff --git a/examples/config/config b/examples/config/config
index 146d515..8c706df 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -322,7 +322,7 @@ set ebind = @mode_bind global,-insert
# Start a new uzbl instance from the page in primary selection
@cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"'
# paste primary selection into keycmd at the cursor position
-@bind <Shift-Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
+@bind <Shift><Insert> = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Bookmark inserting binds
@cbind <Ctrl>b<tags:>_ = sh 'echo `printf "$UZBL_URI %s"` >> "$XDG_DATA_HOME"/uzbl/bookmarks'
diff --git a/examples/data/plugins/keycmd.py b/examples/data/plugins/keycmd.py
index 5fb7e8a..198b859 100644
--- a/examples/data/plugins/keycmd.py
+++ b/examples/data/plugins/keycmd.py
@@ -185,7 +185,7 @@ def update_event(uzbl, modstate, k, execute=True):
if uzbl.config.get('modcmd_updates', '1') == '1':
new_modcmd = ''.join(modstate) + k.get_modcmd()
- if not new_modcmd:
+ if not new_modcmd or not k.is_modcmd:
del uzbl.config['modcmd']
elif new_modcmd == modcmd:
@@ -235,14 +235,14 @@ def key_press(uzbl, key):
k = uzbl.keylet
modstate, key = parse_key_event(uzbl, key)
- modstate = set([m for m in modstate if not k.key_ignored(m)])
+ k.is_modcmd = any(not k.key_ignored(m) for m in modstate)
logger.debug('key press modstate=%s' % str(modstate))
- if key.lower() == 'space' and not modstate and k.keycmd:
+ if key.lower() == 'space' and not k.is_modcmd and k.keycmd:
k.keycmd = inject_str(k.keycmd, k.cursor, ' ')
k.cursor += 1
- elif not modstate and len(key) == 1:
+ elif not k.is_modcmd and len(key) == 1:
if uzbl.config.get('keycmd_events', '1') != '1':
# TODO, make a note on what's going on here
k.keycmd = ''
@@ -259,9 +259,7 @@ def key_press(uzbl, key):
else:
if not k.key_ignored('<%s>' % key):
modstate.add('<%s>' % key)
-
- if len(modstate) > 0:
- k.is_modcmd = True
+ k.is_modcmd = True
update_event(uzbl, modstate, k)