Skip to main content

A lightweight utility to copy text to the device clipboard using OSC 52.

Project description

TermuxC

Termux copy to clipboard made easy.

Also known as TermuxCopy

License: MIT Python Version PyPI version PyPI downloads

This dual function pip package/cli tool was made to solve an issue with Termux, not allowing copying to device clipboard easily without their companion app. This package solves that.

Cli Tool Usage:

Copy text

termux text

Or

echo "test" | termuxc

Copy text from file

cat filename | termuxc

Copy current working directory

pwd | termuxc

Also compatable with

  • bat
  • grep
  • curl
  • head
  • tail

Pip package Usage:

Copy text

from TermuxC import Copy
Copy("Str") #works with strings,
Copy(1) # numbers
Copy(1.3) # and floats!

Copy text from file

from TermuxC import Copy
with open("TermuxC.py", "r") as f:
    content = f.read()
    Copy(content)

Copy current working directory

from TermuxC import Copy
import os
Copy(os.getcwd())

Installation

Install pip package

pkg install TermuxC

Uninstallation

pip uninstall TermuxC

Requirements:

Python 3+

Get Python from https://www.python.org!

View Package here https://pypi.org/project/TermuxC/

Aware:

If using terminal multiplexers such as Tmux or Screen ensure they allow OSC 52.

Tmux support

run this command to allow tmux to write to device clipboard

CONFIG_FILE=$( [ -d "$HOME/.config/tmux" ] \
  && echo "$HOME/.config/tmux/tmux.conf" \
  || echo "$HOME/.tmux.conf" ) ; \
printf "\n# Enable clipboard and passthrough\nset -s set-clipboard on\nset -g allow-passthrough on\n" >> "$CONFIG_FILE" \
&& tmux kill-server 2>/dev/null \
|| true

Screen support

run this command to allow Screen to write to clipboard

CONFIG_FILE=$( [ -f "$HOME/.screenrc" ] \
  && echo "$HOME/.screenrc" \
  || echo "$HOME/.screenrc" ) ; \
printf "\n# Enable clipboard and passthrough\nregister [ \"\nbind ] paste [\n" >> "$CONFIG_FILE" \
&& screen -wipe >/dev/null 2>&1 \
|| true

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

termuxc-2.0.9.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

termuxc-2.0.9-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file termuxc-2.0.9.tar.gz.

File metadata

  • Download URL: termuxc-2.0.9.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for termuxc-2.0.9.tar.gz
Algorithm Hash digest
SHA256 a8c3716d14efa0bac54beb8a24f288984a8a5cc6907b0d994b32aedb8d283de6
MD5 26ebe74a1c6df62d87a2fd1fdd699fc2
BLAKE2b-256 76dd3d0286c497204ffce7d724c5a8d33178d8cc012d7bb289f9c538cab93228

See more details on using hashes here.

File details

Details for the file termuxc-2.0.9-py3-none-any.whl.

File metadata

  • Download URL: termuxc-2.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for termuxc-2.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 25e447dea44698e1c5475d1fd521df425b7e19097688d7d45f8f9289b8fdafe8
MD5 8c0268985a7517e43083e8331a04b675
BLAKE2b-256 c30241ebf67d8120e0ae7f3aa8dc9df992de7836f379e86026e01e4f9116e029

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page