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.

Installation

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

Development

pip install -e .
python -m pytest tests/ -v

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.6.tar.gz
Algorithm Hash digest
SHA256 199bc522e059842aa554b6f9dea00f8d72198d19472acc8d9d65fd29cb040995
MD5 bc40ee5a9777d8232d1db57367711499
BLAKE2b-256 596b62a9e17e24f3f6786bb2921ac6635ebae8519fd50e5617bb1cc5f002edd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2f3cf8b03bfd72f13d5689dafdc370b55213124936d66d76da316995fa48496f
MD5 e9a2bc2553c4ba2830480864ba8a767b
BLAKE2b-256 c270ed0faeb3b1f89afc779cb69fd383a3a4b1564909418b4abe378c0d2a8f31

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