Fixed clipboard contents leaking through process list on Wayland

Former-commit-id: bb1485fec2d891af9f49b4d8e81df72b0e6160d9
Former-commit-id: 2eff4ace8b82735a890bf1e669d92d7abbb59dfa
This commit is contained in:
2023-09-24 18:56:42 -04:00
parent e8267f838a
commit 5af02866b4
2 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -544,7 +544,8 @@ def copy_data():
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL)
# Wayland clipboard detection
elif 'WAYLAND_DISPLAY' in environ:
run(('wl-copy', _copy_subject))
run('wl-copy', stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')),
stdout=PIPE).stdout)
Popen('sleep 30; wl-copy -c', shell=True)
# Haiku clipboard detection
elif uname()[0] == 'Haiku':
@@ -561,9 +562,9 @@ def copy_data():
Popen("sleep 30; termux-clipboard-set ''", shell=True)
# X11 clipboard detection
elif 'DISPLAY' in environ:
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\')
run(('xclip', '-se', 'c'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\')
.replace('%', '%%')), stdout=PIPE).stdout)
Popen("sleep 30; printf '' | xclip -sel c", shell=True)
Popen("sleep 30; printf '' | xclip -se c", shell=True)
else:
print('\n\u001b[38;5;9merror: clipboard tool could not be determined\n\nnote that the clipboard does not '
'function in a raw tty\u001b[0m\n')
+2 -1
View File
@@ -22,7 +22,8 @@ if len(arguments) > 0:
Popen("sleep 30; termux-clipboard-set ''", shell=True)"""
elif arguments[0] == 'LINUX':
replacement = """if 'WAYLAND_DISPLAY' in environ:
run(('wl-copy', _copy_subject))
run('wl-copy', stdin=Popen(('printf', _copy_subject
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout)
Popen('sleep 30; wl-copy -c', shell=True)
else:
run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject