blob: b5113130c77f018c695e14b4f04137b29de04f93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import subprocess
def copy(string, target=None):
extra_args = []
if target != None:
extra_args += ['-target', target]
return subprocess.run(
['xclip', '-selection', 'c'] + extra_args,
universal_newlines=True,
input=string
)
def get(target=None):
extra_args = []
if target != None:
extra_args += ['-target', target]
result = subprocess.run(
['xclip', '-selection', 'c', '-o'] + extra_args,
stdout=subprocess.PIPE,
universal_newlines=True
)
# returncode = result.returncode
stdout = result.stdout.strip()
return stdout
|