oscclip
oscclip is a set of utilities which utilize the system clipboard via
terminal escape sequences. Using these sequences, the system clipboard is
accessible via SSH as well. Terminal multiplexers, such as tmux and
screen, are supported.
Two protocols are implemented:
- OSC 52 — the classic clipboard escape sequence which is supported by many terminal emulators. It is limited to plain text.
- The kitty clipboard protocol (OSC 5522) — a modern protocol developed by the kitty terminal emulator. In addition to plain text, it supports arbitrary data types like images, proper error reporting and a permission system.
Both tools auto-detect the terminal's capabilities and prefer the kitty
clipboard protocol with fallback to OSC 52. The behavior can be pinned with
the --protocol option.
Installation
$ pipx install oscclip
# or: uv tool install oscclip
Examples
Setting the clipboard
$ echo "Foo" | osc-copy
Reading the clipboard
$ osc-paste
Foo
Copying arbitrary data types (kitty protocol). The MIME type is detected automatically from the data:
$ osc-copy < screenshot.png
$ osc-copy -m image/png < screenshot.png
$ osc-paste -m image/png > screenshot.png
Listing the MIME types available on the clipboard (kitty protocol)
$ osc-paste --list-mime
text/plain
image/png
Displaying an image from the clipboard in the terminal (kitty graphics protocol)
$ osc-paste --image
This requires a terminal which implements the kitty graphics protocol, e.g. kitty, Ghostty, WezTerm or Konsole.
Clearing the clipboard
$ osc-copy --clear
Bypassing terminal multiplexers (see the tmux caveat below)
$ echo "Foo" | osc-copy --bypass
Run osc-copy --help / osc-paste --help for the full list of options.
Permissions
Terminals which implement the kitty clipboard protocol ask the user for
permission when the clipboard is read. In kitty, this behavior can be
controlled with the clipboard_control option in kitty.conf.
Development
The project is managed with uv; project tasks are defined in the justfile.
$ git clone https://github.com/rumpelsepp/oscclip
$ cd oscclip
$ uv sync
$ just # lint + typecheck + test
Run just --list to see all tasks.
Tooling: ruff (lint & format),
mypy (--strict), ty
and pytest.
Fuzzing
The parsers are covered by property-based tests
(hypothesis, in
tests/test_properties.py) and by a coverage-guided fuzzer
(atheris, libFuzzer-based, in
fuzz/fuzz_parsers.py with seeds in fuzz/corpus/):
$ just fuzz # hypothesis with the extended "fuzz" profile
$ just fuzz-native # atheris for 60s; crashes land in fuzz/crashes/
Tested Terminals
- alacritty (OSC 52)
- foot (OSC 52)
- ghostty (OSC 52 and kitty clipboard protocol)
- kitty (OSC 52 and kitty clipboard protocol)
- tmux (OSC 52 mediation)
For a list of terminals that support OSC 52, see this table.
Caveats
tmux
tmux mediates clipboard access between panes and the outer terminal. The behavior is controlled by two tmux server options:
set-clipboard(default:external) — whether tmux sets the system clipboard of the outer terminal. Only withset -s set-clipboard ondoes tmux accept OSC 52 clipboard writes from panes, so this is required forosc-copyto work from inside tmux.get-clipboard— how tmux answers clipboard queries from panes. Withbuffer(the default), tmux answers with its newest paste buffer;requestandbothforward the query to the outer terminal instead (tmux set -s get-clipboard both).
tmux does not implement the kitty clipboard protocol (OSC 5522); oscclip
detects this and automatically falls back to OSC 52.
With --bypass, all escape sequences are wrapped in tmux' passthrough DCS
sequences and reach the outer terminal unchanged. This requires the
allow-passthrough option (tmux set -w allow-passthrough on).
Metadata
Release files for oscclip 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oscclip-0.6.2.tar.gz | 23.2 kB | With provenance | Details for oscclip-0.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oscclip-0.6.2-py3-none-any.whl | Python 3 | none | any | Details for oscclip-0.6.2-py3-none-any.whl |
Total release size: 55.5 kB
Release files / oscclip-0.6.2.tar.gz
| Download URL | oscclip-0.6.2.tar.gz |
|---|---|
| Size | 23.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3cd115b8addd50abbbab0f6db512aca9549661b5595aec676728c51b81d1de4
|
|
BLAKE2b-256 checksum How to use checksums |
66761b90d70dc41cb23a84811c1674a974dfcd0e5fd37ea6e31bb213845201cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / oscclip-0.6.2-py3-none-any.whl
| Download URL | oscclip-0.6.2-py3-none-any.whl |
|---|---|
| Size | 32.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19b1a3c0b70983efdd321b6f0d29526a7a3d3560b6e73ad5d355391a62f0e6b6
|
|
BLAKE2b-256 checksum How to use checksums |
d7a70216ac76eb9878d6db5842b398fb5c9e7e71d76797deb69ee2596dfa85a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for oscclip 0.6.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for oscclip-0.6.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA 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.