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: pasteboard2.py [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. │
│ test Run tests with pytest and doctest. │
│ types List the content types of the current pasteboard. │
╰────────────────────────────────────────────────────────────────────────────────────╯
Clip Subcommand
Usage: pasteboard2.py 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
pip install -r requirements.txt
./src/pasteboard2/pasteboard2.py test
deactivate
rm -rf ~/venv/pb2
Requirements
- pyobjc
- typer
- pytest (for development)
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
pasteboard2-0.0.3.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for pasteboard2-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28330b95ce471dec59dedfa0e4b832bfad6ec0e5b73b64b66387108d07c8c4a0 |
|
MD5 | 54af83b1898816590905f7720e8116ec |
|
BLAKE2b-256 | 9f9cf9c82d17838f7f31db937ba5622ba17e27e6c1950b9d7dd5eda9707f5736 |