How ctrondlp/python-libei works
python-libei provides Python ctypes bindings for Wayland EI/EIS input, plus two portal-based ways to obtain an EIS connection. The main injection flow is caller → permission/session negotiation → EI Sender → compositor EIS server, where queued input is sent by frame(). The package also supports receiving input and direct D-Bus InputCapture sessions. Low-level bindings, lazy native-library loading, and C-pointer lifetime management underpin the public APIs. Relationships involving unsampled implementation details are omitted unless documented in the README or shown by an excerpt.
Main entry points: ei.py EI client · eis.py EIS server · oeffis.py Oeffis session · loader.py Lazy library loader
Components 14
Permission and access
- Oeffis session
src/libei/oeffis.py - RemoteDesktop session
src/libei/portal.py - InputCapture session
src/libei/portal.py
EI/EIS protocol
- EI client
src/libei/ei.py - EIS server
src/libei/eis.py
Native bindings
- libei bindings
src/libei/_capi/libei.py - libeis bindings
src/libei/_capi/libeis.py - liboeffis bindings
src/libei/_capi/liboeffis.py
Runtime support
- Lazy library loader
src/libei/_capi/loader.py - C object wrappers
src/libei/_cobject.py
Other components
- Automation caller
- User consent
- Desktop portal
- Wayland compositor
Connections 19
- Automation caller → Oeffis session: requests access
README.md - Automation caller → RemoteDesktop session: requests access
README.md - User consent → Desktop portal: approves session
README.md - Oeffis session → Desktop portal: negotiates session
src/libei/oeffis.py - RemoteDesktop session → Desktop portal: negotiates over D-Bus
src/libei/portal.py - InputCapture session → Desktop portal: negotiates capture
src/libei/portal.py - Desktop portal → EI client: provides EIS fd
- Desktop portal → EIS server: provides EIS fd
- Automation caller → EI client: sends input
README.md - EI client → EIS server: sends framed events
README.md - EIS server → Wayland compositor: implements server side
src/libei/eis.py - EI client → libei bindings: calls bindings
src/libei/ei.py - EIS server → libeis bindings: calls bindings
src/libei/eis.py - Oeffis session → liboeffis bindings: calls bindings
src/libei/oeffis.py - libei bindings → Lazy library loader: resolves functions
src/libei/_capi/libei.py - libeis bindings → Lazy library loader: resolves functions
src/libei/_capi/libeis.py - liboeffis bindings → Lazy library loader: resolves functions
src/libei/_capi/liboeffis.py - EI client → C object wrappers: wraps C pointers
src/libei/ei.py - EIS server → C object wrappers: wraps C pointers
src/libei/eis.py