Skip to main content
TermAdaptor logo

TermAdaptor

License: WTFPL PyPI Downloads Code style: black

Demo

Built on top of tmux and many other libraries, Cybergod is capable of understanding and interacting terminal interface with both text-only and multimodal modes. With the help of wcwidth, cursor is placed precisely at the right position even if there are multi-width unicode chars (CJK characters for example).

Code can be found here.

To interact with the environment programmatically, check out here

# env: TmuxEnvironment
env.send_key("vim")
env.send_key("Enter")

Terminal parsing (colorless):

Cybergod demo

Terminal parsing (colorful):

Cybergod demo

Terminal screenshot converted from HTML (cursor in red):

Vim screenshot

Terminal with dark theme and grayscale effects except for the cursor:

Cursor highlight

You can also have a block-styled cursor:

Block cursor

Change the cursor character to underline:

Underline cursor char

Override the cursor block style:

Custom block style

Usage

Terminal environment integration

First, install required binaries:

sudo apt install -y tmux tmuxp aha

Next, install the following dependencies:

pip install parse playwright beautifulsoup4

# setup playwright if you want to take terminal screenshots
playwright install chromium

Finally copy the lib.py, then run test_lib.py next to the lib.py.

The SESSION_COMMAND in test_lib.py is the initial terminal environment command to be executed. Change it according to your need.

To view the environment:

preview = session.preview_html(show_cursor=True,wrap_html=True, dark_mode=True, grayscale=True)

To interact with the environment:

# note that both special key and literal strings can be sent.
env.send_key("date")
env.send_key("Enter") # special key

A full mapping from conventional special keys to standard Tmux special keys can be generated by running generate_funckey_alias.py

You can read the test file for further integration.

Star History

Metadata

Release files for termadaptor 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for termadaptor 0.0.2
File Interpreter ABI Platform
termadaptor-0.0.2-py3-none-any.whl Python 3 none any Details

Release files / termadaptor-0.0.2-py3-none-any.whl

Download URL termadaptor-0.0.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d5b8881e0c84582d32c6b2851d05213f62747f686fc2156773815d5b57b03ed
BLAKE2b-256 checksum
How to use checksums
c96f72019c250d02830165924de8bba187525fd78b3b3ff4ee5796eba36c6371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Security for termadaptor 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page