Skip to main content

Python script to copy from STD to your clipboard with OSC 52.

Project description

oscopy

Python tool to copy text to your local clipboard over OSC 52, and record shell command transcripts.

How to Use It

Piping

You simply pipe to oscopy, then paste anywhere:

echo coucou_yopta | oscopy
# now you can paste "coucou_yopta" everywhere

[!IMPORTANT] This works even if you're connected to a remote SSH server. The content travels through SSH and arrives in your local system clipboard.

echo adds a trailing newline. Strip it with -s (or -x):

echo precision | oscopy -s
# now you can paste "precision" knowing it won't add a newline

Why not piping file contents?

cat ~/.ssh/id_rsa.pub | oscopy
# then paste your SSH pubkey on the website...

Record a Command

If you need to execute something and copy both the command you typed and whatever it returned back, e.g.:

$ ls -la
total 112
drwxr-xr-x@ 11 hammerill  staff    352 Mar 10 12:48 .
drwxr-xr-x  12 hammerill  staff    384 Mar  2 11:59 ..
drwxr-xr-x@ 15 hammerill  staff    480 Mar 10 15:36 .git
-rw-r--r--@  1 hammerill  staff    109 Feb  5 09:31 .gitignore
-rw-r--r--@  1 hammerill  staff      5 Feb  5 09:31 .python-version
drwxr-xr-x@  8 hammerill  staff    256 Feb  5 09:31 .venv
-rw-r--r--@  1 hammerill  staff  35149 Feb  5 09:31 LICENSE
-rw-r--r--@  1 hammerill  staff    390 Feb  5 09:31 pyproject.toml
-rw-r--r--@  1 hammerill  staff   1753 Mar 10 13:16 README.md
drwxr-xr-x@  3 hammerill  staff     96 Feb  5 09:31 src
-rw-r--r--@  1 hammerill  staff    127 Feb  5 09:31 uv.lock

...you can use oscopy to do this quickly:

oscopy run ls -la
# now you can paste the thing from above

You can try any other Shell command:

oscopy run -- git status --short

-- is optional, but useful to avoid ambiguity in edge cases with CLI args.

Record a Shell Session

Start a temporary recording shell:

oscopy record
# or `oscopy start`

Session mode currently runs in a temporary zsh shell.

Then run commands normally. When done:

oscopy stop

This copies a transcript like:

$ ls *.md
-rw-r--r--@ 1 hammerill  staff   1.1K Mar 10 12:48 README.md

$ uname -a
Darwin pommier 25.3.0 Darwin Kernel Version 25.3.0 ...

The transcript uses $ as the command prefix, includes both stdout and stderr, and inserts clean blank lines between commands.

Install

Install as a uv tool from this GitHub repo:

uv tool install git+https://github.com/hammerill/oscopy

# and, if you have OhMyZsh installed, quickly setup recommended aliases orun, orec and ostop:
oscopy aliases > ~/.oh-my-zsh/custom/oscopy-aliases.zsh

Or local dev install:

# in oscopy project folder
uv tool install -e .

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

oscopy-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

oscopy-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file oscopy-0.1.0.tar.gz.

File metadata

  • Download URL: oscopy-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oscopy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b3c50f2133bcd69e7714fb49aa39cdf381242ea2218c840c6217be2cff5cdfc
MD5 6cdf1c491527568f7aca60ee92cb5615
BLAKE2b-256 5bed284bceeff276ff2c789f4cc0cedd90a79d3ce2338f8d51213d0bbb79a142

See more details on using hashes here.

File details

Details for the file oscopy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oscopy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oscopy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83d8f8131f996a4d29cee70eaadee3549db851d0e0c548f9cae109dcd131800c
MD5 c86f40b9e517359793ccedc1c46b46c0
BLAKE2b-256 b469363e1fbf0186f8d3724d2dd8da5abc46854bf4b8294d03a837528a3670ce

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