Cross-platform clipboard copy and paste in one function call
Project description
philiprehberger-clipboard
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file philiprehberger_clipboard-0.1.6.tar.gz.
File metadata
- Download URL: philiprehberger_clipboard-0.1.6.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
199bc522e059842aa554b6f9dea00f8d72198d19472acc8d9d65fd29cb040995
|
|
| MD5 |
bc40ee5a9777d8232d1db57367711499
|
|
| BLAKE2b-256 |
596b62a9e17e24f3f6786bb2921ac6635ebae8519fd50e5617bb1cc5f002edd4
|
File details
Details for the file philiprehberger_clipboard-0.1.6-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_clipboard-0.1.6-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f3cf8b03bfd72f13d5689dafdc370b55213124936d66d76da316995fa48496f
|
|
| MD5 |
e9a2bc2553c4ba2830480864ba8a767b
|
|
| BLAKE2b-256 |
c270ed0faeb3b1f89afc779cb69fd383a3a4b1564909418b4abe378c0d2a8f31
|