Skip to main content

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

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)

Uploaded Source

Built Distribution

pasteboard2-0.0.3-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page