From 1c596a8124d86b135c6255eb2cee3729f8d4c6ca Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 11 May 2022 11:28:42 -0400 Subject: [PATCH] rules: only one warning per inaccessible key for KeyPress action --- docs/rules.md | 2 ++ lib/logitech_receiver/diversion.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index 1cda70f5..164c186b 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -162,6 +162,8 @@ i.e., don't use a single `KeyPress` like 'a+b'. If a key symbol can only be produced by a shfited or level 3 keypress, e.g., "A", then Solaar will add keypresses to produce that keysymbol, e.g., simulating a left shift keypress to get "A" instead of "a". +If a key symbol is not available in the current keymap or needs other shift-like keys, +then Solaar cannot simulate it. If Solaar can determine the current key modifiers (shift, control, etc.) any key symbols that correspond to these modifier keys are not pressed, so if the shift key is currently down on a keyboard Solaar will not bother to simulate a shift key. diff --git a/lib/logitech_receiver/diversion.py b/lib/logitech_receiver/diversion.py index e721dbaa..eaf576f9 100644 --- a/lib/logitech_receiver/diversion.py +++ b/lib/logitech_receiver/diversion.py @@ -841,8 +841,6 @@ class KeyPress(Action): if (group == k.group or len(keycodes.keys) == 1) and k.keycode < 256 and (level is None or k.level < level): keycode = k.keycode level = k.level - if keycode is None: - _log.warn('rule KeyPress key symbol not currently available %s', self) return (keycode, level) def __str__(self): @@ -865,7 +863,9 @@ class KeyPress(Action): def keyDown(self, keysyms, modifiers): for k in keysyms: (keycode, level) = self.keysym_to_keycode(k, modifiers) - if keycode and self.needed(keycode, modifiers): + if keycode is None: + _log.warn('rule KeyPress key symbol not currently available %s', self) + elif self.needed(keycode, modifiers): self.mods(level, modifiers, _KEY_PRESS) simulate_key(keycode, _KEY_PRESS)