Added plugin to manage system clipboard

This commit is contained in:
Fabio Manganiello 2018-07-24 00:35:28 +02:00
parent 38859ebd44
commit d95b07f09b
2 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,6 @@
``platypush.plugins.clipboard``
===============================
.. automodule:: platypush.plugins.clipboard
:members:

View file

@ -0,0 +1,35 @@
import pyperclip
from platypush.plugins import Plugin, action
class ClipboardPlugin(Plugin):
"""
Plugin to programmatically copy strings to your system clipboard
and get the current clipboard content.
Requires:
* **pyperclip** (``pip install pyperclip``)
"""
@action
def copy(self, text):
"""
Copies a text to the OS clipboard
:param text: Text to copy
:type text: str
"""
pyperclip.copy(text)
@action
def paste(self):
"""
Get the current content of the clipboard
"""
return pyperclip.paste()
# vim:sw=4:ts=4:et: