Sha256: 8fefa79ad61908cb9cd53087725f971cc8e7e2d2d95960826f05fc7c2ea71142
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
# Ruby Clipboard [![version](https://badge.fury.io/rb/clipboard.svg)](https://badge.fury.io/rb/clipboard) [<img src="https://travis-ci.org/janlelis/clipboard.svg" />](https://travis-ci.org/janlelis/clipboard) Lets you access the clipboard on Linux, MacOS, Windows and Cygwin. ## Usage * `Clipboard.copy` * `Clipboard.paste` * `Clipboard.clear` ## Setup Add to `Gemfile`: ```ruby gem 'clipboard' gem 'ffi', :platforms => [:mswin, :mingw] ``` - **Linux**: You will need the `xclip` or `xsel` program. On debian/ubuntu this is: `sudo apt-get install xclip` ## Remarks ### Multiple Clipboards On Linux, you can choose from which clipboard you want to `paste` from by passing it as an argument. The default is CLIPBOARD. `copy` copies to all clipboards in `Clipboard::Linux::CLIPBOARDS`. ### Windows Encoding Windows uses [UTF-16LE](https://en.wikipedia.org/wiki/UTF-16) as its default encoding, so pasted strings will always come in UTF-16LE. You can manually convert them to your desired encoding (e.g. UTF-8) using the [String#encode](ruby-doc.org/core-2.3.0/String.html#method-i-encode) method: ```ruby Clipboard.paste.encode('UTF-8') ``` ### SSH To use the clipboard through ssh, you need to install `xauth` on your server and connect via `ssh -X` or `ssh -Y`. Please note that some server settings restrict this feature. ### Java There is a Java implementation included (`Clipboard::Java`) as an option for JRuby. On Linux, it always operates only on the CLIPBOARD clipboard. ### TODO * Native support on X (don't depend on `xclip`/`xsel`) would be great ### blip **blip** is a handy commandline wrapper that lets you quickly copy file content to your clipboard: [blip](https://gist.github.com/janlelis/781835)! ### Copyright Copyright (c) 2010-2016 Jan Lelis <http://janlelis.com> released under the MIT license. Contributions by and thanks to Michael Grosser and [all the other contributors!](https://github.com/janlelis/clipboard/graphs/contributors)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clipboard-1.2.1 | README.md |
clipboard-1.2.0 | README.md |
clipboard-1.1.2 | README.md |