Browse Source

fix keyerror when receiving key event of unmapped keysym

Fabian Peter Hammerle 4 years ago
parent
commit
b837e1e79e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      rescriptoon/__init__.py

+ 5 - 1
rescriptoon/__init__.py

@@ -139,7 +139,11 @@ class Overlay:
     ) -> None:
         self._update_active_key_registry(xkeyevent)
         keysym_in = self.xdisplay.keycode_to_keysym(xkeyevent.detail, index=0,)
-        action = self._keysym_mappings[keysym_in]
+        try:
+            action = self._keysym_mappings[keysym_in]
+        except KeyError:
+            logging.warning("received key event of unmapped keysym %d", keysym_in)
+            return
         action.execute(self, xkeyevent)
 
     @property