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

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.4.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.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2befa548194583da3812d482049bed86d23228ce31813c116cdfd7a47d452d09
MD5 01a1ed2da199cec9fd8e3b8c2f50dd45
BLAKE2b-256 eaea558b1b05c8eda1c1f784f36a65d1eaa7d213d772443a26b059b8185379fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 702d568f13533955193102c0294134328c7168b9fb747f3896f500f2daf2dab9
MD5 f6cffb1093c95e868a384decf9f59771
BLAKE2b-256 8cfde15605cab42a820a1b22e504e3279b5a3b8ee51a6c5f17dfdf90980906cb

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