From aed6bdaf8404317b6345412093e2dfd76916dd29 Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Mon, 25 May 2020 06:02:23 +0300 Subject: supported addupper --- kvmd/keyboard/keysym.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'kvmd') 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 -- cgit v1.2.3