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-1.0.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-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oscopy-1.0.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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 588d8275cff72887d0be4f5732993161a178efe7ec6f1c4eb6b6e683ec99ef10
MD5 220319f9666ab57a361fb5e620e1ebcc
BLAKE2b-256 df83fa44fea238551df30498b6aff6f5edb0396ded336aa14bbfa28706277ef2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oscopy-1.0.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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14018c7e1aa9def964b3c6eced301226aaa5c021c20b552055f62a427ff1d1af
MD5 b4483c589c3af6162cbacf58f79ab92e
BLAKE2b-256 f66b50a907924ef156a3c74aed971fcc0696c04137053f80e9343e258de0dad7

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