supported addupper

This commit is contained in:
Devaev Maxim 2020-05-25 06:02:23 +03:00
parent e6f8396661
commit aed6bdaf84

View File

@ -113,14 +113,24 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
parts = line.split() parts = line.split()
if len(parts) >= 2: if len(parts) >= 2:
if (code := _resolve_keysym(parts[0])) != 0: if (x11_code := _resolve_keysym(parts[0])) != 0:
try: try:
layout[code] = At1Key( at1_code = int(parts[1], 16)
code=int(parts[1], 16),
shift=("shift" in parts[2:]),
altgr=("altgr" in parts[2:]),
ctrl=("ctrl" in parts[2:]),
)
except ValueError as err: except ValueError as err:
logger.error("Syntax error at %s:%d: %s", path, lineno, 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 return layout