{"id":23934,"library":"keysymdef","title":"keysymdef","description":"X11 keysym data for Python, providing a mapping from keysym names (like 'XK_a', 'XK_Return') to their integer codes and vice versa. Current version: 1.2.0. Maintained as a small utility library, releases are infrequent.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/barneygale/keysymdef","tags":["x11","keysym","keyboard","input"],"install":[{"cmd":"pip install keysymdef","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The entire module is a dictionary-like object. No submodules.","symbol":"keysymdef","correct":"import keysymdef"}],"quickstart":{"code":"import keysymdef\n\n# Get keysym code for 'XK_a'\ncode = keysymdef['XK_a']  # 97\nprint(code)\n\n# Get name from code\nname = keysymdef.keysym(97)  # 'XK_a'\nprint(name)\n\n# List all keysym names\nprint(len(keysymdef))  # thousands of entries","lang":"python","description":"Basic usage: treat the module as a dict mapping X11 keysym names to codes, and use keysym() for reverse lookup."},"warnings":[{"fix":"Use keysymdef.all_names() or list(keysymdef.keys()) to iterate keys.","message":"The keysymdef module is not a dict but a module that implements __getitem__ and __len__. Avoid iterating directly with for key in keysymdef: it raises TypeError. Use keysymdef.all_names() or list(keysymdef.keys()) instead.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use the canonical keysym name with 'XK_' prefix if applicable.","message":"Keysym names are case-sensitive and must be exactly as in X11 headers (e.g., 'XK_a' not 'xk_a' or 'a').","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to >=1.2.0 or implement your own reverse mapping.","message":"The .keysym() method is not part of the original API (it was added in 1.2.0). If you are using older versions, reverse lookup may not be available.","severity":"deprecated","affected_versions":"<1.2.0"},{"fix":"Check via 'key in keysymdef' before using a keysym.","message":"The module does not include all possible X11 keysyms; only those defined in X11/keysymdef.h. Some vendor-specific or custom keysyms may be missing.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use keysymdef.all_names() or list(keysymdef.keys()) to get a list of keys.","cause":"Attempting to iterate over keysymdef directly (e.g., for key in keysymdef).","error":"TypeError: 'module' object is not iterable"},{"fix":"Verify the keysym name from X11 documentation. Use 'key in keysymdef' to check.","cause":"Keysym name not present in the mapping (typo or missing keysym).","error":"KeyError: 'XK_unknown'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}