tauri-plugin-clipboard-next

Crates.iotauri-plugin-clipboard-next
lib.rstauri-plugin-clipboard-next
version0.1.4
created_at2025-12-29 00:49:43.107113+00
updated_at2026-01-05 09:27:53.837467+00
descriptionTauri 2 clipboard plugin: read/write/listen to clipboard (text/rtf/html/image/files) on Windows/macOS/Linux/iOS.
homepagehttps://github.com/zhoushi1/tauri-plugin-clipboard-next
repositoryhttps://github.com/zhoushi1/tauri-plugin-clipboard-next
max_upload_size
id2009670
size260,222
zhoushi1 (zhoushi1)

documentation

https://docs.rs/tauri-plugin-clipboard-next

README

tauri-plugin-clipboard-next

Crates.io npm License

Tauri 2 clipboard plugin: read/write/listen to clipboard (text/image/RTF/HTML/files) on Windows/macOS/Linux/iOS.

English | 简体中文

FEATURE SUPPORT

  • Plain text
  • Html
  • Rich text
  • Image (In PNG format)
  • File (In file-uri-list format)
  • Watch clipboard changes

Platform Support

Platform Supported
Windows
macOS
Linux
iOS(Beta)
Android 🚧

Install

cargo add tauri-plugin-clipboard-next

You can install the JavaScript Guest bindings using your preferred JavaScript package manager:

pnpm add tauri-plugin-clipboard-next-api

Usage

src-tauri/src/lib.rs

pub fn run() {
    tauri::Builder::default()
+       .plugin(tauri_plugin_clipboard_next::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

src-tauri/capabilities/default.json

{
    ...
    "permissions": [
        ...
+       "clipboard-next:default"
    ]
}

Afterwards all the plugin's APIs are available through the JavaScript guest bindings:

import { startWatch, onClipboardChange } from 'tauri-plugin-clipboard-next-api';

await startWatch();

const unlisten = await onClipboardChange((clipboard) => {
  console.log('Clipboard changed:', clipboard);
});

// Later, to stop listening
unlisten();

Methods

Method Description
startWatch Start listening for clipboard changes
stopWatch Stop listening for clipboard changes
hasText Check if the clipboard contains plain text
hasRtf Check if the clipboard contains rich text
hasHtml Check if the clipboard contains html
hasImage Check if the clipboard contains an image
hasFiles Check if the clipboard contains files
readText Read plain text from the clipboard
readRtf Read rich text from the clipboard
readHtml Read html from the clipboard
readImage Read image from the clipboard
readFiles Read file paths from the clipboard
writeText Write plain text to the clipboard
writeRtf Write rich text to the clipboard
writeHtml Write html content to the clipboard
writeImage Write an image to the clipboard from a file path
writeFiles Write file paths to the clipboard
clear Clear the clipboard contents
getFilePath Get the file path for clipboard operations
readClipboard Read all available content from the clipboard
onClipboardChange Listen for clipboard changes

Example

git clone https://github.com/zhoushi1/tauri-plugin-clipboard-next.git
pnpm install

pnpm build

cd examples/tauri-app

pnpm install

pnpm tauri dev

Thanks

  • Special thanks to the clipboard-rs crate, which provides reliable cross-platform clipboard operation capabilities for this Tauri 2 plugin (supporting text, image, rich text, HTML and files).
Commit count: 0

cargo fmt