Gem: clipboard
The clipboard gem allows you to access the clipboard on Liunx, MacOS and Windows.
The focus is on simple text. You can copy a string with Clipboard.copy("string")
and paste it with Clipboard.paste
. That’s it ;). Basically. Now let’s take a closer look at the specific platforms.
Linux
For Linux support, the little utility xclip
is needed, you can install it on ubuntu with sudo apt-get install xclip
Furthermore, you can choose, from which clipboard you want to paste
(default is PRIMARYCLIPBOARD). copy
copies to all clipboards in Clipboard::CLIPBOARDS
. For example: Clipboard.paste :primary
MacOS
On MacOS, everything works fine :).
Windows
I’ve fought with the Win32API and still not all problems are solved (e.g. pasting with 1.9). Copying should be no problem, but you need the Now using ffi, feedback needed if it is working as expected ;).clip.exe
program (installed by default since Vista).
grosser | October 04, 2010
nice to have this implemented cross-platform!