Metadata-Version: 2.4
Name: urirun-uinput
Version: 0.1.1
Summary: Linux uinput keyboard/mouse input surface primitive for urirun — synthesize key/click/move events via /dev/uinput ioctls. Pure stdlib, no urirun dependency.
License-Expression: Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# urirun-uinput


## AI Cost Tracking

![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.1-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.01-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-4.6h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)

- 🤖 **LLM usage:** $0.0132 (2 commits)
- 👤 **Human dev:** ~$459 (4.6h @ $100/h, 30min dedup)

Generated on 2026-07-05 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)

---



The **Linux uinput keyboard/mouse input surface primitive** for urirun, extracted from
`urirun.connectors.inputs.uinput` as a standalone, dependency-free package.

It synthesizes real keyboard and pointer events by writing to `/dev/uinput` via ioctls — the
input half of a desktop surface (the capture half is the KVM connector / mutter backend). Pure
stdlib (`fcntl`, `os`, `struct`, `time`) — **no `urirun` dependency** — so any connector can adopt
it without pulling in the backend.

## Why it's its own package

`extraction_audit.py --preset E` reports the connectors toolkit (which this belongs to) GREEN, and
uinput itself pulls only stdlib. It is consumed by URI, swappable, and reusable across connectors —
the same lift case as `urirun-cdp`. The KVM connector injects its own resolvers and adopts it.

## Install

```bash
pip install -e .          # editable, from this repo
```

## Back-compat

The old import path still works via a re-export shim in the urirun package:

```python
from urirun.connectors.inputs import uinput   # → urirun_uinput.uinput (sys.modules shim)
```

So existing code and the `test_kernel_adoption` contract test (which guards the symbols the KVM
connector relies on) keep working unchanged. That contract test skips gracefully when this package
isn't installed, matching how the connector packages are tested in their own CI rather than urirun's.

## Tests

```bash
PYTHONPATH=../urirun/adapters/python python -m pytest tests/ -q
```

The surface's own tests live here (`tests/test_uinput.py`); they exercise the event-encoding
primitives without a real `/dev/uinput` device.

## License

Licensed under Apache-2.0.
