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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b86708bfd36faa73a1988be30157df801f6a85b73e70ace2bd882537f27a6a3c
MD5 9b863c342ab4ec8c9da97bbb86823a98
BLAKE2b-256 07d8b2754ff6ea67473e8695dfe61b37bb15a13acaa8ca1c6c253017baa2102b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_clipboard-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 872ad4d8ef841fbc2afe159d9d1a58bf0d2c4dcef6d539d544c5691132a310e1
MD5 0350224fcd598af88342a31efc708e94
BLAKE2b-256 d5659aeac6e159e8e7d2dfc1e45acfa6ea34d5edc3d180c9317df6c6fdf17db4

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