forked from platypush/platypush
Added plugin to manage system clipboard
This commit is contained in:
parent
38859ebd44
commit
d95b07f09b
2 changed files with 41 additions and 0 deletions
6
docs/source/platypush/plugins/clipboard.rst
Normal file
6
docs/source/platypush/plugins/clipboard.rst
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
``platypush.plugins.clipboard``
|
||||||
|
===============================
|
||||||
|
|
||||||
|
.. automodule:: platypush.plugins.clipboard
|
||||||
|
:members:
|
||||||
|
|
35
platypush/plugins/clipboard.py
Normal file
35
platypush/plugins/clipboard.py
Normal 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:
|
||||||
|
|
Loading…
Reference in a new issue