Copy stdin or arguments to the system clipboard via the OSC 52 terminal escape sequence — works over SSH + tmux.
Project description
osc52
Copy stdin (or arguments) to the system clipboard via the OSC 52 terminal
escape sequence. Designed to work over SSH + tmux: the escape is written to
stderr, streamed back to your local terminal, and routed to your local
clipboard — so ssh server "nvidia-smi | osc52" copies the remote output to
your local machine, no remote clipboard tool required.
This is the Python port of the Go tool of the same name, distributed on PyPI so
pip install osc52 gives you the osc52 command directly.
Install
pip install osc52
This installs an osc52 executable onto your PATH (an osc52.exe shim on
Windows).
Usage
# Default: echo input to stdout AND copy to clipboard.
nvidia-smi | osc52
# Copy only, no echo.
nvidia-smi | osc52 -q
# Copy a file.
osc52 < config.yaml
# Copy a literal string.
osc52 "https://example.com/token"
How it works
stdin/argv ──▶ echo to stdout (visible) ─────────────────▶ terminal / pipe
└─▶ base64 ─▶ ESC ] 52 ; c ; <b64> BEL ─▶ stderr ─▶ terminal
(parses OSC 52
→ local clipboard)
- Echo goes to stdout so downstream pipes stay clean of escape sequences.
- OSC 52 goes to stderr so the terminal still parses it, but it never pollutes piped output.
- Large payloads are split into ≤32KB base64 chunks; terminals accumulate same-selection sequences into the clipboard.
Options
| Flag | Meaning |
|---|---|
-q, --quiet |
Do not echo input to stdout |
--version |
Print version |
-h, --help |
Help |
Terminal support
OSC 52 is supported by Windows Terminal, iTerm2, kitty, Alacritty, WezTerm,
foot, and recent GNOME Terminal. In tmux, ensure set -g set-clipboard on.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osc52-0.1.0.tar.gz.
File metadata
- Download URL: osc52-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a8f887f612a05a1034ea0bb14a240296929410c4f56e25922bb2200ab868e5
|
|
| MD5 |
56ac58d06bf94a3346d637d40414a18d
|
|
| BLAKE2b-256 |
f04aa544805426e02ddbc5d37cd9badeb5d099487a56d7b27aa9ae85fd2d880d
|
Provenance
The following attestation bundles were made for osc52-0.1.0.tar.gz:
Publisher:
release.yml on decajoin/osc52
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
osc52-0.1.0.tar.gz -
Subject digest:
b6a8f887f612a05a1034ea0bb14a240296929410c4f56e25922bb2200ab868e5 - Sigstore transparency entry: 2074621877
- Sigstore integration time:
-
Permalink:
decajoin/osc52@193787337f811a53226c721f81baf100349167ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/decajoin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@193787337f811a53226c721f81baf100349167ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file osc52-0.1.0-py3-none-any.whl.
File metadata
- Download URL: osc52-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
293344ce228340490742a8babf75485529d4ec06981d6191640949d37df3138f
|
|
| MD5 |
b1e66a63f7096af0c6d57d7656f8ff2c
|
|
| BLAKE2b-256 |
7d44f1eb6b7a2f6dfab894e04d9c5ffd5b568a852d4bc36e7dc0dfd867d8cb40
|
Provenance
The following attestation bundles were made for osc52-0.1.0-py3-none-any.whl:
Publisher:
release.yml on decajoin/osc52
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
osc52-0.1.0-py3-none-any.whl -
Subject digest:
293344ce228340490742a8babf75485529d4ec06981d6191640949d37df3138f - Sigstore transparency entry: 2074621891
- Sigstore integration time:
-
Permalink:
decajoin/osc52@193787337f811a53226c721f81baf100349167ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/decajoin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@193787337f811a53226c721f81baf100349167ef -
Trigger Event:
push
-
Statement type: