#clipboard #ssh #wsl #copy #remote #session #control

bin+lib clipboard-anywhere

Copy text to the clipboard, even in WSL and SSH sessions

6 releases

0.2.3 Dec 24, 2023
0.2.2 Sep 22, 2023
0.2.1 Aug 1, 2022
0.1.1 Jul 28, 2022

#10 in #wsl

Download history 4/week @ 2024-11-15 6/week @ 2024-11-22 3/week @ 2024-11-29 28/week @ 2024-12-06 57/week @ 2024-12-13 13/week @ 2024-12-20 2/week @ 2024-12-27 4/week @ 2025-01-03 43/week @ 2025-01-10 29/week @ 2025-01-17 44/week @ 2025-01-24 25/week @ 2025-01-31 33/week @ 2025-02-07 44/week @ 2025-02-14 28/week @ 2025-02-21 49/week @ 2025-02-28

165 downloads per month
Used in 3 crates

MIT license

6KB
66 lines

clipboard-anywhere

Crates.io

A simple wrapper around arboard that works in a few more situations:

  • In Linux under WSL, it can copy to and from the Windows clipboard (using powershell set-clipboard and powershell get-clipboard)
  • In a remote SSH session, can copy to the local clipboard using the OSC 52 control sequence

Usage

// Attempt to get clipboard contents. Will return error in an SSH session
let clipboard_contents: String = clipboard_anywhere::get_clipboard()?;

// Set clipboard contents to "Hello, world!";
clipboard_anywhere::set_clipboard("Hello, world!")?;

To Do

  • Define custom errors instead of passing everything through Anyhow
  • Write some integration tests

Dependencies

~0.6–12MB
~149K SLoC