clipboard-many-files
@readwithai - X - blog - machine-assisted reading
A command-line tool to copy several files to the clipboard as though you copied them from a file browser.
At present, this tool only supports Linux (both X11 and wayland). This tool requires xclip if you are using X11 or wl-clipboard if you are using Wayland.
Motivation
You can copy and paste multiple images from file browsers such as Dolphin in KDE to many applications such as wordprocessors and browsers. It is useful to be able to do this from the command-line and within scripts
I could not find any command-line tools to this, despite it being fairly straight-forward when you understand the protocol used. I decided to implement this in a standard way and share it in an easy-to-use form.
Alternatives and prior work
Most file browsers support copy-and-pasting multiple files.
It is fairly straightforward to do this manually by setting the text/uri-list target in the clipboard to a new-line separated list of entries file URL scheme. Any user familiar with bash could create a shell script on their path to do so. This tool, however, removes the need to maintain such as script, and can easily be installed on any system.
Attribution
I made use of this approach of converting paths to URLs.
When reviewing clipbaord libraries, I found some of the code of pyperclip informative for implementing wayland functionality.
Installation
You can install clipboard-many-files using pipx:
pipx install clipboard-many-files
Usage
Two executables are provides clipboard-many-files and cmf. These do the same thing.
To place files on the clipboard you can run.
cmf file1.ext file2.ext
You can wish to use a global to place multiple files on the clipboard:
cmd *.png
Caveats
I wrote and tested this tool on Linux and this is the only operating system supported at the moment. Patches adding support to other operating systems are much appreciated and will be quickly merged.
I use a couple of command-line tools to access the clipboard. I could find no python library which supported setting targets and reading the code for xclip communicating with X11 directly is probably more effort that this involved. Klembord seems to have this option - but has been archived and when I tested this functionality on X11 it did not work.
Support
If you found this tool useful, you could give me $1 on my ko-fi. This will incentivize me to respond to issues with this project and create similar tools.
You can also support this project by looking at similar tools that I have created or reviewing my work related to reading and research.
About me
I am @readwithai. I create tools for reading, research and agency, sometimes using Obsidian.
I also tend to produce a stream of tools related to my work.
I post about both on X. I write more about reading and research on my blog.
Metadata
Release files for clipboard-many-files 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clipboard_many_files-1.0.3.tar.gz | 5.0 kB | Without provenance | Details for clipboard_many_files-1.0.3.tar.gz |
Release files / clipboard_many_files-1.0.3.tar.gz
| Download URL | clipboard_many_files-1.0.3.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8e96cd74f48a63f2f41c6f016f246e440c84a3a8ef2e8c22d8354c6c0a9f555
|
|
BLAKE2b-256 checksum How to use checksums |
296c8c065618f4073dd497fe57594d31a0107e47e9c7747d60c4d72f66fb2942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for clipboard-many-files 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.