diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index dfdeb36b..af915a26 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -81,9 +81,11 @@ class TerminatorKeybindings: raise KeymapError("Unhandled modifier '<%s>'" % modifier) def lookup(self, event): - if not event: - raise KeymapError("lookup called with no event") - keyval, egroup, level, consumed = self.keymap.translate_keyboard_state(event.hardware_keycode, event.state, event.group) + try: + keyval, egroup, level, consumed = self.keymap.translate_keyboard_state(event.hardware_keycode, event.state, event.group) + except TypeError: + err ("keybindings.lookup failed to translate keyboard event: %s"%dir(event)) + return None mask = (event.state & ~consumed) & self._masks return self._lookup.get(mask, self.empty).get(event.keyval, None)