access macOS pasteboard
Project description
Pasteboard2
Pasteboard2 is a simple Python module and command line tool to get content and its types from the macOS pasteboard (clipboard). The implementation relies on PyObjC and is modeled after the Swift program pbv.
Command Line Usage
Top Level
Usage: pb2 [OPTIONS] COMMAND [ARGS]...
╭─ Options ──────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────╮
│ clear Empties the pasteboard. │
│ clip Print the content of the pasteboard if it's a string. │
│ types List the content types of the current pasteboard. │
│ version Outputs the version number. │
╰────────────────────────────────────────────────────────────────────────────────────╯
Clip Subcommand
Usage: pb2 clip [OPTIONS]
Print the content of the pasteboard if it's a string.
╭─ Options ──────────────────────────────────────────────────────────────────────────╮
│ --type -t TEXT The type of content to get [default: public.utf8-plain-text] │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────╯
Test
git clone https://github.com/bwagner/pasteboard2.git
cd pasteboard2
python -m venv ~/venv/pb2
source ~/venv/pb2/bin/activate
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pytest
deactivate
rm -rf ~/venv/pb2
TODO
pbv offers reading from several pasteboards. We should, too.
Requirements
- pyobjc
- typer
- pytest (for development)
Contribute
git clone https://github.com/bwagner/pasteboard2.git
cd pasteboard2
source ~/venv/pb2/bin/activate
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pre-commit install
Alternatives
-
https://pypi.org/project/pasteboard/
https://github.com/tobywf/pasteboard
but it's no longer maintained (checked 20230710) -
https://pypi.org/project/tacky/
https://github.com/friedenberg/tacky
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 pasteboard2-0.0.6.tar.gz.
File metadata
- Download URL: pasteboard2-0.0.6.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a010c4b4140f7fb2880af6174fd5d5d974cc81c561ec43f55d2c67532df4021
|
|
| MD5 |
8f235bd5f9302095c102c5ad5a965843
|
|
| BLAKE2b-256 |
9724842e4542b4e35690e694137bace4aa5a1c9b32c5312c374269292f543d3f
|
File details
Details for the file pasteboard2-0.0.6-py3-none-any.whl.
File metadata
- Download URL: pasteboard2-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71466879f691431d77ffdd52c935bcf266174276129102d2f6c85d82979d37e4
|
|
| MD5 |
05cdc571085f04a211ddfde1acd27738
|
|
| BLAKE2b-256 |
500b8ec7bd81e15633defdd62aaebdfeca984f0bb15a53cb2251ccf26dd61bd7
|