MCPcopy
hub / github.com/asweigart/pyperclip / init_wl_clipboard

Function init_wl_clipboard

src/pyperclip/__init__.py:211–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209
210
211def init_wl_clipboard():
212 PRIMARY_SELECTION = "-p"
213
214 def copy_wl(text, primary=False):
215 text = _PYTHON_STR_TYPE(text) # Converts non-str values to str.
216 args = ["wl-copy"]
217 if primary:
218 args.append(PRIMARY_SELECTION)
219 if not text:
220 args.append('--clear')
221 subprocess.check_call(args, close_fds=True)
222 else:
223 pass
224 p = subprocess.Popen(args, stdin=subprocess.PIPE, close_fds=True)
225 p.communicate(input=text.encode(ENCODING))
226
227 def paste_wl(primary=False):
228 args = ["wl-paste", "-n", "-t", "text"]
229 if primary:
230 args.append(PRIMARY_SELECTION)
231 p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
232 stdout, _stderr = p.communicate()
233 return stdout.decode(ENCODING)
234
235 return copy_wl, paste_wl
236
237
238def init_klipper_clipboard():

Callers 2

TestWlClipboardClass · 0.90
determine_clipboardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…