Skip to main content

Cross-platform clipboard copy and paste in one function call

Project description

philiprehberger-clipboard

Cross-platform clipboard copy and paste in one function call.

Install

pip install philiprehberger-clipboard

Usage

from philiprehberger_clipboard import copy, paste

copy("Hello, clipboard!")
text = paste()
print(text)  # Hello, clipboard!

CLI

Copy text from stdin:

echo "Hello" | python -m philiprehberger_clipboard copy

Paste clipboard contents to stdout:

python -m philiprehberger_clipboard paste

Or use the installed script:

echo "Hello" | clipboard copy
clipboard paste

API

Function Description
copy(text: str) -> None Copy a string to the system clipboard
paste() -> str Read a string from the system clipboard
ClipboardError Raised when clipboard tool is unavailable or operation fails

Platform support

Platform Copy Paste
Windows clip.exe PowerShell Get-Clipboard
macOS pbcopy pbpaste
Linux (X11) xclip or xsel xclip or xsel
Linux (Wayland) wl-copy wl-paste

License

MIT

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

philiprehberger_clipboard-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

philiprehberger_clipboard-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_clipboard-0.1.1.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ad66a05b7c44071fcaca11e685dd196840b08d33ef9a3e8350cd14c1502b042
MD5 d2009fe2f804be611e21596285f8dc78
BLAKE2b-256 2bedc23a3b54903f0e520f48bb740a6e87bc4edbcc2d9e86ef035f2b5f3fd656

See more details on using hashes here.

File details

Details for the file philiprehberger_clipboard-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1659faa0e133a20ef2022c88190debe485700b370c6f030e8931121c0560bab0
MD5 35b8c7d874f7c246c8e42a1a635c0072
BLAKE2b-256 79dba341fabe712c37a69d5ca943fa566842a842954a2cd133254c2466ea8d95

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