Skip to main content

xclip-json

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

xclip-json is a command-line utility for Linux that dumps all the different targets on the X clipboard into a machine-readable JSON format. This is a wrapper around xclip. It is useful for saving and restoring the entire clipboard for debugging purposes.

This tool requires xclip command-line utility, which is a required package.

You can install xclip on most Debian/Ubuntu-based systems with:

sudo apt-get install xclip

Installlation

You can install xclip-json using pipx:

pipx install xclip-json

Usage

You can run the command like so:

xclip-json

This outputs the contents of all targets and selection to the clipboards.

Here is some example output:

{
  "CLIPBOARD": {
    "STRING": "This is some plain text from the clipboard.",
    "UTF8_STRING": "This is some plain text from the clipboard.",
    "text/plain;charset=UTF-8": "This is some plain text from the clipboard.",
    "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
  }
}

You can then use tools such as jq to query the data. The following command is particularly useful for this:

xclip-json | jq .CLIPBOARD | jq 'keys'

Alternatives and prior work

While I could find no tool like xclip-json you can use xclip to manually list all targets on the clipboard like so: xclip -o -t TARGETS. You can then fetch a specific target with xclip -o -t $TARGET.

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools that are related to carrying out my work.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

Metadata

Release files for xclip-json 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xclip-json 0.1.0
File Size Uploaded Provenance Actions
xclip_json-0.1.0.tar.gz 3.7 kB Without provenance Details for xclip_json-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xclip-json 0.1.0
File Interpreter ABI Platform Actions
xclip_json-0.1.0-py3-none-any.whl Python 3 none any Details for xclip_json-0.1.0-py3-none-any.whl

Total release size: 7.8 kB

Release files / xclip_json-0.1.0.tar.gz

Download URL xclip_json-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8f562621eb60386fecdb5cd8bf2a0075fd93e6d35cfa5c2959e75e02b682ac56
BLAKE2b-256 checksum
How to use checksums
48f3a9bbb81da171957ff440dd0b097db4f751ebe6a2d8340ddf403209403d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / xclip_json-0.1.0-py3-none-any.whl

Download URL xclip_json-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d589708e6c04467d86421114bdf3b3a4a7e911f36392542d7f88cf9acb8d59bb
BLAKE2b-256 checksum
How to use checksums
42e0c00b8a5d19df667e91e49bec341a48a262b47fc67e7cf2547b3b31aa2de7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for xclip-json 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page