Skip to main content

Cross-platform clipboard copy and paste in one function call

Project description

philiprehberger-clipboard

Tests PyPI version License

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.2.tar.gz (3.4 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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a9a4c0bdede09f6b4ad2eb67427408aa987668a6f9d5ab9bc49f64bb3514e80b
MD5 3e74352a0c6c4d3fa0be19558bd9bfb6
BLAKE2b-256 9aad1dbe8c7f2e2112faa0322553b656f157d91f88f9fffaf44037f9fae2f561

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a498b6935e61d02f69e76b84b5df02c838efd7e086a93c9840f70a7b72d52cab
MD5 97f08471e2a9bf9fe67f8caa5e944afe
BLAKE2b-256 3a9ad14da44bb5268c4b772859ab817df064eb98a3ae82125b970ab4d4c860b8

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