2018-07-24 00:35:28 +02:00
|
|
|
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
|
|
|
|
"""
|
2019-12-01 23:35:05 +01:00
|
|
|
import pyperclip
|
2018-07-24 00:35:28 +02:00
|
|
|
pyperclip.copy(text)
|
|
|
|
|
|
|
|
|
|
|
|
@action
|
|
|
|
def paste(self):
|
|
|
|
"""
|
|
|
|
Get the current content of the clipboard
|
|
|
|
"""
|
2019-12-01 23:35:05 +01:00
|
|
|
import pyperclip
|
2018-07-24 00:35:28 +02:00
|
|
|
return pyperclip.paste()
|
|
|
|
|
|
|
|
|
|
|
|
# vim:sw=4:ts=4:et:
|
|
|
|
|