clipboard-watcher
This crate can be used to subscribe to the system clipboard and read its contents whenever a new item is added to it.
Features
-
Leverages the Stream trait The listener implements
Stream, which unlocks access to all implementations that have been built around this trait, such as throttling, debouncing and so on. -
Max size filter The user can define a maximum allowed size for a clipboard item. This can be useful to avoid processing very large images or custom formats. The logic for checking an item's size vary from platform to platform. On windows, the size can always be checked without processing the data immediately. On linux, this is also possible in the majority of cases (as long as the clipboard owner supports requests for the
LENGTHproperty). On macos, there isn't a way of doing this in a cheap way (as far as I know), so the data will be loaded first and then its size will be inspected. -
Custom formats The listener supports any arbitrary custom format.
-
Customizable polling interval
Supported Formats
- HTML
- Text
- File list
- Png Images
- Other Images (normalized to raw rgb8)
- Custom formats
Example
You can run this example with cargo: cargo run --example stream
use ;
use StreamExt;
use Level;
async
Platforms
- Windows
- Macos
- Linux (requires x11/xWayland)
Credits And Licenses
Licensed under the Apache-2.0 license.
Initial concept for stream-based architecture is taken from clipboard-stream, licensed under MIT.
Various bits of code are also taken from clipboard-rs (MIT) and arboard (MIT/Apache-2.0)