diff options
author | Devaev Maxim <[email protected]> | 2020-05-25 06:02:23 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-05-25 06:02:23 +0300 |
commit | aed6bdaf8404317b6345412093e2dfd76916dd29 (patch) | |
tree | 26a157010ea05034f57f675b9701d6a9996350f9 /kvmd/keyboard | |
parent | e6f8396661b3c12e0cc72941f9b8e635989469fa (diff) |
supported addupper
Diffstat (limited to 'kvmd/keyboard')
-rw-r--r-- | kvmd/keyboard/keysym.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/kvmd/keyboard/keysym.py b/kvmd/keyboard/keysym.py index 89919e5c..aa4a8676 100644 --- a/kvmd/keyboard/keysym.py +++ b/kvmd/keyboard/keysym.py @@ -113,14 +113,24 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a parts = line.split() if len(parts) >= 2: - if (code := _resolve_keysym(parts[0])) != 0: + if (x11_code := _resolve_keysym(parts[0])) != 0: try: - layout[code] = At1Key( - code=int(parts[1], 16), - shift=("shift" in parts[2:]), - altgr=("altgr" in parts[2:]), - ctrl=("ctrl" in parts[2:]), - ) + at1_code = int(parts[1], 16) except ValueError as err: logger.error("Syntax error at %s:%d: %s", path, lineno, err) + continue + rest = parts[2:] + + layout[x11_code] = At1Key( + code=at1_code, + shift=("shift" in rest), + altgr=("altgr" in rest), + ctrl=("ctrl" in rest), + ) + + if "addupper" in rest and (x11_code := _resolve_keysym(parts[0].upper())) != 0: + layout[x11_code] = At1Key( + code=at1_code, + shift=True, + ) return layout |