clipboard
A simple to use clipboard library, which supports:
- Setting text as the clipboard content
- Getting the clipboard content
- Clearing the clipboard
It binds to the libclipboard library: https://github.com/jtanx/libclipboard
Installation
-
Add the dependency to your
shard.yml
:dependencies: clipboard: github: data-niklas/clipboard
-
Run
shards install
Usage
require "clipboard"
success = Clipboard.set_text("Some text")
current_clipboard_text = Clipboard.get_text()
# Now clearing it
Clipboard.clear()
When setting the clipboard content:
- The program may not exit directly!
- Wait at least ~100 milliseconds before exiting
- Else
get_text()
will return the correct text, but Ctrl+V won't work - The systems clipboard manager first needs to own / acquire the clipboard content!
Development
TODO Write development instructions here
Contributing
- Fork it (https://github.com/data-niklas/clipboard/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Niklas Loeser - creator and maintainer