diff --git a/docs/source/platypush/plugins/clipboard.rst b/docs/source/platypush/plugins/clipboard.rst new file mode 100644 index 00000000..c7225dca --- /dev/null +++ b/docs/source/platypush/plugins/clipboard.rst @@ -0,0 +1,6 @@ +``platypush.plugins.clipboard`` +=============================== + +.. automodule:: platypush.plugins.clipboard + :members: + diff --git a/platypush/plugins/clipboard.py b/platypush/plugins/clipboard.py new file mode 100644 index 00000000..593c28e9 --- /dev/null +++ b/platypush/plugins/clipboard.py @@ -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: +