Registry / serialization / keysymdef

keysymdef

JSON →
library1.2.0pypypi✓ verified 84d ago

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.

pip install keysymdef
INSTALL
IMPORT
SIG · KEYSYMDEF
K
keysymdef
serializationpythonv1.2.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

keysymdef
import keysymdef
The entire module is a dictionary-like object. No submodules.

Basic usage: treat the module as a dict mapping X11 keysym names to codes, and use keysym() for reverse lookup.

import keysymdef # Get keysym code for 'XK_a' code = keysymdef['XK_a'] # 97 print(code) # Get name from code name = keysymdef.keysym(97) # 'XK_a' print(name) # List all keysym names print(len(keysymdef)) # thousands of entries
Debug
Known issues
gotchaThe 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.
fix
Use keysymdef.all_names() or list(keysymdef.keys()) to iterate keys.
affects: >=1.0.0
gotchaKeysym names are case-sensitive and must be exactly as in X11 headers (e.g., 'XK_a' not 'xk_a' or 'a').
fix
Always use the canonical keysym name with 'XK_' prefix if applicable.
affects: >=1.0.0
deprecatedThe .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.
fix
Upgrade to >=1.2.0 or implement your own reverse mapping.
affects: <1.2.0
gotchaThe module does not include all possible X11 keysyms; only those defined in X11/keysymdef.h. Some vendor-specific or custom keysyms may be missing.
fix
Check via 'key in keysymdef' before using a keysym.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: 'module' object is not iterable
Attempting to iterate over keysymdef directly (e.g., for key in keysymdef).
fix
Use keysymdef.all_names() or list(keysymdef.keys()) to get a list of keys.
KeyError: 'XK_unknown'
Keysym name not present in the mapping (typo or missing keysym).
fix
Verify the keysym name from X11 documentation. Use 'key in keysymdef' to check.
Upgrade
Version history
1.2.0latest on PyPI · released Feb 25, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
keysymdef — pip install keysymdef · libregistry